Now you can create RPM package for your Rails application fairly easily. Here are the instructions:

  1. Install and config rpmbuild. (You may wanna read an RPM Tutorial.)
  2. Install rpmpackager plugin:
    ruby script/plugin install \
    http://rubyworks.googlecode.com/svn/trunk/rpmpackager/
  3. Config rpmpackager plugin. Edit vendor/plugins/rpmpackager/config.yml as following:
    configuration:
      # name of your application
      app_name: rubyworks-dogfood
      description: This is dogfood of RubyWorks.
      license: Apache
      version: 1.2.1
      release: 1
      # RPM dependencies. separated with commas
      dependencies: openssl, mysql >= 5.0
      # gem dependencies and installation indecies
      # 0 for gems don't need selection
      gems: 
        redcloth: 0
        rcov: 1
  4. Create RPM package:
    • rake rpm_package
    • (By default the generated RPM will install your application to ”/usr/local/lib/rails-apps/#{app_name}”.)

That’s it. Package your application and throw it to deployment :>

Create A Yum Repository

April 12th, 2007

  1. Build your RPM packages. Refer to “Maximum RPM”. Assume you put your RPM packages in /path/to/RPMS/i386/*.rpm
  2. Create a yum repository
    • cd /path/to/RPMS/..
    • createrepo RPMS
    • (Now there should be a /path/to/RPMS/repodata directory.)
  3. Publish your repository. I wanna publish it via Apache, so I do following:
    • ln -s /path/to/RPMS /var/www/RPMS
    • (Browse http://localhost/RPMS, there should be “repodata” and “i386” directories.)
  4. Enable your repository in client machine. Edit /etc/yum.conf file as following:
    [main]
    cachedir=/var/cache/yum
    debuglevel=2
    logfile=/var/log/yum.log
    
    [my-repository]
    name = My Repository
    baseurl=http://localhost/RPMS
    gpgcheck=0
    

Here we go! Invoke “yum list” and you should able to see all RPM packages you built.