From 199e6b0df4e5f8b90f6abb066fdfb3c3c34c8a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Mon, 20 Jul 2020 12:32:17 +0200 Subject: [PATCH] EZP-31744: Added DATABASE_VERSION variable to .env (#576) * EZP-31744: Added DATABASE_VERSION variable to .env * EZP-31744: Fixed type in env variable name * EZP-31744: Added DATABASE_VERSION to doc/docker/{base-dev.yml,base-prod.yml,install_script.sh} --- .env | 8 ++++++-- doc/docker/base-dev.yml | 1 + doc/docker/base-prod.yml | 1 + doc/docker/install_script.sh | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.env b/.env index aeee24c827..d26e6e977d 100644 --- a/.env +++ b/.env @@ -67,6 +67,9 @@ DATABASE_HOST=db DATABASE_PORT=3306 DATABASE_PLATFORM=mysql DATABASE_DRIVER=pdo_mysql +# Needed by Doctrine Bundle / ORM to avoid it opening connection during situations where there is no service yet. +# See: https://symfony.com/doc/current/reference/configuration/doctrine.html#doctrine-dbal-configuration +DATABASE_VERSION=mariadb-10.3.0 # Doctrine DBAL Schema DATABASE_CHARSET=utf8mb4 @@ -86,8 +89,9 @@ APP_SECRET=ff6dc61a329dc96652bb092ec58981f7 ###> doctrine/doctrine-bundle ### # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" -# Configure your db driver and server_version in config/packages/doctrine.yaml -DATABASE_URL=${DATABASE_PLATFORM}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME} +# For a PostgreSQL database, use:\"postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8" +# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml +DATABASE_URL=${DATABASE_PLATFORM}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}?serverVersion=${DATABASE_VERSION} ###< doctrine/doctrine-bundle ### ###> symfony/swiftmailer-bundle ### diff --git a/doc/docker/base-dev.yml b/doc/docker/base-dev.yml index 3c831498d1..518dc231ff 100644 --- a/doc/docker/base-dev.yml +++ b/doc/docker/base-dev.yml @@ -21,6 +21,7 @@ services: - DATABASE_PASSWORD - DATABASE_NAME - DATABASE_HOST=db + - DATABASE_VERSION - RECOMMENDATIONS_CUSTOMER_ID - RECOMMENDATIONS_LICENSE_KEY - PUBLIC_SERVER_URI diff --git a/doc/docker/base-prod.yml b/doc/docker/base-prod.yml index c856ddc89b..618f1b9e30 100644 --- a/doc/docker/base-prod.yml +++ b/doc/docker/base-prod.yml @@ -22,6 +22,7 @@ services: - DATABASE_PASSWORD - DATABASE_NAME - DATABASE_HOST=db + - DATABASE_VERSION - RECOMMENDATIONS_CUSTOMER_ID - RECOMMENDATIONS_LICENSE_KEY - PUBLIC_SERVER_URI diff --git a/doc/docker/install_script.sh b/doc/docker/install_script.sh index 22645811cc..2ae75cbfb4 100755 --- a/doc/docker/install_script.sh +++ b/doc/docker/install_script.sh @@ -13,7 +13,7 @@ fi mkdir -p public/var if [ "${INSTALL_DATABASE}" == "1" ]; then - export DATABASE_URL=${DATABASE_PLATFORM}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME} + export DATABASE_URL=${DATABASE_PLATFORM}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}?serverVersion=${DATABASE_VERSION} php /scripts/wait_for_db.php composer ezplatform-install