From 6f503dedfe87d1afc8155884937c655862dea7cf Mon Sep 17 00:00:00 2001 From: staticsafe Date: Mon, 27 Nov 2017 11:54:40 -0500 Subject: [PATCH] Run assets precompile before database setup This is so that if the precompile is killed due to OOM, you can just restart the playbook without needing to change the database name in .env.production as it isn't created yet. --- roles/mastodon-config/tasks/main.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/mastodon-config/tasks/main.yml b/roles/mastodon-config/tasks/main.yml index a4e6cbe..aec0a5c 100644 --- a/roles/mastodon-config/tasks/main.yml +++ b/roles/mastodon-config/tasks/main.yml @@ -52,6 +52,14 @@ dest: /home/mastodon/live/.env.production become: true become_user: mastodon +- name: Precompile Mastodon static assets + shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rails assets:precompile + environment: + RAILS_ENV: production + args: + executable: /bin/bash + become: true + become_user: mastodon - name: Run Mastodon database setup shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rails db:setup environment: @@ -61,14 +69,6 @@ executable: /bin/bash become: true become_user: mastodon -- name: Precompile Mastodon static assets - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rails assets:precompile - 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"