1
0
Fork 0

Add example systemd services

This commit is contained in:
Alex Kotov 2018-12-07 18:53:10 +05:00
parent 547a42d9ee
commit 3435539d23
No known key found for this signature in database
GPG Key ID: 4E831250F47DE154
1 changed files with 35 additions and 4 deletions

View File

@ -46,18 +46,49 @@ Tested with **Ubuntu Server 18.04 LTS**.
* Create PostgreSQL role `partynest` with password `password`
* Create PostgreSQL database `partynest_production` owned by `partynest`
### Example systemd service
### Example systemd services
Replace `user` with the name of user which you want an application to run as.
Replace `user` with the name of user and `group` with the name of group
which you want an application to run as.
#### Web server
```
[Unit]
After=network.target
After=syslog.target network.target
Description=Partynest web server
[Service]
ExecStart=/usr/bin/bundle exec rails server --environment production
Restart=always
Group=group
Restart=on-failure
RestartSec=1
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=partynest-web
Type=simple
User=user
WorkingDirectory=/var/www/partynest/current
[Install]
WantedBy=multi-user.target
```
#### Job processing
```
[Unit]
After=syslog.target network.target
Description=Partynest job processing
[Service]
ExecStart=/usr/bin/bundle exec sidekiq --environment production
Group=group
Restart=on-failure
RestartSec=1
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=partynest-worker
Type=simple
User=user
WorkingDirectory=/var/www/partynest/current