This document discusses packaging Ruby and Rails applications for production. It covers using system packages versus gems, configuration management tools like Chef and Puppet, creating Debian packages, packaging gems, build servers, pain points like outdated Rubygems packages, and ideas for deeper Bundler integration and packaging gems by default. Overall it presents strategies for deploying Ruby applications as system packages for production servers.
12. dpkg -l
$ dpkg -l
ii adduser 3.112ubuntu1
ii apt 0.7.25.3ubuntu9.3
ii apt-utils 0.7.25.3ubuntu9.3
ii aptitude 0.4.11.11-1ubuntu10
ii autoconf 2.65-3ubuntu1
ii automake 1:1.11.1-1
ii autotools-dev 20090611.1
ii base-files 5.0.0ubuntu20.10.04.2
ii base-passwd 3.5.22
ii bash 4.1-2ubuntu3
ii bash-completion 1:1.1-3ubuntu2
ii binutils 2.20.1-3ubuntu7
ii build-essential 11.4build1
ii bzip2 1.0.5-4ubuntu0.1
ii cdbs 0.4.62+nmu1ubuntu9
ii cmake 2.8.1-4~lucid1
ii cmake-data 2.8.1-4~lucid1
ii coreutils 7.4-2ubuntu2
ii cpp 4:4.4.3-1ubuntu1
ii cpp-4.4 4.4.3-4ubuntu5
ii cpu-checker 0.1-0ubuntu2
ii cron 3.0pl1-106ubuntu5
ii dash 0.5.5.1-3ubuntu2
ii debconf 1.5.28ubuntu4
ii debconf-i18n 1.5.28ubuntu4
ii debhelper 7.4.15ubuntu1
ii debianutils 3.2.2
ii debootstrap 1.0.28ubuntu1~lucid1
ii devscripts 2.10.61ubuntu5
...
34. package "sudo" do
action :upgrade
end
user "sshservice" do
system true
action :create
end
template "/etc/sudoers" do
source "sudoers.erb"
mode 0440
owner "root"
group "root"
variables(:user => "sshservice")
action :create
end
44. debian/control
Source: myapp
Section: web
Priority: extra
Maintainer: Fabio Kung <fabio.kung@locaweb.com.br>
Build-Depends: debhelper (>= 7)
Standards-Version: 3.8.3
Homepage: https://github.com/locaweb/myapp
Package: myapp
Architecture: any
Depends: rubygems (>= 1.3.6), libapache2-mod-passenger (>= 2.2)
Description: my great new app
Visit https://mycompany.com/myapp for more information
45. debian/changelog
myapp (0.0.2) unstable; urgency=low
* Applying SOLID after attending railsconf 2011
* using Devise
-- Fabio Kung <fabiokung@locaweb.com.br> Wed, 18 May 2011 08:00:30 -0300
myapp (0.0.1) unstable; urgency=low
* Initial release
-- Rodrigo Vaz <rodvaz@locaweb.com.br> Wed, 17 May 2011 18:05:20 -0300
50. debian-ruby-
maintainers
Giving up on Ruby packaging - Lucas Nussbaum
http://www.lucas-nussbaum.net/blog/?p=617
51. FPM
awesome
https://github.com/jordansissel/fpm
I want a simple way to create packages
without all the bullshit. In my own
infrastructure, I have no interest in Debian
policy and RedHat packaging guidelines ‐ I
have interest in my group's own style culture
and have a very strong interest in ge6ng work
done.
‐‐ Jordan Sissel
68. pain points
• old rubygems official system packages
• bundler (!)
• package yourself
• PPA?
69. Thanks!
fabio.kung at gmail, @fabiokung
rodrigo.vaz at gmail, @rodrigovaz
additional info:
https://wiki.ubuntu.com/PackagingGuide
http://morethanseven.net/2011/01/16/Why-developers-should-care-about-system-packages.html
https://github.com/jordansissel/fpm
http://www.lucas-nussbaum.net/blog/?p=617
Editor's Notes
\n
infrastructure coding\n
\n
\n
\n
\n
NO! and yes. :-)\n**my** packages on **my** servers\nprivate repositories\n
\n
\n
multiple systems\nmultiple languages\nmultiple architectures\nsystem packages provide a lot of useful features\n
what is installed?\nwhat are the versions?\nwhat is the _current_ version of my app?\n
what are the config files?\nwhat is included?\n
what is the package of this file?\n
\n
\n
learning from operating systems, self-test boot\ndiff .example .conf\nexternal systems, api versions, required assets, filesystem, required users, fixtures, ...\nit&#x2019;s all about dependencies! (other than package dependencies)\n
\n
bytecode precompilation\n
package => many projects\nsame package => many machines\nmultiple versions\n
\n
avoid compilation/build on production servers \ngcc, make, g++, libc-dev, etc\nrvm, git, ... the more crap you have in prod servers => the more to exploit\n\n
**same package** being deployed at different staging environments\n
\n
\n
\n
\n
pre/postrm\n
\n
rebuildable servers\nservers/machines as code\nrecreating machines => easy\n
what goes inside the package? what doesn&#x2019;t?\n
\n
Configuration Managers\n
chef receipt\n
cf promisse\n
it belongs to your app => put it inside the package\nunless you expect it to be changed\nare people going to edit it after installing the package?\n
why things seem to be slower in the ruby vs system packages camp?\nwhy just a few people seems to be caring?\n
\n
\n
\n
rubygems, ruby and passenger debs\n
\n
tools\nnot usual to &#x201C;build&#x201D; stuff on production servers\nplatforms offer easy ways to make binary/system packages\nruby is probably missing that. Nobody is caring\n
\n
\n
\n
\n
other ideas:\n - rvm gemset package\n - rvm rubies package\n
\n
\n
\n
cloud IaaS and VMs help a lot\nbricklayer\nlaunchpad\nCI servers (hudson, bamboo, teamcity, ...)\n\n
- Watch git repositories\n- Build snapshots for each commit\n- Watch for tags testing_1.2.3 and stable_1.2.3\n- Promote packages to a ftp server (which runs reprepro or any other debian repository tool)\n- Has a rest API\n- Has cocoa-like web interface wrote with cappuccino framework\n- Batteries are included except redis server\n\n\n
\n
- Lauchpad generate binaries out of your source as long as your application is already ready to be packaged\n- Build packages for multiple archs\n- Host the package in a repository called PPA\n- Developed and open source by canonical\n