Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
INFRA-107 – commit local WIP bits on a temporary branch
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelLH committed Aug 9, 2023
1 parent af6bdfe commit d29a579
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
1 change: 1 addition & 0 deletions apache-conf/redirects.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LogLevel debug
15 changes: 10 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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 ###

Expand Down
14 changes: 7 additions & 7 deletions secrets_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit d29a579

Please sign in to comment.