Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Support Installation & Updates
  1. OpenProject
  2. Forums
  3. Support Installation & Updates
  4. [SOLVED] DB migration issue while updating OpenProject Docker image

[SOLVED] DB migration issue while updating OpenProject Docker image

Added by Jesse Rusk almost 4 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)

RE: DB migration issue while updating OpenProject Docker image - Added by Cyril Rohr almost 4 years ago

You should be able to run migrations as follows:

docker-compose run seeder

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

RE: DB migration issue while updating OpenProject Docker image - Added by Pierce Panton almost 4 years ago

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.

RE: DB migration issue while updating OpenProject Docker image - Added by Jesse Rusk almost 4 years ago

Cyril Rohr wrote:

You should be able to run migrations as follows:

docker-compose run seeder

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

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!

Creating compose_seeder_run ... done
Executing database migration and database seed...
/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 20210519141244. (StructuredWarnings::StandardWarning)
I, [2021-06-05T13:10:57.043278 #36]  INFO -- : Migrating to AddUniquenessConstrainOnLastnameForGroupsAndPlaceholderUsers (20210126112238)
== 20210126112238 AddUniquenessConstrainOnLastnameForGroupsAndPlaceholderUsers: migrating
-- execute("      CREATE UNIQUE INDEX unique_lastname_for_groups_and_placeholder_users ON\n        users (lastname, type)\n        WHERE (type = 'Group' OR type = 'PlaceholderUser');\n")
   -> 0.0230s
== 20210126112238 AddUniquenessConstrainOnLastnameForGroupsAndPlaceholderUsers: migrated (0.0248s)

I, [2021-06-05T13:10:57.113981 #36]  INFO -- : Migrating to ReplaceInvalidPrincipalReferences (20210214205545)
== 20210214205545 ReplaceInvalidPrincipalReferences: migrating ================
-- Replacing invalid custom value user references
-- Replacing invalid responsible user references in work packages
== 20210214205545 ReplaceInvalidPrincipalReferences: migrated (0.6193s) =======

I, [2021-06-05T13:10:57.742978 #36]  INFO -- : Migrating to MoveBaseDnIntoFilters (20210219092709)
== 20210219092709 MoveBaseDnIntoFilters: migrating ============================
-- add_column(:ldap_groups_synchronized_filters, :base_dn, :text, {:null=>true})
   -> 0.0031s
-- add_column(:ldap_groups_synchronized_filters, :sync_users, :boolean, {:null=>false, :default=>false})
   -> 0.0308s
-- add_column(:ldap_groups_synchronized_groups, :sync_users, :boolean, {:null=>false, :default=>false})
   -> 0.0127s
== 20210219092709 MoveBaseDnIntoFilters: migrated (0.3220s) ===================

I, [2021-06-05T13:10:58.130465 #36]  INFO -- : Migrating to AddGroupUserPrimaryKey (20210221230446)
== 20210221230446 AddGroupUserPrimaryKey: migrating ===========================
-- add_column(:group_users, :id, :primary_key)
   -> 0.0183s
-- add_index(:group_users, [:user_id, :group_id], {:unique=>true})
   -> 0.0019s
== 20210221230446 AddGroupUserPrimaryKey: migrated (0.0239s) ==================

I, [2021-06-05T13:10:58.161820 #36]  INFO -- : Migrating to GeneralizeExports (20210310101840)
== 20210310101840 GeneralizeExports: migrating ================================
-- rename_table(:work_package_exports, :exports)
   -> 0.0181s
-- change_table(:exports)
   -> 0.0090s
-- execute("UPDATE exports SET type = 'WorkPackages::Export'")
   -> 0.0011s
== 20210310101840 GeneralizeExports: migrated (0.0328s) =======================

I, [2021-06-05T13:10:58.201273 #36]  INFO -- : Migrating to MigrateSessionsUnlogged (20210331085058)
== 20210331085058 MigrateSessionsUnlogged: migrating ==========================
-- truncate(:sessions)
   -> 0.0090s
-- execute("ALTER TABLE \"sessions\" SET UNLOGGED\n")
   -> 0.0281s
-- remove_column(:sessions, :created_at, {:null=>false})
   -> 0.0011s
== 20210331085058 MigrateSessionsUnlogged: migrated (0.0432s) =================

I, [2021-06-05T13:10:58.256746 #36]  INFO -- : Migrating to GithubIntegrationModels (20210407110000)
== 20210407110000 GithubIntegrationModels: migrating ==========================
-- create_table(:github_pull_requests)
   -> 0.0224s
-- create_join_table(:github_pull_requests, :work_packages)
   -> 0.0051s
-- create_table(:github_users)
   -> 0.0119s
-- create_table(:github_check_runs)
   -> 0.0134s
== 20210407110000 GithubIntegrationModels: migrated (0.0594s) =================

I, [2021-06-05T13:10:58.324068 #36]  INFO -- : Migrating to MakeSystemUserAdmin (20210427065703)
== 20210427065703 MakeSystemUserAdmin: migrating ==============================
== 20210427065703 MakeSystemUserAdmin: migrated (0.0930s) =====================

I, [2021-06-05T13:10:58.429050 #36]  INFO -- : Migrating to RemoveProjectSetting (20210510193438)
== 20210510193438 RemoveProjectSetting: migrating =============================
== 20210510193438 RemoveProjectSetting: migrated (0.0283s) ====================

I, [2021-06-05T13:10:58.467816 #36]  INFO -- : Migrating to MakeProjectIdentifierUnique (20210512121322)
== 20210512121322 MakeProjectIdentifierUnique: migrating ======================
-- remove_index(:projects, :identifier)
   -> 0.0275s
-- add_index(:projects, :identifier, {:unique=>true})
   -> 0.0045s
== 20210512121322 MakeProjectIdentifierUnique: migrated (0.0354s) =============

I, [2021-06-05T13:10:58.516093 #36]  INFO -- : Migrating to RemoveReplyFromMessageJournalizing (20210519141244)
== 20210519141244 RemoveReplyFromMessageJournalizing: migrating ===============
-- remove_column(:message_journals, :last_reply_id, :integer)
   -> 0.0028s
-- remove_column(:message_journals, :replies_count, :integer, {:default=>0, :null=>false})
   -> 0.0008s
== 20210519141244 RemoveReplyFromMessageJournalizing: migrated (0.0069s) ======

W, [2021-06-05T13:10:58.894919 #36]  WARN -- : Creating scope :open. Overwriting existing method GithubPullRequest.open.
*** Seeding for locale: 'en'
*** Seeding basic data for standard edition
 ↳ BuiltinRolesSeeder
   *** Skipping built in role Non member - already exists
   *** Skipping built in role Anonymous - already exists
 ↳ RoleSeeder
   *** Skipping roles as there are already some configured
 ↳ ActivitySeeder
   *** Skipping activities as there are already some configured
 ↳ ColorSeeder
   *** Skipping colors as there are already some configured
 ↳ ColorSchemeSeeder
   *** Skipping flat colors as there are already some configured
 ↳ WorkflowSeeder
   *** Skipping types, statuses and workflows as there are already some configured
 ↳ PrioritySeeder
   *** Skipping priorities as there are already some configured
 ↳ SettingSeeder
   Loading discovered seeders:
 ↳ SettingSeeder
   *** Skipping BasicData::Backlogs::SettingSeeder
 ↳ EnumerationSeeder
*** Seeding admin user
   *** No need to seed an admin as there already is one.
*** Seeding demo data
 ↳ GroupSeeder
   *** Skipping DemoData::GroupSeeder
 ↳ AttributeHelpTextSeeder
    ↳ Creating attribute help texts
 ↳ GlobalQuerySeeder
    ↳ Creating global queries
 ↳ ProjectSeeder
   *** Skipping DemoData::ProjectSeeder
 ↳ OverviewSeeder
   *** Skipping DemoData::OverviewSeeder
*** Loading action_view_railtie seed data
*** Loading active_storage seed data
*** Loading action_cable_engine seed data
*** Loading action_mailbox seed data
*** Loading action_text seed data
*** Loading doorkeeper_engine seed data
*** Loading typed_dag_engine seed data
*** Loading date_validator_engine seed data
*** Loading ok_computer seed data
*** Loading i18n_js_engine seed data
*** Loading openproject_translations seed data
*** Loading openproject_auth_plugins seed data
*** Loading openproject_auth_saml seed data
*** Loading openproject_openid_connect seed data
*** Loading openproject_documents seed data
*** Loading openproject_xls_export seed data
*** Loading costs seed data
*** Loading openproject_reporting seed data
*** Loading openproject_meeting seed data
*** Loading openproject_pdf_export seed data
*** Loading openproject_backlogs seed data
*** Loading openproject_avatars seed data
*** Loading openproject_two_factor_authentication seed data
*** Loading openproject_webhooks seed data
*** Loading openproject_github_integration seed data
*** Loading openproject_ldap_groups seed data
*** Loading openproject_recaptcha seed data
*** Loading openproject_job_status seed data
*** Loading grids_engine seed data
*** Loading my_page_engine seed data
*** Loading dashboards seed data
*** Loading openproject_boards seed data
*** Loading overviews seed data
*** Loading budgets_engine seed data
*** Loading openproject_bim seed data

RE: RE: DB migration issue while updating OpenProject Docker image - Added by Brenden Reeves 11 months ago

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

  • (1 - 4/4)
Loading...