2017-11-27 01:58:45 +00:00
|
|
|
---
|
|
|
|
# This role copies over the user-edited .env.production, runs the database
|
|
|
|
# setup, pre-compiles assets, starts Mastodon daemons, adds media cleanup
|
|
|
|
# cron job
|
|
|
|
|
|
|
|
- name: Copy Mastodon .env.production
|
|
|
|
template:
|
|
|
|
src: .env.production
|
|
|
|
dest: /home/mastodon/live/.env.production
|
|
|
|
become: true
|
|
|
|
become_user: mastodon
|
|
|
|
- name: Run Mastodon database setup
|
2017-11-27 02:11:11 +00:00
|
|
|
shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rails db:setup
|
2017-11-27 01:58:45 +00:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
2017-11-27 02:11:11 +00:00
|
|
|
SAFETY_ASSURED: 1
|
2017-11-27 01:58:45 +00:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
become: true
|
|
|
|
become_user: mastodon
|
|
|
|
- name: Precompile Mastodon static assets
|
2017-11-27 02:23:43 +00:00
|
|
|
shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rails assets:precompile
|
2017-11-27 01:58:45 +00:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
become: true
|
|
|
|
become_user: mastodon
|
|
|
|
- name: Add Mastodon media cache cleanup cronjob
|
|
|
|
cron:
|
|
|
|
name: "Mastodon media cache cleanup"
|
|
|
|
special_time: daily
|
|
|
|
job: "cd /home/mastodon/live && RAILS_ENV=production /home/mastodon/.rbenv/shims/bundle exec rake mastodon:media:remove_remote"
|
|
|
|
backup: yes
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
become_user: mastodon
|
|
|
|
- name: Start Mastodon services
|
|
|
|
systemd: name={{ item }} state=started
|
|
|
|
with_items:
|
|
|
|
- mastodon-sidekiq
|
|
|
|
- mastodon-streaming
|
|
|
|
- mastodon-web
|