Content
migration-from-pre-8.sh crashes
Added by Richard McAleer over 3 years ago
I am using the process outlined in https://community.openproject.org/topics/13102
as a guide for upgrading our openProject installation
- it's presently at 7 on Ubuntu 16.04
- and we'd like to upgrade to the most recent stable on Ubuntu 20.04
I am encountering a problem when running the migration script on the dump I created from our running installation
The command I ran was:
./migrate-from-pre-8.sh localhost ../mnt/openpprojectbackup/op7.sql
it runs for a while and ends with:
1.4) Creating MySQL database for migration from OP 7 to 8
Warning: Using a password on the command line interface can be insecure.
Created database
1.5) Importing MySQL dump (../mnt/openpprojectbackup/op7.sql)
Warning: Using a password on the command line interface can be insecure.
Imported database
1.6) Migrating database from 6 to 7 ... (NOOP if already on 7)
Error response from daemon: Container fe7a496000df8771d37e51b2fe79ca5e89e481ae641526c828f3c8d9fe40e340 is not running
Could not migrate database
if i try and re-run the script it appears that it has left things in an active state
richard@richard-toolbox:~/output$ ./migrate-from-pre-8.sh localhost ../mnt/openpprojectbackup/op7.sql
Migrate to 8 in MySQL
1.1) Starting mysql database...
already running
1.2) Starting OpenProject 7
docker: Error response from daemon: Conflict. The container name "/op7" is already in use by container "fe7a496000df8771d37e51b2fe79ca5e89e481ae641526c828f3c8d9fe40e340". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
richard@richard-toolbox:~/output$
A couple of things I can think of:
- the IP address for the migration script: I passed localhost as everything here is on the one VM (it's been created just for this migration) is there something I am missing here?
- the machine I am trying to run the migration on is running Ubuntu 20.04 - would this cause problems?
Thanks for any suggestions
All the best
- Richard
Replies (10)
I appear to have got beyond that part of the script by trying on an Ubuntu16 machine and passing the host IP address (as reported from ifconfig) to the script
It appear that the script completes but complains about not being able to rename primary keys
From the log file:
and from the terminal output
This is a pre-flight test to see if the migration is possible and it certainly looks like it has got most of the way it needs; I am trying to get my head around the last few steps so that I can be confident that when I take the running server off line to upgrade it's OS & installation that I'll be able to get it running again
Any advice or suggestions would be gratefully received
Hi Richard,
the first output hints at something running in parallel trying to migrate the database. Is the migration script all you perform? You could also append a mysql dump with
--no-data
set so we can try to reproduce the migration error without providing any actual data to us.Best
Oliver
Hi Oliver
There should have been nothing else going on; I was running the script on a VM running a fresh install of Ubuntu16.04 created for the purpose
I've attached the no-data dump as you suggested; hopefully there will be some clues there
All the best
Richard
Hi Richard,
could you also provide a dump of the
schema_migrations
table? That is needed to perform the migrationsyou can do that `mysqldump <dbname> schema_migrations > schema_migrations.sql.dump`
Best
Oliver
Hi Oliver
Hopefully the attached file should be what you need ( I zipped it as there appeared to be a content violation with the dump file)
All the best
Hi Richard,
good news and bad news: The migration ran through fine for me with your latest dump attached to the previous one:
Judging from your previous output, it might be that the fulltext migrations somehow fail to run through as they start a second migration run.
I do have an older MySQL dump lying around with data that I can try to perform the migration out. If you have the option to provide us a MySQL dump with (partial) data to try again, feel free to reach out to me personally at o.guenther@openproject.com
Best
Oliver
Thanks Oliver
It's good to know that it can work!
I tried running the script again a few minutes ago
The script I am using is the one here: https://raw.githubusercontent.com/opf/openproject/dev/script/migration/migrate-from-pre-8.sh which looks to have its last commit in April - so hopefully that is up to date
Strangely it appeared to get a bit further failing with the following in the console (perhaps being a re-run makes a difference - looking at the text in the terminal it certainly had less to do towards the start of the script?)
I have attached the last portion of the migration.log
Do you think there's an obvious fix for this?
All the best,
Richard
Richard, Oliver... I had the same problem.. I managed to get inside the PostgreSQL database being used for the migration and was able to look at the
users
relation. Turns out that the columns there are namedcreated_at
andupdated_at
rather than (as it is in the MySQL version I was upgrading from)created_on
andupdated_on
.Looking through the other tables of my current MySQL installation, it seems there is very inconsistent usage: Some tables use
created_at
... others usecreated_on
... etc.PostgreSQL:
MySQL:
Richard McAleer wrote:
Just for anyone else who ends up here, and the aforementioned shell script is still not working for the reasons mentioned above, I did manage to work around the problem of the script crashing at the last migration from OP10 > OP11.
What I did was to follow all of the instructions on the page https://www.openproject.org/docs/installation-and-operations/misc/upgrading-older-openproject-versions/. (Do not forget to also check the notes about the possibility of the OP7 Docker instance failing to start, and make the adjustments recommended there if needs be.) The script will run up until the point it tries to migrate from version 10 to version 11. Since as of this writing that was pretty much the last step, I decided to see if the packaged installation would migrate successfully. So basically, here's what I did, but I am not saying that this is the most correct or optimized workaround:
migrate-from-pre-8.sh
script as far as it will go. Should crash on step 2.5 as indicated by the script, migrating from 10 to 11 (latest version.)docker cp
to copy the dump file to your host machine.sudo openproject configure
which should see the existing data and trigger the migration. *** NOTE: In order to get the migration to run without errors, I had to set the database user aspostgres
with an appropriate password. This is obviously not ideal. I also tried creating the database as anopenproject
user (so thatopenproject
would be the owner) in step 4, but this still resulted in errors (possibly different errors... I wasn't paying close attention) in the migration. I'll admit I'm still a bit new to Postgres so if there's a recommendation of how to alter that step properly, I'm open to suggestions. Maybe after the migration, it's okay to change the OP database user back to a different account that has access only to the OpenProject database? What about future migrations?The version I upgraded to is 11.4.1. I'm not sure why the migration fails for the Docker instance (maybe not running same version 11 in Docker?)
If I need to expand on any details in these steps (Docker, Postgres commands used, etc.) let me know and I can flesh it out a little more.