Docker-gitlab: Deprecate/remove mysql

Created on 8 Jul 2019  路  8Comments  路  Source: sameersbn/docker-gitlab

Heads up for 12.1 which will remove support for mysql.

https://about.gitlab.com/2019/06/27/removing-mysql-support/

wontfix

Most helpful comment

Here's how I did it, mainly following the migration guide. Important: This must be done before any upgrade of Gitlab.

  • Configure and start a fresh postgresql container
  • Install pgloader in that container (can be tricky!)
  • Stop gitlab container
  • Modify you gitlab configuration to use this new postgresql as DB
  • Init the Database with rake like docker-compose run --rm gitlab app:rake db:create db:migrate
  • Use pgloader to migrate your data from mysql to the postgres (I've somehow managed to install pgloader inside the alpine postgres container - but it should be much easier if you just use the pgloader docker image)
  • Restart gitlab
  • Verify that it doesn't use mysql anymore
  • Upgrade Gitlab as usual

All 8 comments

Anyone has migrated from mysql to postgresql successfully?

This is official docs https://docs.gitlab.com/ee/update/mysql_to_postgresql.html, but I have not tryied yet

I did yesterday and it was a bit tricky. Mainly because pgloader 3.5.2, wich was distributed by apt inside the gitlab and postgresql containers, was bugged. I finally ended up using the latest pgloader docker image (dimitri/pgloader).

Some more tips:

  • Use the --net flag when running pgloader with docker run to allow access to your gitlab docker network and mount your local commands.load file to use it with docker run
  • The schema Gitlab creates in the PostgreSQL database is called "public". PostgreSQL differs between database and schema, MySQL does not, thats why the commands.load file in the offical docs uses the alter schema statement

I'm on 12.0.4.

I completed the migration and now the GitLab won't start:

2019-08-23 09:33:54,144 INFO success: gitaly entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:33:54,145 INFO success: gitlab-workhorse entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:33:54,145 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:33:54,145 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:33:54,145 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:33:54,146 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:33:54,146 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:35:05,159 INFO exited: unicorn (exit status 1; not expected)
2019-08-23 09:35:05,183 INFO spawned: 'unicorn' with pid 3092
2019-08-23 09:35:05,206 INFO exited: sidekiq (exit status 1; not expected)
2019-08-23 09:35:05,614 INFO spawned: 'sidekiq' with pid 3093
2019-08-23 09:35:06,197 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:35:07,134 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:35:38,031 INFO exited: unicorn (exit status 1; not expected)
2019-08-23 09:35:38,203 INFO spawned: 'unicorn' with pid 3104
2019-08-23 09:35:38,892 INFO exited: sidekiq (exit status 1; not expected)
2019-08-23 09:35:39,422 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:35:39,424 INFO spawned: 'sidekiq' with pid 3105
2019-08-23 09:35:40,568 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-08-23 09:36:11,940 INFO exited: unicorn (exit status 1; not expected)
2019-08-23 09:36:12,481 INFO spawned: 'unicorn' with pid 3118

I tried recreating the container, but so far nothing has worked.

Any ideas, how to fix it (besides rolling back to mysql)?

@northway you could look at the unicorn log to get a better idea of why it's failing.

Do docker-compose exec gitlab bash to get inside the gitlab container then look at /var/log/gitlab/unicorn.stderr.log (and maybe unicorn.stdout.log).

After a Docker host restart the same thing is happening and I'm still on MySQL.

Here's the unicorn log:

/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:205:in `pid=': Already running on PID:2951 (or pid=/home/git/gitlab/tmp/pids/unicorn.pid is stale) (ArgumentError)
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:137:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `<top (required)>'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/bin/unicorn_rails:23:in `load'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/bin/unicorn_rails:23:in `<main>'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:205:in `pid=': Already running on PID:2951 (or pid=/home/git/gitlab/tmp/pids/unicorn.pid is stale) (ArgumentError)
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:137:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `<top (required)>'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/bin/unicorn_rails:23:in `load'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/bin/unicorn_rails:23:in `<main>'
/home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:205:in `pid=': Already running on PID:2951 (or pid=/home/git/gitlab/tmp/pids/unicorn.pid is stale) (ArgumentError)
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:137:in `start'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `<top (required)>'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/bin/unicorn_rails:23:in `load'
    from /home/git/gitlab/vendor/bundle/ruby/2.6.0/bin/unicorn_rails:23:in `<main>'

After recreating egy the container this issue is gone.

Back to migrate in question:

  • How should I create the new schema in psql?
  • Is it possible to connect both psql and mysql to the gitlab container?

Here's how I did it, mainly following the migration guide. Important: This must be done before any upgrade of Gitlab.

  • Configure and start a fresh postgresql container
  • Install pgloader in that container (can be tricky!)
  • Stop gitlab container
  • Modify you gitlab configuration to use this new postgresql as DB
  • Init the Database with rake like docker-compose run --rm gitlab app:rake db:create db:migrate
  • Use pgloader to migrate your data from mysql to the postgres (I've somehow managed to install pgloader inside the alpine postgres container - but it should be much easier if you just use the pgloader docker image)
  • Restart gitlab
  • Verify that it doesn't use mysql anymore
  • Upgrade Gitlab as usual

This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings