jboxberger / synology-gitlab-ce

This is a docker based GitLab CE package for Synology NAS server using the original gitlab/gitlab-ce image from hub.docker.com. The goal of this project is to lower the entry barrier for new GitLab users and give experienced users a little comfort in maintaining their GitLab installation.
66 stars 9 forks source link

No migration Path for DSM6 latest GitLab 13.12.2 avaible #7

Open hubient opened 2 years ago

hubient commented 2 years ago

The latest update on DSM 6.0 for gitlab is 13.12.2 but there is no such release in here. Therefore no migration path possible as described. Is it possible to create a release 13.12.2 for the one who like to migrate to your synlogogy-gitlab-ce before upgrading the the DSM to 7.x like me.

jboxberger commented 2 years ago

Hi,

of course there is a migration path but it need some steps in between because you're really far behind.

Read Migration synology-gitlab => synology-gitlab-ce notes here.

1) Backup your synology-gitlab: 13.12.2 like in migration noes described.

2) Checkout this Repo and build your synology-gitlab-ce package (just one command). You can do it on your linux or just spin up a linux in a VM (i prefer ubuntu or fedora) ./build.sh --version=13.12.2-ce.0 --dsm=6 --type=advanced

3) restore your synology-gitlab:13.12.2 backup to synology-gitlab-ce:13.12.2 https://github.com/jboxberger/synology-gitlab-ce#restore

4) Update you GitLab to desired version you can build any version like in Step 2. Note, sometimes you have to update to the latest minor Release before you can jump to the next minor release eg. 13.12.1 to 13.12.x and then you can update to 13.13.x. On major release you almost always have to have the lastest previous major release installed. eg. 13.13.x to 14.x.x

image

I recommend you to go with the "advanced" version since the classic allows only updates with "newer" version and deletes all gitlab data on uninstall. so technically if you get the message "update to this x.x.x version first" you need to backup and uninstall the classic package. Install the previous package, restore the backup and the upgrade to the x.x.x version before you can continue upgrading.

in the advanced package you can update and downgrade in any direction you like with one command.

cd /var/packages/synology-gitlab-ce/scripts && \
sudo sh gitlab update synology-gitlab-ce --version=15.0.1-ce.0

The synology-gitlab-ce uses another namespace so there is no need to uninstall synology-gitlab. You can keep your synology-gitlab as is (maybe you need it to shut down due conflicting ports) and only when you're done with migrating to synology-gitlab-ce and your're happy with it, only then you can backup and uninstall your synology-gitlab.

Hope this helps.

jboxberger commented 2 years ago

I've added both files for you here but i strongly recommend you to build your own because you will need multiple versions in between to update up to 15.1.2.

synology-gitlab-ce-13.12.2-dsm6-advanced.spk.zip synology-gitlab-ce-13.12.2-dsm7-advanced.spk.zip

If you only want to migrate the git repositories without any Gitlab specific stuff (users, issues, etc.) you can make a clean install of synology-gitlab-ce:15.1.2 and follow this instructions.

Basically you copy the git project to you synology-gitlab-ce share and then import them from there. After that they belong to root in GitLab and you only have to take the ownership.

Documentation: https://docs.gitlab.com/ee/raketasks/import.html

Quick Commands:

\# inside synology-gitlab-ce container
sudo docker exec -it synology-gitlab-ce bash
sudo -u git mkdir -p /var/opt/gitlab/git-data/repository-import/<optional_groupname>/<optional_subgroup>

\# outside synology-gitlab-ce container (synology bash/shell)
sudo cp -r /old/git/foo.git /var/opt/gitlab/git-data/repository-import/<optional_groupname>/<optional_subgroup>

\# inside synology-gitlab-ce container
\# Do this once when you are done copying git repositories
sudo chown -R git:git /var/opt/gitlab/git-data/repository-import
sudo gitlab-rake gitlab:import:repos["/var/opt/gitlab/git-data/repository-import"]
hubient commented 2 years ago

This is a very big help. Thank you for your help, i will try this out soon.

rafaellop commented 2 years ago

Just one note that if for some reason (like me) you forgot to backup the config but you have backuped or stored somewhere the previous environment settings, in particularly the GITLAB_SECRETS_DB_KEY_BASE, GITLAB_SECRETS_SECRET_KEY_BASE and GITLAB_SECRETS_OTP_KEY_BASE variables, you can still restore your repository from the data backup only. After all steps you should just add the forementioned environment variables in the container settings in the Synology panel by editing the container when stopped and adding the variables.

Thank you @jboxberger for great job! With your magnificent help I've successfuly updated DSM 6 to DSM 7 and then built and installed gitlab 13.12.2 and restored all my gitlab data. Super valuable! Now I'll try to updated the gitlab to a newer version.

hubient commented 2 years ago

Hi Sorry i never answered but I could do the migration. But it took me a lot of time to do all the upgrade steps.

A big thank you for the valuable help

08.09.2022 12:27:21 rafal.platek @.***>:

Just one note that if for some reason (like me) you forgot to backup the config but you have backuped or stored somewhere the previous environment settings, in particularly the GITLAB_SECRETS_DB_KEY_BASE, GITLAB_SECRETS_SECRET_KEY_BASE and GITLAB_SECRETS_OTP_KEY_BASE variables, you can still restore your repository from the data backup only. After all steps you should just add the forementioned environment variables in the container settings in the Synology panel by editing the container when stopped and adding the variables.

Thank you @jboxberger[https://github.com/jboxberger] for great job! With your magnificent help I've successfuly updated DSM 6 to DSM 7 and then built and installed gitlab 13.12.2 and restored all my gitlab data. Super valuable! Now I'll try to updated the gitlab to a newer version.

— Reply to this email directly, view it on GitHub[https://github.com/jboxberger/synology-gitlab-ce/issues/7#issuecomment-1240526066], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AQMQSPM67CXAXSPCJNYDAUTV5G5PRANCNFSM53XULYCQ]. You are receiving this because you authored the thread.[Verfolgungsbild][https://github.com/notifications/beacon/AQMQSPOJELF4J52OEHEODNDV5G5PRA5CNFSM53XULYC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJHYOZ4Q.gif]

rafaellop commented 2 years ago

For the other users needed to upgrade. If you have your githab version finally installed and working and you would like to upgrade then use the steps below. As mentioned above you need to have the Advanced version of the synology-github-ce installed.

SSH as root and do the following:

cd /var/packages/synology-gitlab-ce/scripts

Now do the update with:

sudo sh gitlab update synology-gitlab-ce --version=X.Y.Z-ce.0

For the 13.12.2 the upgrade path is:

13.12.2 => 13.12.15 -> 14.0.12 -> 14.3.6 => 14.6.2 => 14.9.5 => 14.10.5 => 15.0.2 => 15.1.0

The paths for different versions and targets are available here: https://docs.gitlab.com/ee/update/#upgrade-paths

Each upgrade takes time to download (2-3 GB of data each version)., unpack and install. The process requires the gitlab to be stopped and restarted each time which happens automatically. Then it come to live also in a significant amount of time so be patient if you can't open the gitlab dashboard in your browser.

I've tried to omit some steps but the gitlab container was crashing. So I reversed the changes and do the full path while working on something else. I hope this will be helpful for other.

redscotina commented 2 years ago

15.1.0 => 15.3.3 work

bojake commented 1 year ago

Note that the migration from 14.0.12 -> 14.3.6 could be problematic. You need to let the DB migrate all of the IDs to fix an overflow problem in pre-14.2 versions. If you didn't wait and you get into a boot loop in your 14.3.6 migrated docker instance then you will need to run these migrations manually:

gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[["id"]\, ["id_convert_to_bigint"]]'] gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds,id,'[["id"\, "stage_id"]\, ["id_convert_to_bigint"\, "stage_id_convert_to_bigint"]]'] gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_stages,id,'[["id"]\, ["id_convert_to_bigint"]]'] gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds_metadata,id,'[["id"]\, ["id_convert_to_bigint"]]'] gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds_metadata,id,'[["build_id"]\, ["build_id_convert_to_bigint"]]'] gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,push_event_payloads,event_id,'[["event_id"]\, ["event_id_convert_to_bigint"]]']

When you are done, this command will return quietly:

gitlab-rake db:migrate

My migration took about 3 hours to complete, manually.

After each version upgrade you need to check the background job status:

https://docs.gitlab.com/ee/update/background_migrations.html#check-the-status-of-batched-background-migrations

develmac commented 1 year ago

Any tips on what to do if the upgrade to 14.0.12 fails (the container can not start anymore)? Also if I try to access the runners admin page on 15.3.3 I get a 500 as the runner token/secret seems to be missing. Not sure how I can move it from the Synology Pkg to Omnibus :(