Content
Migration from Chiliproject 1.5.2 to OpenProject 3.0
This page describes the migration process all the way from chiliproject 1.5.2
up to openproject 3.0
for the fit configuration (a.k.a cockpit).
While based on that configuration all these steps as well as the referred repositories can be used as a starting point for migrations of arbitrary configurations.
Migration from chiliproject 1.5.2 to 2.4
Migrating to chiliproject @tag 2.4.0.
Migration settings
redmine_backlogs
is now chiliproject_backlogs
. Accordingly the settings plugin_redmine_backlogs
has to be changed to plugin_chiliproject_backlogs
.
This has been implemented in a rails migration in the repository referred to below.
Steps
Checkout
git clone -b migrate/1.5_to_2.4 https://dev.finn.de/git/redmine-config-fit migrate-1.5_to_2.4
RVM setup
Use ruby 1.8.7
, e.g.:
cd migrate-1.5_to_2.4 echo 1.8.7 > .ruby-version && echo migrate-1.5_to_2.4 > .ruby-gemset cd . # to apply
You can also put those files directly into the chiliproject
directory, that’s up to you, really.
Install Gems
In the chiliproject directory do:
bundle install
Database Setup
This guide assumes that you have an existing production database which you want to migrate.
Accordingly you do the following in the checked out directory:
cd chiliproject cp config/database.yml.example config/database.yml
Then fill in said database under production
.
Generate Session Store
RAILS_ENV=production bundle exec rake generate_session_store
Database Migrations
RAILS_ENV=production bundle exec rake db:migrate:all
This step may take a while depending on the existing data.
After this step you are done with the migration from chiliproject 1.5 to openproject 2.4.
Changes to ActiveRecord
Some migration may not work due to it using an unsafe feature.
If this happens, comment to disable:
/.rvm/gems/ruby-1.8.7-p374@mygemset/gems/activerecord-2.3.18/lib/active_record/attribute_methods.rb:195
that is the following code:
raise ActiveRecordError, "You tried to assign already serialized content to #{attr_name}. This is disabled due to security issues."
Migration from 2.4 to 3.0
Documents
Install plug-in ‘openproject-documents’ by adding the following to Gemfile.plugins
:
gem “openproject-documents”, :git => “git@github.com:finnlabs/openproject-documents.git”, :branch => “dev”
This has been done in the configuration referred to below.
Through this all documents except for Project and Version attachments are kept.
Project and Version attachments have to be deleted during migration.
An according notification with further instructions will come up as you execute it.
Steps
Checkout
git clone-b migrate/2.4_to_3.0 https://dev.finn.de/git/redmine-config-fit migrate-2.4_to_3.0
RVM setup
Use ruby 2.0
, e.g.:
cd migrate-2.4_to_3.0 echo 2.0 > .ruby-version && echo migrate-2.4_to_3.0 > .ruby-gemset cd . # to apply
You can also put those files directly into the chiliproject
directory, that’s up to you, really.
Install Gems
In the openproject directory do:
bundle install
Database Setup
This guide assumes that you have an existing production database which you want to migrate.
Accordingly you do the following in the checked out directory:
cd openproject cp config/database.yml.example config/database.yml
Then fill in said database (the same used above in the section for migrating from 1.5 to 2.4) under production
.
Generate Secret Token
RAILS_ENV=production bundle exec rake generate_secret_token
Database Migrations
In the checked out directory run:
RAILS_ENV=production FROM="Europe/Berlin" rake migrations:timelines:reregister migrations:strong_passwords:reregister db:migrate
Replace the value for FROM
with the correct locale. That is the locale under which the data that is being migrated was saved.
This migration may take a considerable amount of time depending on your existing data which is being migrated.
Error: There are still attachments attached to Versions or Projects!
Support for Project and Version attachments has been dropped in OpenProject 3.0.
Hence the only solution is to delete those attachments altogether:
RAILS_ENV=production rake migrations:attachments:delete_from_projects_and_versions
If you still need them, you might migrate them by creating a documents (requires the documents plugin) for them.
E.g. create one document for each project/version and then in the attachments
table change container_type
to 'document'
and the container_id
to the id
of the respective document. All this is best done in a separate migration which you would create.
After this you rerun the migration.
Mysql2::Error: Illegal mix of collations
Continue the migrations after:
RAILS_ENV=production rake migrations:journals:fix_table_collation
This may occur when you forgot to specify a collation in database.yml
:
production: adapter: mysql2 database: my_database host: localhost username: my_user password: my_password encoding: utf8 collation: utf8_general_ci
So to avoid this problem to begin with use whatever collation is used in the existing production data under collation.
When migrating from an older rails version it likely is 'utf8_general_ci'
whereas in newer versions it usually is 'utf8_unicode_ci'
which is what leads to this error eventually.
Alternatively you can just update the existing tables to whatever collation you prefer while also specifying it in database.yml
before running any migrations.