PHRAS-4156 Redis image tag from env and others docker stacks fix (#4608)

* Redis image tag from env and lock redis version

* add aliase "db" on db-mysql8 service

* remove db depend for pma

* renaming mysql8 profil to db-mysql8
This commit is contained in:
Nicolas Maillat
2025-05-21 00:39:02 +02:00
committed by GitHub
parent 5dd527d339
commit eca8706c97
4 changed files with 45 additions and 12 deletions

17
.env
View File

@@ -42,7 +42,7 @@
# #
# - "docker-compose.limits.yml" : defines containers cpu and memory limits for all Phraseanet and gateway containers only. # - "docker-compose.limits.yml" : defines containers cpu and memory limits for all Phraseanet and gateway containers only.
# #
# - "docker-compose.altenatives.yml": all alternative services, used only on evoluation or transition periods # - "docker-compose.alternatives.yml": all alternative services, used only on evolution or transition or testing periods
# #
# 2/ "COMPOSE_PROFILES" value define which profiles you want to use # 2/ "COMPOSE_PROFILES" value define which profiles you want to use
# in docker-compose. # in docker-compose.
@@ -72,7 +72,7 @@
# - "mailhog" : for catching all email emit by app for dev and testing. # - "mailhog" : for catching all email emit by app for dev and testing.
# - "db-backup" : launch and run a container to cron database backups and backup file's rotation. # - "db-backup" : launch and run a container to cron database backups and backup file's rotation.
# - "pma" : launch a phpmyadmin container for test and dev purpose. # - "pma" : launch a phpmyadmin container for test and dev purpose.
# - "mysql8" : launch a mysql8 container (beta), (/!\ do not mix with the "db" profile) # - "db-mysql8" : launch a mysql8 container (beta), (/!\ do not mix with the "db" profile)
# Because this is the primary datastore, you should use you own SGDD service for production needs. # Because this is the primary datastore, you should use you own SGDD service for production needs.
# #
# Profiles worker list: # Profiles worker list:
@@ -279,7 +279,7 @@ RABBITMQ_MANAGEMENT_PORT=10811
RABBITMQ_HOSTNAME=rabbit_phraseanet RABBITMQ_HOSTNAME=rabbit_phraseanet
# @run # @run
RABBITMQ_IMAGE_VERSION=rabbitmq:4.1.0-management RABBITMQ_IMAGE_TAG=rabbitmq:4.1.0-management
# --- Gateway settings (Nginx) ----------------------------------------------------------------------------------------- # --- Gateway settings (Nginx) -----------------------------------------------------------------------------------------
@@ -580,6 +580,17 @@ DB_BACKUP_CRON_TIME=
# @run # @run
DB_BACKUP_GZIP_LEVEL=9 DB_BACKUP_GZIP_LEVEL=9
# --- redis cache settings ---------------------------------------------------------------------------------------------
# Redis session Image Tag.
# @run
REDIS_CACHE_IMAGE_TAG=redis:8.0.1
# --- redis session settings ---------------------------------------------------------------------------------------------
# Redis cache Image Tag.
# @run
REDIS_SESSION_IMAGE_TAG=redis:8.0.1
# --- Pusher Settings --- # --- Pusher Settings ---
# Phraseanet use the Pusher service to notify users of asynchronous downloads https://pusher.com. # Phraseanet use the Pusher service to notify users of asynchronous downloads https://pusher.com.

View File

@@ -1,18 +1,39 @@
services: services:
db: db:
image: $PHRASEANET_DOCKER_REGISTRY/phraseanet-db:$PHRASEANET_DOCKER_TAG
build: ./docker/db
restart: on-failure
profiles: ["db-volume-container"]
environment:
- MYSQL_ROOT_PASSWORD
- MYSQL_MAX_ALLOWED_PACKET
- MYSQL_MAX_CONNECTION
- MYSQL_LONG_QUERY_TIME
- MYSQL_SLOW_QUERY_LOG
- MYSQL_QUERY_CACHE_LIMIT
- MYSQL_QUERY_CACHE_SIZE
- MYSQL_KEY_BUFFER_SIZE
- MYSQL_CONNECT_TIMEOUT
- MYSQL_WAIT_TIMEOUT
- MARIADB_AUTO_UPGRADE
volumes:
- db_vol:/var/lib/mysql
networks:
- internal
db-mysql8:
image: mysql:8.0.36-debian image: mysql:8.0.36-debian
# NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password # NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
# (this is just an example, not intended to be a production configuration) # (this is just an example, not intended to be a production configuration)
command: --default-authentication-plugin=mysql_native_password --max_allowed_packet=$MYSQL_MAX_ALLOWED_PACKET --max_connections=$MYSQL_MAX_CONNECTION --long_query_time=$MYSQL_LONG_QUERY_TIME --sql_mode="NO_ENGINE_SUBSTITUTION" command: --default-authentication-plugin=mysql_native_password --max_allowed_packet=$MYSQL_MAX_ALLOWED_PACKET --max_connections=$MYSQL_MAX_CONNECTION --long_query_time=$MYSQL_LONG_QUERY_TIME --sql_mode="NO_ENGINE_SUBSTITUTION"
restart: on-failure restart: on-failure
profiles: ["mysql8"] profiles: ["db-mysql8"]
entrypoint: entrypoint:
sh -c " sh -c \"
echo 'CREATE DATABASE IF NOT EXISTS ab_master CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE IF NOT EXISTS db_databox1 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE IF NOT EXISTS db_unitTest CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE IF NOT EXISTS db_dataset1 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE IF NOT EXISTS db_dataset2 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER `$PHRASEANET_DB_USER`@`%` IDENTIFIED BY \"$PHRASEANET_DB_PASSWORD\";GRANT ALL PRIVILEGES ON *.* to `$PHRASEANET_DB_USER`@`%`;' > /docker-entrypoint-initdb.d/init.sql; echo 'CREATE DATABASE IF NOT EXISTS ab_master CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE IF NOT EXISTS db_databox1 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE IF NOT EXISTS db_unitTest CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE IF NOT EXISTS db_dataset1 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE IF NOT EXISTS db_dataset2 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER `$PHRASEANET_DB_USER`@`%` IDENTIFIED BY \"$PHRASEANET_DB_PASSWORD\";GRANT ALL PRIVILEGES ON *.* to `$PHRASEANET_DB_USER`@`%`;' > /docker-entrypoint-initdb.d/init.sql;
chmod +x /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/init.sql; chmod +x /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/init.sql;
/usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --default-authentication-plugin=mysql_native_password --max_allowed_packet=$MYSQL_MAX_ALLOWED_PACKET --max_connections=$MYSQL_MAX_CONNECTION --long_query_time=$MYSQL_LONG_QUERY_TIME --sql_mode="NO_ENGINE_SUBSTITUTION" --slow_query_log=$MYSQL_SLOW_QUERY_LOG /usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --default-authentication-plugin=mysql_native_password --max_allowed_packet=$MYSQL_MAX_ALLOWED_PACKET --max_connections=$MYSQL_MAX_CONNECTION --long_query_time=$MYSQL_LONG_QUERY_TIME --sql_mode="NO_ENGINE_SUBSTITUTION" --slow_query_log=$MYSQL_SLOW_QUERY_LOG
" \"
environment: environment:
- MYSQL_ROOT_PASSWORD - MYSQL_ROOT_PASSWORD
- MYSQL_MAX_ALLOWED_PACKET - MYSQL_MAX_ALLOWED_PACKET
@@ -27,4 +48,7 @@ services:
volumes: volumes:
- ${PHRASEANET_DB_DIR}_mysql8:/var/lib/mysql:rw - ${PHRASEANET_DB_DIR}_mysql8:/var/lib/mysql:rw
networks: networks:
- internal internal:
aliases:
- db

View File

@@ -22,7 +22,7 @@ services:
- internal - internal
rabbitmq: rabbitmq:
image: $RABBITMQ_IMAGE_VERSION image: $RABBITMQ_IMAGE_TAG
profiles: ["rabbitmq"] profiles: ["rabbitmq"]
restart: on-failure restart: on-failure
hostname: $RABBITMQ_HOSTNAME hostname: $RABBITMQ_HOSTNAME
@@ -35,14 +35,14 @@ services:
- internal - internal
redis: redis:
image: redis image: $REDIS_CACHE_IMAGE_TAG
profiles: ["redis"] profiles: ["redis"]
restart: on-failure restart: on-failure
networks: networks:
- internal - internal
redis-session: redis-session:
image: redis image: $REDIS_SESSION_IMAGE_TAG
profiles: ["redis-session"] profiles: ["redis-session"]
restart: on-failure restart: on-failure
networks: networks:

View File

@@ -28,8 +28,6 @@ services:
restart: on-failure restart: on-failure
ports: ports:
- ${PHRASEANET_PHPMYADMIN_PORT}:80 - ${PHRASEANET_PHPMYADMIN_PORT}:80
depends_on:
- db
networks: networks:
- internal - internal