Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Criando pacotes Debian do Ruby

Criando pacotes Debian do Ruby

Como criar pacotes .deb do Ruby para Debian, usando FPM e Chef.

Andriel Nuernberg

January 28, 2014
Tweet

More Decks by Andriel Nuernberg

Other Decks in Technology

Transcript

  1. $ apt-get install ruby ... $ ruby -v ruby 1.9.3p194

    (2012-04-20 revision 35410) [x86_64-linux]
  2. $ apt-get install build-essentials $ time rbenv install 2.1.0 ...

    real 7m28.059s user 6m39.681s sys0m31.018s D igitalO cean
  3. basename=$(basename $1) # Package configs architecture="x64" name="ruby" version="2.1.0" decription="Ruby $version

    stable package" # Package dependencies dependencies=( "libstdc++6 (>= 4.4.3)" "libc6 (>= 2.6)" "libffi5 (>= 3.0.4)" "libgdbm3 (>= 1.8.3)" "libncurses5 (>= 5.7)" "libreadline6 (>= 6.1)" "libssl1.0.0 (>= 1.0.0)" "zlib1g (>= 1:1.2.2)" "libyaml-0-2 (>= 0.1.3)" )
  4. output=$(mktemp -d -t $basename.XXXX) trap "rm -rf $output" ERR EXIT

    if [ -z "$1" ] ; then echo "./rubydeb.sh <RUBY_SOURCE_PATH>" fi cd $1 ./configure --prefix=/usr && make && make install DESTDIR=$output fpm \ -s dir \ -t deb \ -n "$name" \ -v "$version" \ --description "$description" \ -C "$output" \ -p "ruby-$version-$architecture.deb" \ $(printf " -d '%s'" "${dependencies[@]}") \ usr/bin usr/lib usr/share/man usr/include
  5. $ ./rubydeb.sh ruby-2.1.0/ checking build system type... x86_64-unknown-linux-gnu checking host

    system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking whether the C compiler works... yes ...
  6. C hef // nodes/my-production-node.json { "environment": "production", "ruby": { "version":

    "2.0.0-p353", "arch": "x64" }, "run_list": [ "recipe[ruby]" ] }
  7. C hef Recipe: ruby::default * package[libyaml-0-2] action install (up to

    date) * remote_file[/tmp/ruby-2.0.0-p353-x64.deb] action create - create new file /tmp/ruby-2.0.0-p353-x64.deb - update content in file /tmp/ruby-2.0.0-p353-x64.deb from none to 7bbeb8 (file sizes exceed 10000000 bytes, diff output suppressed) - change mode from '' to '0644' * dpkg_package[ruby] action install - install version 2.0.0-p353 of package ruby Chef Client finished, 2 resources updated
  8. C hef // nodes/my-production-node.json { "environment": "production", "ruby": { "version":

    "2.1.0", "arch": "x64" }, "run_list": [ "recipe[ruby]" ] }
  9. C hef Recipe: ruby::default * package[libyaml-0-2] action install (up to

    date) * remote_file[/tmp/ruby-2.1.0-x64.deb] action create (up to date) * dpkg_package[ruby] action install - install version 2.1.0 of package ruby Chef Client finished, 1 resources updated
  10. • Não precisa compilar nos ambientes de prod, stage, qa,

    etc; • Atualização de versão é rápida; • Você controla como o Ruby deve ser compilado; Amazon S3