Skip to content

Commit

Permalink
Fix migrations in ansible installation playbook (#2006)
Browse files Browse the repository at this point in the history
For some reason, running the schema migrations and data migrations
together causing them to fail and requires an addtional step to ssh into
every instance and run the data migrations after the schema migrations
have run successfully. The data migrations many times rely on the schema
being migrated, but it was my understanding that the
db:migrate:with_data accounted for this. In practice, however, it
reliably fails every time.
  • Loading branch information
mattwr18 authored Sep 2, 2024
1 parent 1aa5989 commit 00b33b4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ansible/roles/installation/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@
community.docker.docker_prune:
images: yes

- name: Create and migrate database
- name: Run schema migrations
command:
cmd: docker compose -f docker-compose.yml -f docker-compose.prod.yml exec app bin/rails db:migrate:with_data
cmd: docker compose -f docker-compose.yml -f docker-compose.prod.yml exec app bin/rails db:migrate
chdir: /home/ansible

- name: Run data migrations
command:
cmd: docker compose -f docker-compose.yml -f docker-compose.prod.yml exec app bin/rails data:migrate
chdir: /home/ansible

0 comments on commit 00b33b4

Please sign in to comment.