From ad93c11c2e188c0253e0cb7eae11c54ff50ff857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 12 Jul 2017 23:42:13 +0200 Subject: [PATCH 1/9] [doctrine-bundle] Docker support --- doctrine/doctrine-bundle/1.6/manifest.json | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index c5e7da02..6f6c839c 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -10,7 +10,28 @@ "#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url", "#2": "For an SQLite database, use: \"sqlite:///%kernel.project_dir%/var/data.db\"", "#3": "For a PostgreSQL database, use: \"postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8\"", - "#4": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", + "#4": "For the Docker integration, use: \"mysql://symfony:ChangeMe@db:3306/app?serverVersion=mariadb-10.5\"", + "#5": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", "DATABASE_URL": "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7" + }, + "dockerfile": ["RUN docker-php-ext-install pdo_mysql"], + "docker-compose": { + "services": [ + "db:", + " image: mariadb:10.4", + " environment:", + " - MYSQL_DATABASE=app", + " # You should definitely change the password in production", + " - MYSQL_PASSWORD=ChangeMe", + " - MYSQL_RANDOM_ROOT_PASSWORD=true", + " - MYSQL_USER=symfony", + " volumes:", + " - db-data:/var/lib/mysql:rw", + " # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!", + " # - ./docker/db/data:/var/lib/mysql:rw", + " ports:", + " - \"3306\"" + ], + "volumes": ["db-data: {}"] } } From 823631318a89db90ea9fda464e16a35b645f9c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 15 Oct 2020 07:53:34 +0200 Subject: [PATCH 2/9] don't expose the port by default (security) --- doctrine/doctrine-bundle/1.6/manifest.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index 6f6c839c..c68dadbb 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -10,7 +10,7 @@ "#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url", "#2": "For an SQLite database, use: \"sqlite:///%kernel.project_dir%/var/data.db\"", "#3": "For a PostgreSQL database, use: \"postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8\"", - "#4": "For the Docker integration, use: \"mysql://symfony:ChangeMe@db:3306/app?serverVersion=mariadb-10.5\"", + "#4": "For the Docker integration, use: \"mysql://symfony:ChangeMe@db:3306/app?serverVersion=mariadb-10.5.6\"", "#5": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", "DATABASE_URL": "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7" }, @@ -18,7 +18,7 @@ "docker-compose": { "services": [ "db:", - " image: mariadb:10.4", + " image: mariadb:10.5.6", " environment:", " - MYSQL_DATABASE=app", " # You should definitely change the password in production", @@ -29,8 +29,9 @@ " - db-data:/var/lib/mysql:rw", " # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!", " # - ./docker/db/data:/var/lib/mysql:rw", - " ports:", - " - \"3306\"" + " # To expose the port publicly", + " # ports:", + " # - \"3306\"" ], "volumes": ["db-data: {}"] } From d246d096a44c656e2b44a1dd452ec6b8d80e9c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 21 Oct 2020 19:41:28 +0200 Subject: [PATCH 3/9] feat: improve MySQL --- doctrine/doctrine-bundle/1.6/manifest.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index c68dadbb..e8884e32 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -18,21 +18,21 @@ "docker-compose": { "services": [ "db:", - " image: mariadb:10.5.6", + " image: mariadb:${MARIADB_VERSION:-10.5.6}", " environment:", - " - MYSQL_DATABASE=app", + " MYSQL_DATABASE: ${MYSQL_DATABASE:-app}", " # You should definitely change the password in production", - " - MYSQL_PASSWORD=ChangeMe", - " - MYSQL_RANDOM_ROOT_PASSWORD=true", - " - MYSQL_USER=symfony", + " MYSQL_PASSWORD: ${MYSQL_PASSWORD:-ChangeMe}", + " MYSQL_RANDOM_ROOT_PASSWORD: \"true\"", + " MYSQL_USER: ${MYSQL_USER:-symfony}", " volumes:", " - db-data:/var/lib/mysql:rw", " # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!", " # - ./docker/db/data:/var/lib/mysql:rw", - " # To expose the port publicly", + " # To expose the port on the host", " # ports:", - " # - \"3306\"" + " # - \"3306:3306\"" ], - "volumes": ["db-data: {}"] + "volumes": ["db-data:"] } } From ade1a9c1cb5b654c179c752df5cb5d4c89ca83c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 21 Oct 2020 21:15:58 +0200 Subject: [PATCH 4/9] use a random port again --- doctrine/doctrine-bundle/1.6/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index e8884e32..2b814105 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -31,7 +31,7 @@ " # - ./docker/db/data:/var/lib/mysql:rw", " # To expose the port on the host", " # ports:", - " # - \"3306:3306\"" + " # - \"3306\"" ], "volumes": ["db-data:"] } From 6a91adfe6230f753d0175bcdbdba6e0f673acdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 21 Oct 2020 21:36:19 +0200 Subject: [PATCH 5/9] feat: switch to Postgres --- doctrine/doctrine-bundle/1.6/manifest.json | 27 ++++++++++--------- .../2.0/config/packages/doctrine.yaml | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index 2b814105..d7810c70 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -9,29 +9,32 @@ "env": { "#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url", "#2": "For an SQLite database, use: \"sqlite:///%kernel.project_dir%/var/data.db\"", - "#3": "For a PostgreSQL database, use: \"postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8\"", - "#4": "For the Docker integration, use: \"mysql://symfony:ChangeMe@db:3306/app?serverVersion=mariadb-10.5.6\"", + "#3": "For a MySQL database, use: \"mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7\"", "#5": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", - "DATABASE_URL": "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7" + "DATABASE_URL": "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8" }, - "dockerfile": ["RUN docker-php-ext-install pdo_mysql"], + "dockerfile": [ + "RUN apk add --no-cache --virtual .pgsql-deps postgresql-dev; \\", + "\tdocker-php-ext-install -j$(nproc) pdo_pgsql; \\", + "\tapk add --no-cache --virtual .pgsql-rundeps so:libpq.so.5; \\", + "\tapk del .pgsql-deps" + ], "docker-compose": { "services": [ "db:", - " image: mariadb:${MARIADB_VERSION:-10.5.6}", + " image: postgres:${POSTGRES_VERSION:-13}-alpine", " environment:", - " MYSQL_DATABASE: ${MYSQL_DATABASE:-app}", + " POSTGRES_DB: ${POSTGRES_DB:-app}", " # You should definitely change the password in production", - " MYSQL_PASSWORD: ${MYSQL_PASSWORD:-ChangeMe}", - " MYSQL_RANDOM_ROOT_PASSWORD: \"true\"", - " MYSQL_USER: ${MYSQL_USER:-symfony}", + " POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}", + " POSTGRES_USER: ${POSTGRES_USER:-symfony}", " volumes:", - " - db-data:/var/lib/mysql:rw", + " - db-data:/var/lib/postgresql/data:rw", " # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!", - " # - ./docker/db/data:/var/lib/mysql:rw", + " # - ./docker/db/data:/var/lib/postgresql/data:rw", " # To expose the port on the host", " # ports:", - " # - \"3306\"" + " # - \"5432\"" ], "volumes": ["db-data:"] } diff --git a/doctrine/doctrine-bundle/2.0/config/packages/doctrine.yaml b/doctrine/doctrine-bundle/2.0/config/packages/doctrine.yaml index 5e80e77b..c3191765 100644 --- a/doctrine/doctrine-bundle/2.0/config/packages/doctrine.yaml +++ b/doctrine/doctrine-bundle/2.0/config/packages/doctrine.yaml @@ -4,7 +4,7 @@ doctrine: # IMPORTANT: You MUST configure your server version, # either here or in the DATABASE_URL env var (see .env file) - #server_version: '5.7' + #server_version: '13' orm: auto_generate_proxy_classes: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware From c76a55f0e408c8b6030588c1d57ed2cf2ab50f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 9 Nov 2020 10:19:49 +0100 Subject: [PATCH 6/9] move the port definition in docker-compose.override.yml --- doctrine/doctrine-bundle/1.6/manifest.json | 38 +++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index d7810c70..e433759e 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -20,22 +20,28 @@ "\tapk del .pgsql-deps" ], "docker-compose": { - "services": [ - "db:", - " image: postgres:${POSTGRES_VERSION:-13}-alpine", - " environment:", - " POSTGRES_DB: ${POSTGRES_DB:-app}", - " # You should definitely change the password in production", - " POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}", - " POSTGRES_USER: ${POSTGRES_USER:-symfony}", - " volumes:", - " - db-data:/var/lib/postgresql/data:rw", - " # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!", - " # - ./docker/db/data:/var/lib/postgresql/data:rw", - " # To expose the port on the host", - " # ports:", - " # - \"5432\"" - ], + "docker-compose.yml": { + "services": [ + "db:", + " image: postgres:${POSTGRES_VERSION:-13}-alpine", + " environment:", + " POSTGRES_DB: ${POSTGRES_DB:-app}", + " # You should definitely change the password in production", + " POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}", + " POSTGRES_USER: ${POSTGRES_USER:-symfony}", + " volumes:", + " - db-data:/var/lib/postgresql/data:rw", + " # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!", + " # - ./docker/db/data:/var/lib/postgresql/data:rw" + ] + }, + "docker-compose.override.yml": { + "services": [ + "db:", + " ports:", + " - \"5432\"" + ] + }, "volumes": ["db-data:"] } } From 1951e0b054b081df832122202556bb10d094b7fa Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 17 Nov 2020 09:41:14 +0100 Subject: [PATCH 7/9] Rename db to database --- doctrine/doctrine-bundle/1.6/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index e433759e..d20b8ec6 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -22,7 +22,7 @@ "docker-compose": { "docker-compose.yml": { "services": [ - "db:", + "database:", " image: postgres:${POSTGRES_VERSION:-13}-alpine", " environment:", " POSTGRES_DB: ${POSTGRES_DB:-app}", From f3117928aaed97b655ba7df8228a5164bdbdd656 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 17 Nov 2020 09:46:18 +0100 Subject: [PATCH 8/9] Fix typo --- doctrine/doctrine-bundle/1.6/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index d20b8ec6..52902fd0 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -10,7 +10,7 @@ "#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url", "#2": "For an SQLite database, use: \"sqlite:///%kernel.project_dir%/var/data.db\"", "#3": "For a MySQL database, use: \"mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7\"", - "#5": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", + "#4": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", "DATABASE_URL": "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8" }, "dockerfile": [ From 9730ab4ae74b23f81117059a4a811b5d2980a91f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 17 Nov 2020 10:15:50 +0100 Subject: [PATCH 9/9] Fix syntax --- doctrine/doctrine-bundle/1.6/manifest.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.6/manifest.json index 52902fd0..59cf7429 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.6/manifest.json @@ -33,7 +33,8 @@ " - db-data:/var/lib/postgresql/data:rw", " # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!", " # - ./docker/db/data:/var/lib/postgresql/data:rw" - ] + ], + "volumes": ["db-data:"] }, "docker-compose.override.yml": { "services": [ @@ -41,7 +42,6 @@ " ports:", " - \"5432\"" ] - }, - "volumes": ["db-data:"] + } } }