Migrate to a new minio version
Migrate to a new minio version
Overview
Minio (https://min.io/) is released every week. This article describe a procedure how to upgrate the minio container to a latest with data migration.
Migration procedure
1. Find a latest version
Open docker hub minio images page https://hub.docker.com/r/minio/minio/tags and find out the latest minio release you want to update to:
It should be like: RELEASE.2024-03-05T04-48-44Z
2. Prepare new minio container where to migrate data
Open and update docker-compose.yml (from rpaplatform installation directory, which is by default /opt/rpaplatform) by adding a copy of minio container with the following changes:
- use container name - minio_new
- use target image version (image) - f.e. RELEASE.2024-03-05T04-48-44Z
- change minio data folder (volumes) to a ${STORAGE}/minio_new
- remove ports section
minio_new: image: "minio/minio:RELEASE.2024-03-05T04-48-44Z" restart: "always" entrypoint: - "/wait-for-it.sh" - "-t" - "90" - "auth-server:8990" - "--" - "minio" - "server" - "/data" - "--console-address" - ":7001" volumes: - "${STORAGE}/minio_new:/data" - "./data/wait-for-it.sh:/wait-for-it.sh" environment: - "MINIO_ROOT_USER=${MINIO_ACCESS_KEY}" - "MINIO_ROOT_PASSWORD=${MINIO_SECRET_KEY}" - "MINIO_IDENTITY_OPENID_CONFIG_URL=http://auth-server:8990/authrpa/.well-known/openid-configuration" - "MINIO_IDENTITY_OPENID_CLIENT_ID=minio" - "MINIO_IDENTITY_OPENID_CLIENT_SECRET=minio-secret" - "MINIO_IDENTITY_OPENID_SCOPES=openid" - "MINIO_IDENTITY_OPENID_REDIRECT_URI=${CS_PUBLIC_ENDPOINT}:7001/oauth_callback" - "MINIO_BROWSER=true" logging: driver: "json-file" options: max-file: "5" max-size: "10m"
3. Up the new container and migrate data
Run the new container using bash command:
$ docker-compose up -d minio_new
Find out new container id:
$ docker ps | grep minio_new 572987ad887b minio/minio:RELEASE.2024-03-05T04-48-44Z "/wait-for-it.sh -t …" 2 weeks ago Up 17 hours 9000/tcp rpaplatform_minio_new_1
Execute migration script inside the new container:
$ docker exec -it 572987ad887b /bin/bash [root@572987ad887b /]# mc alias set minio_old http://minio:9000 <PASSWORD_MINIO_ACCESS> <PASSWORD_MINIO_SECRET> [root@572987ad887b /]# mc alias set minio_new http://localhost:9000 <PASSWORD_MINIO_ACCESS> <PASSWORD_MINIO_SECRET> [root@572987ad887b /]# mc mirror --preserve minio_old minio_new
Wait till migration competed sucesfully.
4. Switch minio comtainer to a new version
Stop the control server and remove the migration container:
$ docker-compose stop $ docker-compose rm -f minio_new
Backup old data ${STORAGE}/minio and rename ${STORAGE}/minio_new to ${STORAGE}/minio_new (where the STORAGE directory that is defined in .env).
Open and update docker-compose.yml again, remove the minio_new container definition and update the minio container by the new image version (image) - f.e. RELEASE.2024-03-05T04-48-44Z
Start the control server:
$ docker-compose up -d