Top Menu

Jump to content
  • OpenProject
    • View all projects
Home
    • Projects
    • Work packages
    • News
    • Getting started
    • Introduction video

      Welcome to OpenProject Community

      Get an overview

      Get a quick overview of project management and team collaboration with OpenProject.
      You can restart this video from the help menu

    • Help and support
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Professional support

    • Additional resources
    • Data privacy and security policy
    • 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?
      Create a new account

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
  • Roadmap
  • Work packages
  • Calendars
  • Team planners
  • Boards
  • Forums
  • Wiki
    • Table of contents
      • Expanded. Click to collapseCollapsed. Click to showDeveloper
        • Hierarchy leafAccessibility Checklist
        • Hierarchy leafCode Review Guidelines
        • Expanded. Click to collapseCollapsed. Click to showContribution
          • Hierarchy leafGit Workflow
          • Hierarchy leafTranslations
        • Expanded. Click to collapseCollapsed. Click to showDeveloping Plugins
          • Hierarchy leafDeveloping an OmniAuth Authentication Plugin
        • Hierarchy leafRelease Process
        • Hierarchy leafReport a bug
        • Hierarchy leafSecurity
        • Hierarchy leafSetting up an OpenLDAP server for testing
        • Hierarchy leafTheme Features
      • Hierarchy leafDownload
      • Expanded. Click to collapseCollapsed. Click to showFeature tour
        • Hierarchy leafRelease Notes OpenProject 30
        • Expanded. Click to collapseCollapsed. Click to showRelease Notes OpenProject 30 - Overview
          • Hierarchy leafGlossary
          • Hierarchy leafRelease Notes - Accessibility
          • Hierarchy leafRelease Notes - Accessibility changes
          • Hierarchy leafRelease Notes - Add work package queries as menu items to sidebar
          • Hierarchy leafRelease Notes - Copy projects based on Templates
          • Hierarchy leafRelease Notes - Design changes
          • Hierarchy leafRelease Notes - Fixed Bugs
          • Hierarchy leafRelease Notes - Keyboard Shortcuts
          • Hierarchy leafRelease Notes - Project settings
          • Hierarchy leafRelease Notes - Ruby&Rails Update
          • Hierarchy leafRelease Notes - Security
          • Hierarchy leafRelease Notes - Timelines
          • Hierarchy leafRelease Notes - Work packages
      • Hierarchy leafHowto create animated gifs
      • Hierarchy leafMigration Squashing
      • Hierarchy leafMod security
      • Hierarchy leafNew work package page
      • Hierarchy leafOP3 to OP4 Debian upgrade
      • Hierarchy leafOP4 Ubuntu1404 Stable with MySQL in production
      • Hierarchy leafOpenProject 40 Development Setup
      • Expanded. Click to collapseCollapsed. Click to showOpenProject Foundation
        • Hierarchy leafBoards
        • Hierarchy leafMembers
        • Hierarchy leafOPF-Meetings
        • Hierarchy leafStatutes
      • Expanded. Click to collapseCollapsed. Click to showRelease Notes
        • Hierarchy leafOpenProject released on Bitnami
      • Expanded. Click to collapseCollapsed. Click to showRelease Notes OpenProject 40 - Overview
        • Hierarchy leafRelease Notes OpenProject 40 - Accessibility improvements
        • Hierarchy leafRelease Notes OpenProject 40 - Column header functions in work package table
        • Hierarchy leafRelease Notes OpenProject 40 - Improved Design
        • Hierarchy leafRelease Notes OpenProject 40 - Integrated query title on work package page
        • Hierarchy leafRelease Notes OpenProject 40 - Integrated toolbar on work package page
        • Hierarchy leafRelease Notes OpenProject 40 - OmniAuth integration for OpenProject
        • Hierarchy leafRelease Notes OpenProject 40 - Work package details pane
      • Expanded. Click to collapseCollapsed. Click to showSecurity and privacy
        • Hierarchy leafFAQ
      • Expanded. Click to collapseCollapsed. Click to showSupport
        • Expanded. Click to collapseCollapsed. Click to showDownload and Installation
          • Hierarchy leafInstallation MacOS
          • Expanded. Click to collapseCollapsed. Click to showInstallation OpenProject 3 0
            • Hierarchy leafDebian Stable with MySQL in production
            • Hierarchy leafInstallation Ubuntu
            • Hierarchy leafInstallation Windows
            • Hierarchy leafInstallation on Centos 65 x64 with Apache and PostgreSQL 93
          • Expanded. Click to collapseCollapsed. Click to showInstallation OpenProject 40
            • Hierarchy leafOP4 Debian Stable with MySQL in production
          • Expanded. Click to collapseCollapsed. Click to showMigration paths
            • Hierarchy leafFrom Chilliproject to OpenProject
            • Hierarchy leafMigration 15 to 30
            • Hierarchy leafMigration 24 to 30
            • Hierarchy leafMigration Redmine 2x › OpenProject 30
            • Hierarchy leafOpenProject 3 Migration
          • Hierarchy leafOpenProject 40
        • Expanded. Click to collapseCollapsed. Click to showNews
          • Hierarchy leafNew OpenProject Translations Plugin
          • Hierarchy leafNew Plugin on OpenProjectorg Local Avatars
          • Hierarchy leafNew design for OpenProject
          • Hierarchy leafNews Accessibility workshop for OpenProject
          • Hierarchy leafNews Glossary for OpenProject
          • Hierarchy leafNews Heartbleed fixed
          • Hierarchy leafNews Icon Fonts
          • Hierarchy leafNews OpenProject 30 Release
          • Hierarchy leafNews Release GitHub Integration Plugin
          • Hierarchy leafNews Success Story Deutsche Telekom
          • Hierarchy leafNews Timelines
          • Hierarchy leafOpenProject 3013 released
          • Hierarchy leafOpenProject 3017 released
          • Hierarchy leafOpenProject 40 released
          • Hierarchy leafOpenProject 40 will be coming soon
          • Hierarchy leafOpenProject 405 released
          • Hierarchy leafOpenProject and pkgrio
          • Hierarchy leafOpenProject news moved to a new blog
          • Hierarchy leafOpenProjectBitnami
          • Hierarchy leafPackager version with plugins released ("Community edition")
          • Hierarchy leafRegistration OpenProject-Foundation
          • Hierarchy leafRelease OpenProject AuthPlugins
          • Hierarchy leafUpdates on OpenProject
          • Hierarchy leafWe need your feedback for the the new fullscreen view for work packages
        • Hierarchy leafOpenProject Plug-Ins
      • Hierarchy leafWiki
You are here:
  • Forums
  • Support Installation & Updates

Content

[SOLVED] DB migration issue while updating OpenProject Docker image

Added by Jesse Rusk 12 months 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 (3)

RE: DB migration issue while updating OpenProject Docker image - Added by Cyril Rohr 12 months 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 12 months 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 12 months 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
  • (1 - 3/3)
Loading...