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..e7b92ef 100644 --- a/core/engine/docker-compose.override.yml +++ b/core/engine/docker-compose.override.yml @@ -4,14 +4,14 @@ # 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 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 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