Your SlideShare is downloading. ×
0
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Ruby and Rails Packaging to Production

6,967

Published on

Talk that I and Rodrigo vaz gave at RailsConf 2011: http://en.oreilly.com/rails2011/public/schedule/detail/19770

Talk that I and Rodrigo vaz gave at RailsConf 2011: http://en.oreilly.com/rails2011/public/schedule/detail/19770

Published in: Technology
0 Comments
11 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,967
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
11
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \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’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’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
  • \n
  • deb, rpm offer easy ways to create them\n
  • as we are all doing\n
  • \n
  • \n
  • assets server\n
  • dh_make\ndebian/{control,rules,changelog}\ndpkg-buildpackage -> rules, sign\ndebian maintainers policy, ubuntu packaging guide\n
  • \n
  • \n
  • \n
  • \n
  • \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 “build” 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
  • \n
  • \n
  • Transcript

    • 1. packaging ruby and rails apps to production Fabio
Kung Rodrigo
Vaz
    • 2. @fabiokung@rodrigovaz
    • 3. no offense, but...
    • 4. cap deploy
    • 5. w"?
    • 6.    
    • 7. OMG... gem vs system pkgs again? disclaimer
    • 8. it probably doesn’t apply to PaaS disclaimer
    • 9. sysadmin love h+p://www.flickr.com/photos/theamarand/2879573829/
    • 10. http://www.flickr.com/photos/sequelguy/4390001903/
    • 11. sysadmins
and
sysops
know
OS/distro
tools http://www.flickr.com/photos/sequelguy/4390001903/
    • 12. dpkg -l$ dpkg -lii adduser 3.112ubuntu1ii apt 0.7.25.3ubuntu9.3ii apt-utils 0.7.25.3ubuntu9.3ii aptitude 0.4.11.11-1ubuntu10ii autoconf 2.65-3ubuntu1ii automake 1:1.11.1-1ii autotools-dev 20090611.1ii base-files 5.0.0ubuntu20.10.04.2ii base-passwd 3.5.22ii bash 4.1-2ubuntu3ii bash-completion 1:1.1-3ubuntu2ii binutils 2.20.1-3ubuntu7ii build-essential 11.4build1ii bzip2 1.0.5-4ubuntu0.1ii cdbs 0.4.62+nmu1ubuntu9ii cmake 2.8.1-4~lucid1ii cmake-data 2.8.1-4~lucid1ii coreutils 7.4-2ubuntu2ii cpp 4:4.4.3-1ubuntu1ii cpp-4.4 4.4.3-4ubuntu5ii cpu-checker 0.1-0ubuntu2ii cron 3.0pl1-106ubuntu5ii dash 0.5.5.1-3ubuntu2ii debconf 1.5.28ubuntu4ii debconf-i18n 1.5.28ubuntu4ii debhelper 7.4.15ubuntu1ii debianutils 3.2.2ii debootstrap 1.0.28ubuntu1~lucid1ii devscripts 2.10.61ubuntu5...
    • 13. dpkg -L myappdpkg --contents myapp.deb $ dpkg -L vim /. /usr /usr/bin /usr/bin/vim.basic /usr/share /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/vim /usr/share/bug /usr/share/bug/vim /usr/share/bug/vim/presubj /usr/share/doc /usr/share/doc/vim
    • 14. dpkg -S /etc/myapp.conf $ dpkg -S /usr/bin/vim.basic vim: /usr/bin/vim.basic
    • 15. apticron, cron-aptapticron report [Mon, 18 Apr 2011 18:25:02 -0300]=====================================================apticron has detected that some packages need upgrading on: foo.locaweb.com.br [ 10.0.0.1 ]The following packages are currently pending an upgrade: myapp 5.1.0-3 myapp-assets 5.1.0-3======================================================Package Details:Reading changelogs...--- Changes for myapp (myapp myapp-assets) ---myapp (5.1.0-3) stable; urgency=low * new awesome feature * lots of bug fixes-- Fabio Kung <fabio.kung@locaweb.com.br>  Tue, 12 Apr 2011 22:31:11 -0300
    • 16. http://www.flickr.com/photos/atibens/4578265134/post install
    • 17. health, sanity check
    • 18. db/seeds.rb
    • 19. rake db:migraterake assets:exportrake i18n:js:export ...
    • 20. package repositories distribute it
    • 21. signed packages
    • 22. dev toolchain in production servers?
    • 23. build pipeline
    • 24. tes;ng
x
stable
    • 25. multiple archs
    • 26. dpkg -i myapp-oldversion
    • 27. btw... rake db:migrate VERSION=old
    • 28. dependencies
    • 29. (re)deploying services must be ultra easy
    • 30. package everything OH
WAIT...
    • 31. configuration managers
    • 32. recipes cf-agent promissescfengine, chef, rules cf-agent puppet cf-agent
    • 33. package "sudo" do  action :upgradeenduser "sshservice" do  system true  action :createendtemplate "/etc/sudoers" do  source "sudoers.erb"  mode 0440  owner "root"  group "root"  variables(:user => "sshservice")  action :createend
    • 34. bundle common control{    bundlesequence => { "ssh" };    inputs => { "cfengine_stdlib.cf" }}bundle agent ssh{    packages:        "sudo"            package_policy => "add"            package_method => "deb"    files:        "/etc/sudoers"            edit_defaults => empty,            edit_line => expand_template("sudoers.in"),            perms => mog("0440", root, root),            create => "true";    methods:        "sshservice" usebundle => create_user("sshservice")}
    • 35. rule of thumb
    • 36. keysssh, access, crypt, passwords, ...
    • 37. init scripts/etc/init.d/myapp start|stop|restart
    • 38. configuration files <any>.yml.example
    • 39. database.yml.example CFEngine3 production: adapter: mysql2 encoding: utf8 database: ${db_name} username: ${db_user} password: ${db_password} host: ${db_address}edit_line => expand_template("database.yml.example")
    • 40. database.yml.example Chef,
Puppet production: adapter: mysql2 encoding: utf8 database: <%= db_name %> username: <%= db_user %> password: <%= db_password %> host: <%= db_address %>
    • 41. packages are addictive
    • 42. creating packages http://www.flickr.com/photos/miadcommunicationdesign/3169997945/
    • 43. debian/controlSource: myappSection: webPriority: extraMaintainer: Fabio Kung <fabio.kung@locaweb.com.br>Build-Depends: debhelper (>= 7)Standards-Version: 3.8.3Homepage: https://github.com/locaweb/myappPackage: myappArchitecture: anyDepends: rubygems (>= 1.3.6), libapache2-mod-passenger (>= 2.2)Description: my great new app Visit https://mycompany.com/myapp for more information
    • 44. debian/changelogmyapp (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 -0300myapp (0.0.1) unstable; urgency=low * Initial release-- Rodrigo Vaz <rodvaz@locaweb.com.br> Wed, 17 May 2011 18:05:20 -0300
    • 45. debian/rules               
    • 46. dh_make --createorig
    • 47. • dpkg-buildpackage• pbuilder• cowbuilder
    • 48. why is it unusual?
    • 49. debian-ruby- maintainersGiving up on Ruby packaging - Lucas Nussbaumhttp://www.lucas-nussbaum.net/blog/?p=617
    • 50. FPM awesome https://github.com/jordansissel/fpmI
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
groups
own
style
culture
and
have
a
very
strong
interest
in
ge6ng
work
done. ‐‐
Jordan
Sissel
    • 51. http://www.flickr.com/photos/brightbox/2298191057/
    • 52. http://morethanseven.net/2011/01/16/Why-developers-should- care-about-system-packages.html Why Developers Should Care About System Packages -- Gareth Rushgrove
    • 53. what about other platforms?
    • 54. blaming gamewhat are we doing to end it?
    • 55. github.com/locaweb/debundler
    • 56. a long way to go...
    • 57. RPM
    • 58. bundle debianize (?) bundler deeper integration, plugin
    • 59.            just some ideas... rvm is great :-)
    • 60. vendor everything vs package everything gem dependencies
    • 61. packaging gems• fpm• gem2deb• gem2rpm• checkinstall• debian/ changelog from git log
    • 62. build servers
    • 63. bricklayergithub.com/locaweb/bricklayer
    • 64. REST APIPOST /project: name="myapp" version="1.0.1" git_url="git://host/project/repository.git" branch="master" build_cmd="rake prepare" install_cmd="rake install PREFIX=debian/tmp" respository_url="ftp.location.com" repository_user="a_user" repository_passwd="a_g00dP455w0rd"
    • 65. launchpad dev.launchpad.net
    • 66. pain points• old rubygems official system packages• bundler (!)• package yourself• PPA?
    • 67. Thanks! fabio.kung at gmail, @fabiokung rodrigo.vaz at gmail, @rodrigovaz additional info: https://wiki.ubuntu.com/PackagingGuidehttp://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

    ×