Migrate to PostgreSQL, rake aborted, Ruby Version Mismatch

Infos:

  • Used Zammad version: 3.4.0
  • Used Zammad installation type: package
  • Operating system: OpenSuse LEAP 15.2

I’m following Migrate to PostgreSQL server — Zammad documentation to migrate from mysql to Postgresql. This is part of the migration of Zammad 3.4.0 to 5.3.0.

However the Howto is failing at this point:

# zammad run rake zammad:db:pgloader > /tmp/pgloader-command
rake aborted!
Bundler::RubyVersionMismatch: Your Ruby version is 2.5.9, but your Gemfile specified 2.6.5
/opt/zammad/config/boot.rb:3:in `<top (required)>'
/opt/zammad/config/application.rb:1:in `require_relative'
/opt/zammad/config/application.rb:1:in `<top (required)>'
/opt/zammad/Rakefile:5:in `require_relative'
/opt/zammad/Rakefile:5:in `<top (required)>'

Caused by:
LoadError: cannot load such file -- bundler/setup
/opt/zammad/config/boot.rb:3:in `<top (required)>'
/opt/zammad/config/application.rb:1:in `require_relative'
/opt/zammad/config/application.rb:1:in `<top (required)>'
/opt/zammad/Rakefile:5:in `require_relative'
/opt/zammad/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

Which Gemfile is responsible? I could either modify the Gemfile to depend on 2.5.9 or upgrade to Ruby 2.6.5.
Even if dist-upgrading LEAP to latest 15.4, non of the OpenSuse LEAP currently provides anything higher than ruby 2.5.

The documentation part you’re trying to use applies to Zammad 5.3.0 and later. I will add an note on the documentation shortly - sorry for the confusion.

Zammad 3.4 is extremely old and prune to security issues so you may wanna upgrade before hand. (You need to any way in order to use the migration doc :x )

I’m on the way migrating to a recent Zammad and also migrating from Mysql to Postgresql. First approach was doing the DB migration first, then the Zammad migration. But as it seems that Zammad 5.4 still supports Mysql I’m going to do the Zammad migration first.

For the first Zammad migration step I synced the docker-compose repo to some Zammad 4.0.0 version. I have the containers running now with the default zammad-docker-compose-zammad-postgresql-1.
How would I switch that docker setup to use mysql and import our old mysql db there?

As far as I’m aware our docker-compose does not support MySQL at all.
The easiest approach is using the same machine Zammad currently runs on.

That was my first try that failed. On the old Zammad 3.4 machine, the “Migrate to PostreSQL…” guide fails.
Is there any way to access older documentations than Welcome to Zammad’s documentation! — Zammad documentation if that one is not matching older Zammad anymore?

Yes as I said - it’s available from Zammad 5.3.0 and higher.

A versionized version of this documentation part currently is not planned.
Personally I think it doesn’t make too much sense for this system documentation because we expect the admin to update Zammad in a timely manner.

Right now we have hints for down to Zammad 2.5 for specific important things to allow upgrades:
image

image

Above may change over the time (about the versioning) so may be an invalid take in the future.

As Mysql is still supported I’m going to take Mysql for migrating Zammad up to the latest, then doing the migration to Postgres.

For now I have synced the zammad-docker-compose to zammad-4.0.0. Then I pulled a mariadb image and added a container to the zammad-docker-compose_default network. Then I imported our old data to that MariaDB:

docker run --detach --name zammad-mariadb --network zammad-docker-compose_default --env MARIADB_USER=zammad --env MARIADB_PASSWORD=zammad123 --env MARIADB_ROOT_PASSWORD=root123 mariadb:latest

Now how do I connect the Zammad container to that MariaDB?
I edit the file /var/lib/docker/volumes/zammad-docker-compose_zammad-data/_data/config/database.yml on the persistent volume, changing adapter: to ‘mysql2’ like on our old installation. But any docker-compose stop; docker-compose start resets that file to the original. Maybe I misunderstand how to work with these volumes?

How can I make changes to the database.yml persistent over container restarts?
How can I apply the change to use my mariadb instead of Postgres?

the docker compose version of Zammad does not support MariaDB / MySQL.
Perisistant settings are done via environment, see: Docker Compose Environment Variables — Zammad documentation

I understand that the docker-compose version is not prepared for MariaDB and does not install any container like this.
But isn’t it possible to make a configuration change to use MariaDB? I already have a MariaDB container created and imported our old data.
In the Docker Compose Environment Variables — Zammad documentation I don’t see any environment variable to set
adapter: mysql2.
And I was not successful in changing containers/zammad/docker-entrypoint.sh for setting the database.yml directly.

Which part of:
The docker compose does not support MariaDB

did you not understand?
This is a dependency issue not “that you can’t set the adapter”.
It won’t work at all. Just don’t.