From d29a579cce1b9cb95621764dd14703f8f8ee2f91 Mon Sep 17 00:00:00 2001 From: Noel Light-Hilary Date: Wed, 9 Aug 2023 19:34:13 +0100 Subject: [PATCH] =?UTF-8?q?INFRA-107=20=E2=80=93=20commit=20local=20WIP=20?= =?UTF-8?q?bits=20on=20a=20temporary=20branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 5 ++++- apache-conf/redirects.conf | 1 + entrypoint.sh | 15 ++++++++++----- secrets_entrypoint.sh | 14 +++++++------- 4 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 apache-conf/redirects.conf diff --git a/Dockerfile b/Dockerfile index b33242ad..c33e097c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ COPY ./secrets_entrypoint.sh /usr/local/etc/secrets_entrypoint.sh # Modify the standard Mautic index.php and the entrypoint which installs it, # to fix infinite redirect loops behind an ALB with SSL. -COPY ./alb-safe-index.php /usr/local/etc/alb-safe-index.php +#COPY ./alb-safe-index.php /usr/local/etc/alb-safe-index.php COPY ./entrypoint.sh /entrypoint.sh # Apply recommend PHP configuration for best stability and performance. @@ -43,6 +43,9 @@ RUN composer install --no-interaction --optimize-autoloader USER root +COPY ./apache-conf/redirects.conf /etc/apache2/conf-available/redirects.conf +RUN a2enconf redirects + EXPOSE 80 ENTRYPOINT /usr/local/etc/secrets_entrypoint.sh apache2-foreground diff --git a/apache-conf/redirects.conf b/apache-conf/redirects.conf new file mode 100644 index 00000000..284a558e --- /dev/null +++ b/apache-conf/redirects.conf @@ -0,0 +1 @@ +LogLevel debug diff --git a/entrypoint.sh b/entrypoint.sh index 7e0fd45e..0186e9ef 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -122,6 +122,11 @@ echo >&2 "====================================================================== echo >&2 echo >&2 +echo "configs are..." +ls -la /var/www/html/app/config +echo "local.php is..." +cat /var/www/html/app/config/local.php + if ! grep -Fq "secret_key" /var/www/html/app/config/local.php; then echo >&2 "========================================================================" echo >&2 "Mautic not currently installed (no secret_key in local.php)" @@ -217,11 +222,11 @@ fi ### Start Big Give ALB workaround ### # Fix redirect loop behind ALB. https://forum.mautic.org/t/mautic-redirect-loop/16990/3 -INDEX_FILE="/var/www/html/index.php" -if test -f "$INDEX_FILE"; then - cp /usr/local/etc/alb-safe-index.php "$INDEX_FILE" - echo >&2 "SSL modification applied" -fi +#INDEX_FILE="/var/www/html/index.php" +#if test -f "$INDEX_FILE"; then +# cp /usr/local/etc/alb-safe-index.php "$INDEX_FILE" +# echo >&2 "SSL modification applied" +#file ### End Big Give ALB workaround ### diff --git a/secrets_entrypoint.sh b/secrets_entrypoint.sh index 0dec474c..87d372df 100755 --- a/secrets_entrypoint.sh +++ b/secrets_entrypoint.sh @@ -4,13 +4,13 @@ # and is used to set up app secrets in ECS without exposing them as widely as using ECS env vars directly would. # Check that the environment variable has been set correctly -if [ -z "$SECRETS_BUCKET_NAME" ]; then - echo >&2 'error: missing SECRETS_BUCKET_NAME environment variable' - exit 1 -fi - -# Load the S3 secrets file contents into the environment variables -export $(aws s3 cp s3://${SECRETS_BUCKET_NAME}/secrets - | grep -v '^#' | xargs) +#if [ -z "$SECRETS_BUCKET_NAME" ]; then +# echo >&2 'error: missing SECRETS_BUCKET_NAME environment variable' +# exit 1 +#fi +# +## Load the S3 secrets file contents into the environment variables +#export $(aws s3 cp s3://${SECRETS_BUCKET_NAME}/secrets - | grep -v '^#' | xargs) # Call our copy of the Mautic entrypoint script then the e.g. start Apache CMD # (argument to entrypoint).