Carl's Blog

Researcher. Mountaineer.

Archive for the ‘Archlinux’ Category

Grub error 15 on installing ArchLinux

without comments

If anyone else has this error thrown inexplicably after installing a fresh version of Arch, you may want to look at this handy post, which will solve all your problems.

http://www.archlinux.org/news/changes-to-kernel-package-and-filenames/

 

Written by carl

August 14th, 2011 at 6:42 pm

Posted in Archlinux

Tagged with , ,

Rails 3 and lighttpd

without comments

This was performed on Archlinux with lighttpd 1.4.28 and rails 3.0.3

Prerequisites

Required packages:

  • lighttpd,
  • fcgi,
  • ruby,
  • and their dependencies…

 

Ruby Setup

Required gems:

  • fcgi,
  • bundler

(if you are behind a proxy, the magic gem command is :

<code># gem install GEM -r -p "http://[PROXY_URL]:[PROXY_PORT]"</code>

)

Once you have that you need to create a “dispatch.fcgi” script to do all the rails magic. I found an example one at http://stackoverflow.com/questions/3296206/rails-3-and-fcgi .

<code>#!/usr/bin/ruby

require 'rubygems'require 'fcgi'

require_relative '../config/environment'

class Rack::PathInfoRewriter  

  def initialize(app)    
    @app = app  
  end

  def call(env)    
    env.delete('SCRIPT_NAME')    
    parts = env['REQUEST_URI'].split('?')    
    env['PATH_INFO'] = parts[0]    
    env['QUERY_STRING'] = parts[1].to_s    
    @app.call(env)  
  end
end

Rack::Handler::FastCGI.run  Rack::PathInfoRewriter.new(YOUR_APP_NAME::Application)

</code>

Running a “bundle install” from your app root will make sure all the necessary gems are available for local use. Follow these instructions and run “ruby public/dispatch.fcgi”, if you get no errors, voila!

Lighttpd Setup

Now, to set up lighttpd you need to merge this with your config:

<code>server.modules   += ( "mod_fastcgi", "mod_rewrite" )

$HTTP["host"] == "localhost" {        

  server.document-root       =   "/path/to/your/app/public/"

  server.dir-listing         =   "disable"        
  server.error-handler-404   =   "/dispatch.fcgi"

  fastcgi.server             =   ( 
                                   ".fcgi" =&gt; ( 
                                     "localhost" =&gt; (
                                       "min-procs" =&gt; 1,
                                       "max-procs" =&gt; 1,
                                       "socket" =&gt; "/tmp/ruby-beholder.socket",                
                                       "bin-path" =&gt; "/path/to/your/app/public/dispatch.fcgi",                
                                       "bin-environment" =&gt; ( "RAILS_ENV" =&gt; "development" )        
                                       ) 
                                     ) 
                                   )
}</code>

A quick “sudo /etc/rc.d/lighttpd restart” and a check of the error logs will tell you if it has worked

Written by carl

May 6th, 2011 at 11:29 am

Battery Monitor – rbatmon

without comments

I use a rather spartan windowing manager called awesome in all of my machines. This has been a fine setup until I used it on my netbook due to one small issue, battery monitors.

On my desktop machines and the laptop I use gkrellm to monitor cpu and memory and for the laptop it has a handy battery usage label. With the netbook however, screen real estate is quite valuable, so I opted for finding something to sit in the system tray.

After a quick look it seems there was nothing which was lightweight or simple or not requiring me to install the entirety of gnome.

In the end I made my own called rbatmon, then packaged it up for use in the AUR. If you have a substandard flavour of linux, not to worry, You can grab the script from my githib page here.

The most interesting challenge of this was building a package for the first time. There is a great package for Archlinux called abs (available on pacman) which fills /usr/share/pacman with some example PKGBUILDS for standard sources of gettings code from VCS’s.

Page on my site regarding this is here.

AUR page is here.

C

Written by carl

July 15th, 2010 at 12:21 am

Posted in Archlinux,Ruby,Tech

Tagged with , , , , ,