Skip to content

Commit

Permalink
make loading test data and running migrations configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
mollux committed Jan 9, 2024
1 parent 08ea8f4 commit eff0560
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ VOLUME /var/www/html/docroot/media

WORKDIR /var/www/html/docroot

ENV MAUTIC_ROLE=mautic_web
ENV MAUTIC_ROLE=mautic_web \
MAUTIC_RUN_MIGRATIONS=false \
MAUTIC_LOAD_TEST_DATA=false

ENTRYPOINT ["/entrypoint.sh"]

Expand Down
5 changes: 5 additions & 0 deletions common/entrypoint_mautic_web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@ if [ "$MAUTIC_LOAD_TEST_DATA" = "true" ]; then
su -s /bin/bash www-data -c 'php /var/www/html/bin/console doctrine:fixtures:load -n'
fi

# run migrations
if [ "$MAUTIC_RUN_MIGRATIONS" = "true" ]; then
su -s /bin/bash www-data -c 'php /var/www/html/bin/console doctrine:migration:migrate -n'
fi

# execute the provided entrypoint
"$@"
2 changes: 2 additions & 0 deletions examples/basic/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ MYSQL_ROOT_PASSWORD=changeme
MYSQL_DATABASE=mautic_db
MYSQL_USER=mautic_db_user
MYSQL_PASSWORD=mautic_db_pwd
MAUTIC_RUN_MIGRATIONS=false
MAUTIC_LOAD_TEST_DATA=false
3 changes: 2 additions & 1 deletion examples/basic/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ services:
volumes: *mautic-volumes

environment:
- MAUTIC_LOAD_TEST_DATA=true
- MAUTIC_LOAD_TEST_DATA=${MAUTIC_LOAD_TEST_DATA}
- MAUTIC_RUN_MIGRATIONS=${MAUTIC_RUN_MIGRATIONS}
- MYSQL_HOST=${MYSQL_HOST}
- MYSQL_PORT=${MYSQL_PORT}
- MYSQL_DATABASE=${MYSQL_DATABASE}
Expand Down
2 changes: 2 additions & 0 deletions examples/fpm-nginx/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ MYSQL_ROOT_PASSWORD=changeme
MYSQL_DATABASE=mautic_db
MYSQL_USER=mautic_db_user
MYSQL_PASSWORD=mautic_db_pwd
MAUTIC_RUN_MIGRATIONS=false
MAUTIC_LOAD_TEST_DATA=false
2 changes: 2 additions & 0 deletions examples/fpm-nginx/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ services:
volumes: *mautic-volumes

environment:
- MAUTIC_LOAD_TEST_DATA=${MAUTIC_LOAD_TEST_DATA}
- MAUTIC_RUN_MIGRATIONS=${MAUTIC_RUN_MIGRATIONS}
- MAUTIC_LOAD_TEST_DATA=true
- MYSQL_HOST=${MYSQL_HOST}
- MYSQL_PORT=${MYSQL_PORT}
Expand Down
2 changes: 2 additions & 0 deletions examples/rabbitmq-worker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ MYSQL_ROOT_PASSWORD=changeme
MYSQL_DATABASE=mautic_db
MYSQL_USER=mautic_db_user
MYSQL_PASSWORD=mautic_db_pwd
MAUTIC_RUN_MIGRATIONS=false
MAUTIC_LOAD_TEST_DATA=false
2 changes: 2 additions & 0 deletions examples/rabbitmq-worker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ services:
volumes: *mautic-volumes

environment:
- MAUTIC_LOAD_TEST_DATA=${MAUTIC_LOAD_TEST_DATA}
- MAUTIC_RUN_MIGRATIONS=${MAUTIC_RUN_MIGRATIONS}
- MAUTIC_LOAD_TEST_DATA=true
- MYSQL_HOST=${MYSQL_HOST}
- MYSQL_PORT=${MYSQL_PORT}
Expand Down
4 changes: 3 additions & 1 deletion fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ VOLUME /var/www/html/docroot/media

WORKDIR /var/www/html/docroot

ENV MAUTIC_ROLE=mautic_web
ENV MAUTIC_ROLE=mautic_web \
MAUTIC_RUN_MIGRATIONS=false \
MAUTIC_LOAD_TEST_DATA=false

ENTRYPOINT ["/entrypoint.sh"]

Expand Down

0 comments on commit eff0560

Please sign in to comment.