2016-12-29 11:25:39 +01:00
|
|
|
**Cette page a été importée automatiquement de notre ancien wiki mais n'a pas encore été révisée.**
|
|
|
|
|
|
|
|
# Puma
|
|
|
|
|
|
|
|
### 0. Prérequis
|
|
|
|
|
|
|
|
Installation de Puma :
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
~~~
|
|
|
|
gem install puma
|
|
|
|
~~~
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
Création du dossier de configuration :
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
~~~
|
|
|
|
mkdir /etc/puma
|
|
|
|
~~~
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
Création d'un service SystemD :
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
~~~
|
|
|
|
cat > /etc/systemd/system/puma@.service <<EOF
|
|
|
|
[Unit]
|
|
|
|
Description=Puma HTTP server for Ruby Apps : %i
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
PermissionsStartOnly=true
|
|
|
|
ExecStartPre=/bin/mkdir -p %t/%i
|
|
|
|
ExecStartPre=/bin/chown %i: %t/%i
|
|
|
|
|
|
|
|
User=%i
|
|
|
|
Group=%i
|
|
|
|
UMask=0027
|
|
|
|
|
|
|
|
#WorkingDirectory=/home/%i/www
|
|
|
|
PrivateTmp=true
|
|
|
|
PIDFile=/run/%i/ruby.pid
|
|
|
|
|
|
|
|
ExecStart=/usr/local/bin/puma --bind unix:///run/%i/ruby.sock?umask=0007 --pidfile /run/%i/ruby.pid --dir /home/%i/www --config /etc/puma/%i.rb
|
|
|
|
ExecReload=/bin/kill -USR2 $MAINPID
|
|
|
|
KillMode=process
|
|
|
|
Restart=on-failure
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
Alias=puma_%i.service
|
|
|
|
EOF
|
|
|
|
~~~
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
Correction des droits du service SystemD
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
~~~
|
|
|
|
chmod 644 /etc/systemd/system/puma@.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
~~~
|
|
|
|
|
|
|
|
### 1. Configuration
|
|
|
|
|
|
|
|
Création du fichier de configuration de Puma pour l'utilisateur $REDMINE :
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
~~~
|
|
|
|
cat > /etc/puma/$REDMINE.rb <<EOF
|
|
|
|
environment 'production'
|
|
|
|
workers 2
|
|
|
|
threads 0, 8
|
|
|
|
tag 'Redmine $REDMINE'
|
|
|
|
EOF
|
|
|
|
~~~
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
Correction des droits du fichier de configuration
|
2017-01-14 00:06:38 +01:00
|
|
|
|
2016-12-29 11:25:39 +01:00
|
|
|
~~~
|
|
|
|
chmod 740 /etc/puma/$REDMINE.rb
|
|
|
|
chown $REDMINE:www-data /etc/puma/$REDMINE.rb
|
|
|
|
~~~
|