Content
[SOLVED] DB migration issue while updating OpenProject Docker image
Added by Jesse Rusk over 3 years ago
Hi,
I installed OpenProject a few weeks ago using the "One container per process" Docker instructions here. Everything's been going well until I tried updating the docker images. I used Watchtower to automatically stop the container and pull the latest images. When the containers restarted OpenProject was unable to open, with the following being displayed in the logs:
OpenProject_worker | Checking migration status...
OpenProject_worker | /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.2/lib/active_record/railtie.rb:152:in `block (3 levels) in <class:Railtie>': Ignoring /app/db/schema_cache.yml because it has expired. The current schema version is 20210127134438, but the one in the cache is 20210219092709. (StructuredWarnings::StandardWarning)
OpenProject_web | /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.2/lib/active_record/railtie.rb:152:in `block (3 levels) in <class:Railtie>': Ignoring /app/db/schema_cache.yml because it has expired. The current schema version is 20210127134438, but the one in the cache is 20210219092709. (StructuredWarnings::StandardWarning)
OpenProject_web | /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.3.2/lib/active_record/migration.rb:625:in `check_pending!': (ActiveRecord::PendingMigrationError)
OpenProject_web |
OpenProject_web | Migrations are pending. To resolve this issue, run:
OpenProject_web |
OpenProject_web | bin/rails db:migrate RAILS_ENV=production
OpenProject_web |
OpenProject_web | You have 3 pending migrations:
OpenProject_web |
OpenProject_web | 20210126112238_add_uniqueness_constrain_on_lastname_for_groups_and_placeholder_users.rb
OpenProject_web | 20210214205545_replace_invalid_principal_references.rb
OpenProject_web | 20210219092709_move_base_dn_into_filters.rb
I'm assuming I need to run bundle exec rake db:migrate
to complete the database update, but how do I do that with a Docker installation? I used docker exec -it OpenProject_db /bin/bash
to open a shell in the database container, but when I run bundle exec rake db:migrate
in the shell I get a "command not found" error. Any suggestions on how to fix the issue? Appreciate any help!
Replies (4)
You should be able to run migrations as follows:
That being said, they should have been automatically performed, so can you please run that command and report the output that you are getting?
Thank you.
Cyril
Enterprise Edition, Cloud If you need to migrate from any older version of OpenProject, upgrading If you also need to migrate from MySQL to PostgreSQL during that process, It's included in the docker image itself but you will want to run it directly on the docker host.
Cyril Rohr wrote:
Sorry for the delayed follow-up, I restored a backup image 2 weeks ago and haven't had a chance to try out your suggestion. Just upgraded again, ran into the same migration issue, and running the seeder fixed it. Output when the seeder was run is below. Thanks again for the help!
This fixed a migration error from the web conatiner in the docker-compose method. The web container was just "boot looping" talking about needing to migrate to production (after it was just sitting there for a few days... no major upgrades had occurred).
Running the seeder comand above fixed this