jboxberger / synology-gitlab-jboxberger

Synology GitLab package based on postgresql
MIT License
37 stars 2 forks source link

Data not migrated during upgrade #8

Closed pumox closed 5 years ago

pumox commented 6 years ago

Hi, during the upgrade from 9.4.4 to 10.6.4-0051 via Synology Package Manager, the setup wizard also migrated the database from MariaDB to Postgresql. At least, I thought it will. Unfortunately after it completed I saw a brand new instance of Gitlab Community without my projects, users, runners etc. What can I do now, to get my data back into Postgresql? I still can see the data in MariaDB.

jboxberger commented 6 years ago

Hi, well the setup wiizzard do not migrate from MariaDB to Postgresql at any time. You can do it on your own or you can use the appended helper script to do the mysql to postgres migration... and maybe, just maybe read the instructions before...

https://github.com/jboxberger/synology-gitlab-jboxberger#migrate-from-stock-944-0050-synology-gitlab-package

Kind Regards

pumox commented 6 years ago

Ok excuse me @jboxberger , I didn't read that before because I was using the upgrade wizard from Synology and didn't expect to have to check back here. However I will do in future. So, in my case where the wizard made the upgrade I just have to SSH into the Disc Station and run the following command?

sudo ./var/packages/synology-gitlab-jboxberger/scripts/migrate-m10 --maria-db-root-password "mdb10-root-password" --maria-db-database "mdb10-gitlab-databse-name"

Sorry I'm not an Synology/Linux expert, so any advice would be very helpfull.

pumox commented 6 years ago

Where can I find this script? After SSH into the Disc Station I only see the folder "/var/packages/Docker-GitLab" but no "/var/packages/Docker-GitLab-jboxberger" and the script is also not there under "/var/packages/Docker-GitLab/scripts".

Kind Regards

pumox commented 6 years ago

obraz

jboxberger commented 6 years ago

hi pumox,

which version do you had installed prevously? 9.4.4-0050 with MariaDB 10, right? Had anything worked fine? If the Upgrade will not Work for you you can always go back to 9.4.4-0050 as lon as you have not deleted the /volume1/gitlab folder and you MariaDB Database.

Have you already installed the "9.4.4-0100 PostgreSQL GitLab Package"

https://github.com/jboxberger/synology-gitlab-jboxberger/releases?after=10.5.5-0100

pumox commented 6 years ago

Hi @jboxberger , it was the official Synology Gitlab 9.4.4 and as I know I had all previous gitlab updates installed that were available through the Synology Package Manager. But I'm not 100% sure if it was 9.4.4-0050 or 9.4.4-0100. Yes, Gitlab was using MariaDB 10 and worked fine.

Here is also the info from one of the backups (backup_information.yml):

:db_version: '20170725145659' :backup_created_at: 2018-07-15 03:04:47.273709160 +00:00 :gitlab_version: 9.4.4 :tar_version: tar (GNU tar) 1.27.1 :skipped: ''

jboxberger commented 6 years ago

The 9.4.4-0050 is the stock package, there were no 9.4.4-0100 release from Synology Inc. I have released the 9.4.4-0100 with the postgres db linked for the migration path. You can download the 9.4.4-0100 here. You just need to follow the migration steps. After installing 9.4.4-0100 you will find the synology-gitlab-jboxberger folder and the containing migration script.

Please follow this Steps: https://github.com/jboxberger/synology-gitlab-jboxberger#migrate-from-stock-944-0050-synology-gitlab-package

pumox commented 6 years ago

Thank you jboxberger, however actually I have the 10.6.4-0051 installed. Shoud I uninstall this Version? I guess the gitlab folder could already be affected by the newer Version. Is it possible to do a downgrade in this case?

PS: It must have been so, that I upgraded from stock package 9.4.4-0050 to stock package 10.6.4-0051 without the intermediate step 9.4.4-0100.

jboxberger commented 6 years ago

DO NOT DELETE 1) /volume1/docker/gitlab 2) MariaDB Databases

In any case make a Backup before! Save your "/volume1/docker/gitlab" dir and MariaDB Database.

You can uninstall 10.6.4-0051 without problems but keep the data during uninstall! The Data on the FIlesystem usually in "/volume1/docker/gitlab" should be not affected. After Uninstall you should also delete the postgres docker container and postgres data usually in "/volume1/docker/gitlab-db/"

After that you should reach the state as you just had uninstalled 9.4.4-0050. Now you can follow the steps 3 + 4 + 5.

https://github.com/jboxberger/synology-gitlab-jboxberger#migrate-from-stock-944-0050-synology-gitlab-package

I reccomend you to upgrde to GitLab 10.5.5-0100 before you update to the 11.0.1-0101. I am not shure wether the Gitlab internal databases migration scripts can migrate the database scheme from 9.4.4 to 11.0.1.

Kind Regards

klibansky commented 5 years ago

Hi @jboxberger, I followed your instructions however the migration from mariadb to postgresql faild. Gitlab is running but I does not have the users etc. This is the output after running your script:

###########################################################################################

WARNING!!! DATABASE VERSION MISMATCH DETECTED!!!

You can only migrate within GitLab one version. If the versions do not match, the

migration will fail. Matching example: MariaDB GitLab 10.1.4 to PostgreSQL GitLab 10.1.4.

Continue only when you know what you're doing!

########################################################################################### Continue migration anyway? (y/n): y Warning: World-writable config file '/var/packages/MariaDB10/etc/my.cnf' is ignored Warning: World-writable config file '/var/packages/MariaDB10/etc/my.cnf' is ignored create /volume1/docker/mysqld/mysqld-migration.sock link pulling dimitri/pgloader:latest image latest: Pulling from dimitri/pgloader e833e65f6ad9: Pull complete cdcfbf9f2bf6: Pull complete df59ed72c3d6: Pull complete Digest: sha256:6a07ecf625235b551ae6f8340584a2bbbee8947946c5172ed4035cb22ae611ae Status: Downloaded newer image for dimitri/pgloader:latest creating dimitri-pgloader container [Line 259] Exec WebAPI: api=SYNO.Docker.Container, version=1, method=create, param={"is_run_instantly":true,"profile":{"cap_add":null,"cap_drop":null,"cmd":"bash","cpu_priority":50,"devices":null,"enable_publish_all_ports":false,"enable_restart_policy":false,"enabled":false,"env_variables":[{"key":"PATH","value":"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}],"exporting":false,"id":"fb6ab9e5e8b8714c7089ebb724a80d3097014f99d229f14ac78ab7b1cf8b6f52","image":"dimitri/pgloader:latest","is_ddsm":false,"is_package":false,"links":[{"alias":"postgresql","link_container":"synology_gitlab_db"}],"memory_limit":0,"name":"dimitri-pgloader","network":[{"driver":"bridge","name":"bridge"}],"network_mode":"bridge","port_bindings":[],"privileged":false,"shortcut":{"enable_shortcut":false},"ulimits":null,"use_host_network":false,"volume_bindings":[{"host_volume_file":"/docker/mysqld/mysqld-migration.sock","mount_point":"/var/run/mysqld/mysqld.sock","type":"rw"}],"volumes_from":null}}, runner= { "data" : { "dependent_container" : [ "synology_gitlab_db" ], "start_dependent_container" : true }, "httpd_restart" : false, "success" : true } CREATE gitlab_migration Superuser NOTICE: role "gitlab_migration" does not exist, skipping ALTER ROLE KABOOM! FATAL error: At

   INTO postgres://gitlab_migration:99TdYCpt5AkP@postgresql:5432/gitlab

WITH include no drop, tr ^ (Line 4, Column 0, Position 181)

In context KW-INTO:

While parsing KW-INTO. Expected:

 the character Tab

or the character Newline or the character Return or the character Space or the string "--" or the string "/*" or the string "into" An unhandled error condition has been signalled: At

   INTO postgres://gitlab_migration:99TdYCpt5AkP@postgresql:5432/gitlab

WITH include no drop, tr ^ (Line 4, Column 0, Position 181)

In context KW-INTO:

While parsing KW-INTO. Expected:

 the character Tab

or the character Newline or the character Return or the character Space or the string "--" or the string "/*" or the string "into"

What I am doing here?

At

   INTO postgres://gitlab_migration:99TdYCpt5AkP@postgresql:5432/gitlab

WITH include no drop, tr ^ (Line 4, Column 0, Position 181)

In context KW-INTO:

While parsing KW-INTO. Expected:

 the character Tab

or the character Newline or the character Return or the character Space or the string "--" or the string "/*" or the string "into"

DELETE gitlab_migration user DROP ROLE DELETE pgloader docker container and image [Line 237] Not a json value: dimitri-pgloader [Line 259] Exec WebAPI: api=SYNO.Docker.Container, version=1, method=delete, param={"force":true,"name":"dimitri-pgloader","preserve_profile":false}, runner= { "data" : {}, "httpd_restart" : false, "success" : true } Untagged: dimitri/pgloader:latest Untagged: dimitri/pgloader@sha256:6a07ecf625235b551ae6f8340584a2bbbee8947946c5172ed4035cb22ae611ae Deleted: sha256:339efaf6c47ff2201dad558f40f8e14c83d15abf222caa477f0fef5820e2e40c Deleted: sha256:b12584f9a23e2206c099b254a9616a7af54bd8c6669fc00d464d21f22298bf67 Deleted: sha256:88e53b95d7a0d490b6d9bef6be6e74552841fa2d9af181fb76636d534e5f4f4b Deleted: sha256:0621ba6167ae01ac270ea1f0feb4f707dc0d75aad1012dbee18593c5dcaf5910 DELETE /volume1/docker/mysqld/mysqld-migration.sock

Its very briefly starts Docker image dimitri-pgloader and then says: "dimitri-pgloader stopped unexpectedly" in DSM.

Any thought?

jboxberger commented 5 years ago

Hi,

what is the old Gitlab Version you had prevously? What is the current installed Version?

Kind Regads

klibansky commented 5 years ago

Hi @jboxberger , Like I said, it's exactly like your tutorial 1:1.

klibansky commented 5 years ago

As in > Migrate from stock 9.4.4-0050 Synology GitLab Package After running the migrate script, I get the above output. After that Gitlab is running but no projects of users.

klibansky commented 5 years ago

So at the moment your GitLab 9.4.4-0100 PostgreSQL version is running. I still have the MariaDB data and the entire gitlab data in a separate backup.

jboxberger commented 5 years ago

It looks like the dimitri/pgloader container which is required for the conversion from mysql to psql is broken. As you say the container is not able to start.

Mybe you can post the log of the pgloader container.

Kind Regards

klibansky commented 5 years ago

Could you tell me how to do that? In DSM I can see the docker container appear but as soon as the scripts stops, the container disappears.

Its actually as soon as the container appears it stops again and it gives me an alert popup with the message "container undefined does not exist".

jboxberger commented 5 years ago

Yes, of course. I think the script deltes automatically the container after it runs on error and it is too fast so you can not really do something over the UI.

Just modify the Line 174 in the migrate-m10 script and comment the line. https://github.com/jboxberger/synology-gitlab-jboxberger/blob/ade0663a447c895a2f9f10ee5d04bc91325acdc1/src/scripts/migrate-m10#L174 modify to #docker rmi "$PGLOADER_IMAGE"

This prevent the container from deltetion and you should be able to view the logs.

klibansky commented 5 years ago

Thanks! I did what you said. The container does still not persist. In the short time that is exists it says 'no logs available'.

Link to GIF

klibansky commented 5 years ago

I just feel we are going to solve this problem :)

klibansky commented 5 years ago

OK, I also commented out this line "$SYNO_WEBAPI --exec api=SYNO.Docker.Container version=1 method=delete name="$PGLOADER_CONTAINER" force=true preserve_profile=false" Now the container does stay up and running after the script has completed to run.

When I go to the logs tab, there are no logs available. When I go to the terminal tab, I get a console logged in with root. Thats it...

jboxberger commented 5 years ago

ok i will check this today when i am home from work. i should be able to reproduce this,

jboxberger commented 5 years ago

Ok there seems to be a problem which i can not reproduce.

I reccomend you to unistall the synology-gitlab-jboxberger package completely and reinstall the prevous package. You can find the older original synology packages here.

After that you can update to the original 11.0.4-0053 package and then you have at least a working Gitlab on psql.

I will revive the https://github.com/jboxberger/synology-gitlab package which is technically the stock package but with the updated GitLab Version. Later you will be able to install it over the stock synology package without any doubts or extras.

Kind Regards

klibansky commented 5 years ago

Well, that is exacly what I tried to do in the first place but I could never update to the latest Synology version because of the error during the migration from mariadb to postgresql. Are you saying that if I update from stock gitlab to your v11 that it will work? Do I still have to run the update script via the terminal?

jboxberger commented 5 years ago

No if you even cant migrate from stock mariadb to stock postgres then this will not help you. it seems like your db somehow corrupted. have you tried the import / export feature from GitLab?

jboxberger commented 5 years ago

Hello kdesigns,

If you still use the synology-gitlab-jboxberger package please migrate to my synology-gitlab or to the stock package, since this package will not be updated any more.

Kind Regards