Skip to content

Commit

Permalink
Merge pull request #892 from Matt-Yorkley/deployment-order
Browse files Browse the repository at this point in the history
Move precompile task before migration task
  • Loading branch information
mkllnk authored Aug 21, 2023
2 parents 59144fb + b053c8c commit 47e8430
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions roles/deploy/tasks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
changed_when: False
tags: rake

- name: load schema if it isn't loaded
command: bash -lc "bundle exec rake db:schema:load RAILS_ENV={{ rails_env }} I_AM_SURE=1"
- name: prepare database for the first time
command: bash -lc "bundle exec rails db:setup RAILS_ENV={{ rails_env }} I_AM_SURE=1"
args:
chdir: "{{ build_path }}"
when: table_exists.stdout.find('0 rows') != -1
Expand All @@ -131,31 +131,22 @@
- rake
- skip_ansible_lint

- name: migrate database
command: bash -lc "bundle exec rake db:migrate RAILS_ENV={{ rails_env }}"
- name: precompile assets # noqa 301
command: bash -lc "bundle exec rake assets:precompile RAILS_ENV={{ rails_env }}"
args:
chdir: "{{ build_path }}"
tags:
- rake
- skip_ansible_lint
notify: restart puma
become: yes
become_user: "{{ app_user }}"

- name: seed database
command: bash -lc "bundle exec rake db:seed RAILS_ENV={{ rails_env }}"
- name: migrate database
command: bash -lc "bundle exec rake db:migrate RAILS_ENV={{ rails_env }}"
args:
chdir: "{{ build_path }}"
tags:
- seed
- rake
- skip_ansible_lint
notify: restart puma

- name: precompile assets # noqa 301
command: bash -lc "bundle exec rake assets:precompile RAILS_ENV={{ rails_env }}"
args:
chdir: "{{ build_path }}"
become: yes
become_user: "{{ app_user }}"

# Note: this task can be removed after all servers have been provisioned and deployed
- name: delete current path unless it's a symlink
file:
Expand Down

0 comments on commit 47e8430

Please sign in to comment.