diff --git a/.gitignore b/.gitignore index a80757cb..92c93de4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ deploy-test-m3-apache.sh examples/*/* !examples/*/.env !examples/*/.mautic_env -!examples/*/docker-compose.yml \ No newline at end of file +!examples/*/*compose.yml +!examples/*/*compose.yaml +!examples/basic-with-redis-cache/mautic/config/local.php diff --git a/examples/basic-with-redis-cache/.env b/examples/basic-with-redis-cache/.env new file mode 100644 index 00000000..48e59423 --- /dev/null +++ b/examples/basic-with-redis-cache/.env @@ -0,0 +1,12 @@ +COMPOSE_PROJECT_NAME=redis-cache +COMPOSE_NETWORK=${COMPOSE_PROJECT_NAME}-docker +MYSQL_HOST=db.${COMPOSE_NETWORK} +MYSQL_PORT=3306 +MYSQL_DATABASE=mautic_db +MYSQL_USER=mautic_db_user +MYSQL_PASSWORD=mautic_db_pwd +MYSQL_ROOT_PASSWORD=changeme +DOCKER_MAUTIC_RUN_MIGRATIONS=false +DOCKER_MAUTIC_LOAD_TEST_DATA=false +REDIS_HOST=redis.${COMPOSE_NETWORK} +REDIS_PORT=6379 diff --git a/examples/basic-with-redis-cache/.mautic_env b/examples/basic-with-redis-cache/.mautic_env new file mode 100644 index 00000000..7f1d356e --- /dev/null +++ b/examples/basic-with-redis-cache/.mautic_env @@ -0,0 +1,14 @@ +# use this file for environment variables that can be used. +# see https://docs.mautic.org/en/5.x/ + +MAUTIC_DB_HOST="${MYSQL_HOST}" +MAUTIC_DB_PORT="${MYSQL_PORT}" +MAUTIC_DB_DATABASE="${MYSQL_DATABASE}" +MAUTIC_DB_USER="${MYSQL_USER}" +MAUTIC_DB_PASSWORD="${MYSQL_PASSWORD}" + +MAUTIC_REDIS_HOST="${REDIS_HOST}" +MAUTIC_REDIS_PORT="${REDIS_PORT}" + +MAUTIC_MESSENGER_DSN_EMAIL="doctrine://default" +MAUTIC_MESSENGER_DSN_HIT="doctrine://default" diff --git a/examples/basic-with-redis-cache/compose.yaml b/examples/basic-with-redis-cache/compose.yaml new file mode 100644 index 00000000..b1c9f155 --- /dev/null +++ b/examples/basic-with-redis-cache/compose.yaml @@ -0,0 +1,89 @@ +x-mautic-volumes: &mautic-volumes + - ./mautic/config:/var/www/html/config:z + - ./mautic/logs:/var/www/html/var/logs:z + - ./mautic/media/files:/var/www/html/docroot/media/files:z + - ./mautic/media/images:/var/www/html/docroot/media/images:z + - ./cron:/opt/mautic/cron:z + +services: + mautic_worker: + image: mautic/mautic:5-apache + links: + - db:mysql + volumes: *mautic-volumes + environment: + - DOCKER_MAUTIC_ROLE=mautic_worker + env_file: + - .mautic_env + depends_on: + mautic_web: + condition: service_healthy + networks: + - default + mautic_web: + image: mautic/mautic:5-apache + links: + - db:mysql + ports: + - 8001:80 + volumes: *mautic-volumes + + environment: + - DOCKER_MAUTIC_LOAD_TEST_DATA=${DOCKER_MAUTIC_LOAD_TEST_DATA} + - DOCKER_MAUTIC_RUN_MIGRATIONS=${DOCKER_MAUTIC_RUN_MIGRATIONS} + env_file: + - .mautic_env + healthcheck: + test: curl http://localhost + start_period: 5s + interval: 5s + timeout: 5s + retries: 100 + depends_on: + db: + condition: service_healthy + networks: + - default + mautic_cron: + image: mautic/mautic:5-apache + links: + - db:mysql + volumes: *mautic-volumes + environment: + - DOCKER_MAUTIC_ROLE=mautic_cron + env_file: + - .mautic_env + depends_on: + mautic_web: + condition: service_healthy + networks: + - default + db: + image: mysql:8.0 + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + volumes: + - mysql-data:/var/lib/mysql + healthcheck: + test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD ping + start_period: 5s + interval: 5s + timeout: 5s + retries: 10 + networks: + - default + redis: + image: redis:8 + networks: + - default + +volumes: + mysql-data: + + +networks: + default: + name: ${COMPOSE_PROJECT_NAME}-docker diff --git a/examples/basic-with-redis-cache/mautic/config/local.php b/examples/basic-with-redis-cache/mautic/config/local.php new file mode 100644 index 00000000..99dc4ec2 --- /dev/null +++ b/examples/basic-with-redis-cache/mautic/config/local.php @@ -0,0 +1,26 @@ + 'pdo_mysql', + 'db_host' => getenv('MAUTIC_DB_HOST'), + 'db_port' => getenv('MAUTIC_DB_PORT'), + 'db_name' => getenv('MAUTIC_DB_DATABASE'), + 'db_user' => getenv('MAUTIC_DB_USER'), + 'db_password' => getenv('MAUTIC_DB_PASSWORD'), + 'db_table_prefix' => null, + 'db_backup_tables' => 1, + 'db_backup_prefix' => 'bak_', + 'cache_adapter' => 'mautic.cache.adapter.redis', + 'cache_prefix' => 'app_cache', + 'cache_lifetime' => 86400, + 'cache_adapter_redis' => array( + 'dsn' => 'redis://'.getenv('MAUTIC_REDIS_HOST').':'.getenv('MAUTIC_REDIS_PORT'), + 'options' => array( + 'lazy' => '', + 'persistent' => '0', + 'persistent_id' => '', + 'timeout' => '30', + 'read_timeout' => '0', + 'retry_interval' => '0' + ) + ), +);