Add mastodon-systemd role.

This commit is contained in:
staticsafe 2017-11-26 19:03:12 -05:00
parent e3090a4395
commit 68d0032b44
5 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,16 @@
[Unit]
Description=mastodon-sidekiq
After=network.target
[Service]
Type=simple
User=mastodon
WorkingDirectory=/home/mastodon/live
Environment="RAILS_ENV=production"
Environment="DB_POOL=5"
ExecStart=/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,16 @@
[Unit]
Description=mastodon-streaming
After=network.target
[Service]
Type=simple
User=mastodon
WorkingDirectory=/home/mastodon/live
Environment="NODE_ENV=production"
Environment="PORT=4000"
ExecStart=/usr/bin/npm run start
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,17 @@
[Unit]
Description=mastodon-web
After=network.target
[Service]
Type=simple
User=mastodon
WorkingDirectory=/home/mastodon/live
Environment="RAILS_ENV=production"
Environment="PORT=3000"
ExecStart=/home/mastodon/.rbenv/shims/bundle exec puma -C config/puma.rb
ExecReload=/bin/kill -SIGUSR1 $MAINPID
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,15 @@
---
# This role copies over various Mastodon service files and enables them
- name: Copy Mastodon systemd service files
copy: src={{ item }} dest=/etc/systemd/system/{{ item }} backup=yes
with_items:
- mastodon-sidekiq.service
- mastodon-streaming.service
- mastodon-web.service
- name: Enable Mastodon systemd services
systemd: name={{ item }} enabled=yes
with_items:
- mastodon-sidekiq
- mastodon-streaming
- mastodon-web

View File

@ -8,3 +8,5 @@
- mastodon-postgresql - mastodon-postgresql
- mastodon-redis - mastodon-redis
- mastodon-nginx - mastodon-nginx
- mastodon-systemd