Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron setup between the 3 roles in the example compose #300

Open
zienhiet opened this issue Nov 20, 2024 · 0 comments
Open

Cron setup between the 3 roles in the example compose #300

zienhiet opened this issue Nov 20, 2024 · 0 comments

Comments

@zienhiet
Copy link

I need some education on how the three roles in the example compose work together, specifically on sending emails using doctrine. I have the docker services running and sending emails using doctrine://default. However, regardless of what I have in /opt/mautic/cron/mautic, the emails send immediately, not waiting on the cron timing. I'm sure I'm just not going about it the right way, but I don't know where I'm going wrong.

Thank you for the help.

Here's my compose:

x-mautic-volumes:
  &mautic-volumes
  - /home/docker/mautic5/mautic/config:/var/www/html/config:z
  - /home/docker/mautic5/mautic/logs:/var/www/html/var/logs:z
  - /home/docker/mautic5/mautic/media/files:/var/www/html/docroot/media/files:z
  - /home/docker/mautic5/mautic/media/images:/var/www/html/docroot/media/images:z
  - /home/docker/mautic5/cron:/opt/mautic/cron:z

services:
  db:
    image: mysql:8
    environment:
      - MYSQL_ROOT_PASSWORD=********
      - MYSQL_DATABASE=mautic_db
      - MYSQL_USER=mautic_db_user
      - MYSQL_PASSWORD=*********
      - MYSQL_TCP_PORT=3307
    volumes:
      - mysql-data:/var/lib/mysql
    restart: unless-stopped
    healthcheck:
      test: mysqladmin --user=mautic_db_user --password=mautic_db_pwd ping
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 10

  mautic_web:
    image: mautic/mautic:5.1.1-apache
    links:
      - db:mysql
    ports:
      - 8007:80
    volumes: *mautic-volumes
    restart: unless-stopped
    
    environment:
      - DOCKER_MAUTIC_LOAD_TEST_DATA=false
      - DOCKER_MAUTIC_RUN_MIGRATIONS=false
      - MAUTIC_DB_HOST=db.mautic5-docker
      - MAUTIC_DB_PORT=3307
      - MAUTIC_DB_DATABASE=mautic_db
      - MAUTIC_DB_USER=mautic_db_user
      - MAUTIC_DB_PASSWORD=**********
    
    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.1.1-apache
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_cron
      - DOCKER_MAUTIC_LOAD_TEST_DATA=false
      - DOCKER_MAUTIC_RUN_MIGRATIONS=false
      - MAUTIC_DB_HOST=db.mautic5-docker
      - MAUTIC_DB_PORT=3307
      - MAUTIC_DB_DATABASE=mautic_db
      - MAUTIC_DB_USER=mautic_db_user
      - MAUTIC_DB_PASSWORD=**********
    depends_on:
      mautic_web:
        condition: service_healthy
    networks:
      - default

  mautic_worker:
    image: mautic/mautic:5.1.1-apache
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_worker
      - DOCKER_MAUTIC_LOAD_TEST_DATA=false
      - DOCKER_MAUTIC_RUN_MIGRATIONS=false
      - MAUTIC_DB_HOST=db.mautic5-docker
      - MAUTIC_DB_PORT=3307
      - MAUTIC_DB_DATABASE=mautic_db
      - MAUTIC_DB_USER=mautic_db_user
      - MAUTIC_DB_PASSWORD=**********
    depends_on:
      mautic_web:
        condition: service_healthy
    networks:
      - default

volumes:
  mysql-data:

networks:
  default:
    name: mautic5-docker

Here's my /opt/mautic/cron/mautic

0,15,30,45 * * * * php /var/www/html/bin/console mautic:segments:update 2>&1 | tee /tmp/stdout
1,16,31,46 * * * * php /var/www/html/bin/console mautic:campaigns:update 2>&1 | tee /tmp/stdout
2,17,32,47 * * * * php /var/www/html/bin/console mautic:campaigns:trigger 2>&1 | tee /tmp/stdout
3,18,33,48 * * * * php /var/www/html/bin/console messenger:consume email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant