66 lines
1.3 KiB
Markdown
66 lines
1.3 KiB
Markdown
|
**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 :
|
||
|
~~~
|
||
|
gem install puma
|
||
|
~~~
|
||
|
Création du dossier de configuration :
|
||
|
~~~
|
||
|
mkdir /etc/puma
|
||
|
~~~
|
||
|
Création d'un service SystemD :
|
||
|
~~~
|
||
|
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
|
||
|
~~~
|
||
|
Correction des droits du service SystemD
|
||
|
~~~
|
||
|
chmod 644 /etc/systemd/system/puma@.service
|
||
|
systemctl daemon-reload
|
||
|
~~~
|
||
|
|
||
|
### 1. Configuration
|
||
|
|
||
|
Création du fichier de configuration de Puma pour l'utilisateur $REDMINE :
|
||
|
~~~
|
||
|
cat > /etc/puma/$REDMINE.rb <<EOF
|
||
|
environment 'production'
|
||
|
workers 2
|
||
|
threads 0, 8
|
||
|
tag 'Redmine $REDMINE'
|
||
|
EOF
|
||
|
~~~
|
||
|
Correction des droits du fichier de configuration
|
||
|
~~~
|
||
|
chmod 740 /etc/puma/$REDMINE.rb
|
||
|
chown $REDMINE:www-data /etc/puma/$REDMINE.rb
|
||
|
~~~
|