Ceci est une ancienne révision du document !
https://github.com/ari/jobsworth/tree/v3.1
Je vais essayer d’écrire un tuto pour installer cette application web écrit en ruby dont je ne connais absolument rien.
La doc officiel commence a dater et les commandes sont souvent dépréciées voir obsolètes et je n’ai pas l’impression que ça soit adapté à Debian.
Installation de rvm (c’est assez long…)
curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --ruby --rails --trace source /usr/local/rvm/scripts/rvm rvm all do gem install bundler rvm reload
Installation de Passenger
rvm all do gem install passenger rvm all do passenger-install-apache2-module
Noté bien les messages suivant afin de configurer Apache.
The Apache 2 module was successfully installed. Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/libout/apache2/mod_passenger.so PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5 PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p429/ruby After you restart Apache, you are ready to deploy any number of Ruby on Rails applications on Apache, without any further Ruby on Rails-specific configuration!
Ici nous allons modifier le fichier adéquate
vi /etc/apache2/httpd.conf
et ajouter
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/libout/apache2/mod_passenger.so PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5 PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p429/ruby
Si nécessaire, désactivez le mod passenger par défaut de apache2
a2dismod passenger
Deploying a Ruby on Rails application: an example Suppose you have a Rails application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: <VirtualHost *:80> ServerName www.yourhost.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /somewhere/public <Directory /somewhere/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews </Directory> </VirtualHost> And that's it! You may also want to check the Users Guide for security and optimization tips, troubleshooting and other useful information: /usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/doc/Users guide Apache.html
On télécharge via git
cd /var/www git clone git://github.com/ari/jobsworth.git cd jobsworth git checkout v3.1
On configure l’accès à la base de données dans le fichier
cp config/database.example.yml config/database.yml vi config/database.yml
On se place dans le répertoire racine de ce que l’on vient de télécharger puis on tape la commande suivante :
rvm all do bundle install --without=test development sqlite postgres
Ensuite on crée sa base de données mysql
CREATE DATABASE jobsworth DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL ON jobsworth.* TO 'user'@'hostname' IDENTIFIED BY 'password'
On s’assure d’être à la racine du projet et on tape
bundle exec lib/setup.rb
On répond aux questions et la 1ere fois on répond y pour Initialize database schema [n]:
On lance ensuite la mise a jour.
./update.sh
J’ai du installer paperclip
gem install paperclip
Et au cas ou
chown -R www-data.www-data /var/www/jobsworth service apache2 restart