,

Notes ruby capistrano

capshell peut être remplacé par clush (paquet clustershell), pour avoir un shell sur plusieurs serveurs

  1. Création du paquage Capistrano (utilisable en userland) #

Voir https://rvm.io/integration/capistrano/#gem

[INSTALL DE RVM Ruby Version Manager] → Voir https://rvm.io/

-Prerequis yum install libxslt-devel curl git patch gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel yum install ruby-libs # (a verifier !)

-Install curl -L https://get.rvm.io | bash -s stable --ruby

[INSTALL DE CAPISTRANO] ~/.rvm/rubies/*/bin/gem install --user rvm-capistrano

[CREATION DU SCRIPT DE LANCEMENT] vi ~/bin/cap —

  1. ! /bin/bash

CAP=$(echo /home/eib/.gem/ruby/*/bin/cap |tail -1) RUBY=$(echo /home/eib/.rvm/rubies/ruby-*/bin/ruby|tail -1)

$RUBY $CAP $* — chmod +x ~/bin/cap

[TEST DE CAPISTRANO] ~/bin/cap shell

[CONSCRUCTION DU PAQUET] find /home/eib/.gem /home/eib/.rvm/rubies/ruby-* /home/eib/.rvm/gems/ruby-* /home/eib/.rvm/environments /home/eib/.rvm/bin /home/eib/bin/cap -depth |cpio -ov --format=ustar|gzip >captistrano.tar.gz

NB : les repertoires nécessaires au paquet peuvent être trouvé à l'aide de “strace”.

>Voir NOTES.

[DEINSTALL] rm -rf ~/.rvm ~/.gem ~/bin/cap

[NOTES] http://henriksjokvist.net/archive/2012/2/deploying-with-rbenv-and-capistrano/

Commande utile :

Pour relancer la compilation de ruby : rvm reinstall all --force

Pour trouver les repertoires nécessaires à la creation du paquet /bin/ls -ld $(strace -f -e trace=file cap 2>&1|grep -v 'No such file or directory' |grep open|cut -d'“' -f2|grep '/home/eib/.rvm/')|grep ^d|awk '{print $9}'

~/.rvm/bin/gem-ruby-2.0.0-p0 update