From 89c784f1aedd222e51744ff053765efefd8d2b8f Mon Sep 17 00:00:00 2001 From: Stephan Kok Date: Tue, 8 Jul 2025 11:45:27 +0200 Subject: [PATCH 1/3] engine - compatible with symfony 4 upgrade --- core/.env.ci.dist | 3 ++- core/README.md | 15 +++++++++++++++ core/docker-compose.yml | 3 ++- core/engine/appconf.conf | 8 +++----- core/engine/docker-compose.override.yml | 4 ++-- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/core/.env.ci.dist b/core/.env.ci.dist index a72c7d2..7a2b012 100644 --- a/core/.env.ci.dist +++ b/core/.env.ci.dist @@ -1,2 +1,3 @@ APP_ENV=ci -SYMFONY_ENV=ci +APP_DEBUG=true +APP_SECRET=secret diff --git a/core/README.md b/core/README.md index 4fe9835..b0eae3a 100644 --- a/core/README.md +++ b/core/README.md @@ -85,3 +85,18 @@ To mount the code in multiple containers: `start-dev-env.sh profile:../../OpenConext-profile userlifecycle:../../OpenConext-user-lifecycle` You can add as many services+local code paths that you need. The recommended way is to use absolute paths and the script requires the name of the service and local code path to be separated by a `:`, for each service. + +# Tips + +To start engine in local development environment use from this directory; + +Ensure a file `.env` exists with: +```shell +APP_ENV=dev +APP_DEBUG=true +APP_SECRET=secret +``` +```shell +./start-dev-env.sh engine:../../OpenConext-engineblock/ +``` +To change the running env, just edit `APP_ENV=ci` for example and re-run `./start-dev-env.sh engine:../../OpenConext-engineblock/`. You do not have to recreate all services, only to reload engineblock. diff --git a/core/docker-compose.yml b/core/docker-compose.yml index 5b7534e..504d3fc 100644 --- a/core/docker-compose.yml +++ b/core/docker-compose.yml @@ -118,7 +118,8 @@ services: condition: service_healthy environment: - APP_ENV=${APP_ENV:-prod} - - SYMFONY_ENV=${APP_ENV:-prod} + - APP_DEBUG=${APP_ENV:-false} + - APP_SECRET=${APP_SECRET:?APP_SECRET is not set} profile: image: ghcr.io/openconext/openconext-profile/profile:prod diff --git a/core/engine/appconf.conf b/core/engine/appconf.conf index 66f2521..9e8111c 100644 --- a/core/engine/appconf.conf +++ b/core/engine/appconf.conf @@ -1,21 +1,19 @@ -DocumentRoot /var/www/html/web +DocumentRoot /var/www/html/public ServerName engine SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 - + Require all granted Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.*)$ app.php [QSA,L] + RewriteRule ^(.*)$ index.php [QSA,L] Header always set X-Content-Type-Options "nosniff" SetEnv HTTPS on -#SetEnv ENGINEBLOCK_ENV dev -#SetEnv SYMFONY_ENV dev RewriteEngine On # We support only GET/POST diff --git a/core/engine/docker-compose.override.yml b/core/engine/docker-compose.override.yml index fdc6a68..17a1a7f 100644 --- a/core/engine/docker-compose.override.yml +++ b/core/engine/docker-compose.override.yml @@ -10,8 +10,8 @@ services: - ./engine/appconf.conf:/etc/apache2/sites-enabled/appconf.conf environment: - APP_ENV=${APP_ENV:-dev} - - SYMFONY_ENV=${APP_ENV:-dev} - - APP_DEBUG=1 + - APP_DEBUG=${APP_DEBUG:-true} + - APP_SECRET=${APP_SECRET:-secret} healthcheck: test: ["CMD", "true"] interval: 10s From 8ea2701e820d16d3a60b7d10714674bff9815ad4 Mon Sep 17 00:00:00 2001 From: Johan Kromhout Date: Tue, 16 Sep 2025 12:05:27 +0200 Subject: [PATCH 2/3] PHP 8.2 --- core/engine/docker-compose.override.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/engine/docker-compose.override.yml b/core/engine/docker-compose.override.yml index 17a1a7f..e7b92ef 100644 --- a/core/engine/docker-compose.override.yml +++ b/core/engine/docker-compose.override.yml @@ -4,7 +4,7 @@ # the container. It will destroy the sub-mount!! services: engine: - image: ghcr.io/openconext/openconext-basecontainers/${ENGINE_PHP_IMAGE:-php72-apache2-node14-composer2:latest} + image: ghcr.io/openconext/openconext-basecontainers/${ENGINE_PHP_IMAGE:-php82-apache2-node20-composer2:latest} volumes: - ${ENGINE_CODE_PATH}:/var/www/html - ./engine/appconf.conf:/etc/apache2/sites-enabled/appconf.conf From c5b3fd51b2dbf9b1b153972bfa82595128cfc55b Mon Sep 17 00:00:00 2001 From: Johan Kromhout Date: Wed, 24 Sep 2025 14:12:18 +0200 Subject: [PATCH 3/3] Use bin/console & var/cache instead of app/console & app/cache --- core/scripts/init.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/scripts/init.sh b/core/scripts/init.sh index 2ff088a..3abb776 100755 --- a/core/scripts/init.sh +++ b/core/scripts/init.sh @@ -18,16 +18,16 @@ docker compose exec engine timeout 300 bash -c 'while [[ "$(curl -k -s -o /dev/n echo -e "${ORANGE}First, we will initialise the EB database$NOCOLOR ${GREEN}\xE2\x9C\x94${NOCOLOR}" echo "Checking if the database is already present" -if ! docker compose exec engine /var/www/html/app/console doctrine:schema:validate -q --skip-mapping --env=prod; then +if ! docker compose exec engine /var/www/html/bin/console doctrine:schema:validate -q --skip-mapping --env=prod; then echo creating the database schema - echo "Executing docker compose exec engine /var/www/html/app/console doctrine:schema:create --env prod" - docker compose exec engine /var/www/html/app/console doctrine:schema:create --env prod + echo "Executing docker compose exec engine /var/www/html/bin/console doctrine:schema:create --env prod" + docker compose exec engine /var/www/html/bin/console doctrine:schema:create --env prod # TODO: Use migrations instead of schema:create. Not both. @see https://github.com/OpenConext/OpenConext-engineblock/issues/1861 fi echo "Clearing the cache" -echo "Executing docker compose exec engine /var/www/html/app/console cache:clear -n --env=prod" -docker compose exec engine /var/www/html/app/console cache:clear -n --env=prod -docker compose exec engine chown -R www-data:www-data /var/www/html/app/cache/ +echo "Executing docker compose exec engine /var/www/html/bin/console cache:clear -n --env=prod" +docker compose exec engine /var/www/html/bin/console cache:clear -n --env=prod +docker compose exec engine chown -R www-data:www-data /var/www/html/var/cache/ # Now it's time to bootstrap manage # Bring up containers needed for bootstrapping manage