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

Scheduled emails not working on self-install of Monica (no cron in container) #5084

Closed
cstrat opened this issue Apr 22, 2021 · 5 comments
Closed

Comments

@cstrat
Copy link

cstrat commented Apr 22, 2021

I've installed Monica via docker-compose.
Largely following the guide on docker-hub for the Apache version: https://hub.docker.com/_/monica
Things that appeared to be missing from that guide are the fact email config needs to be included in the app environment block in docker-compose. I did read the linked section on docker-compose, but I was't sure how downloading the example .env file would integrate with the docker setup. (https://github.com/monicahq/docker/tree/master/.examples)

Now my issue with scheduled emails not working is because cron is missing from the container.
The docker-compose example doesn't include any information on this.
It looks like crontab itself is setup correctly - just cron is not installed.

image

So I've manually installed cron inside the container (and had to manually start the service), but that manual step will need to be done each time I rebuild the container.

What is best practice here?

This is probably a very easy thing to do if I had a better understanding on how docker is supposed to be setup.
I'd be happy to help contribute to update the guide - but I don't know the most correct answer myself.

@cstrat cstrat changed the title Scheduled emails not working on self-instal of Monica (no cron in container) Scheduled emails not working on self-install of Monica (no cron in container) Apr 22, 2021
@cstrat
Copy link
Author

cstrat commented Apr 23, 2021

Ok strange but installing and running cron did not solve the issue. Still didn't receive a test email for a reminder.
I even tried to do the supervisord thing, but couldn't get that working using the build bit in the docker-compose file.
Guess I will be without notifications until I learn more about how this is plumbed together.

I got supervisord to install, I had to make some changes to my main docker-compose file.
Tomorrow I will see if my scheduled reminders come through.

@zeezhao
Copy link

zeezhao commented Apr 23, 2021

Hi. Also have a look at some of the comments in #4178, to see if related...

@peetersdaan
Copy link

Hey @cstrat and @zeezhao, today I reinstalled Monica with Supervisor in a new container but I'm also still running into this issue (see for more information monicahq/docker#48)
Screenshot 2021-04-23 at 19 27 19

@cstrat
Copy link
Author

cstrat commented Apr 26, 2021

Ok now that supervisord is installed it is all working with scheduled alerts working!
I'll close this issue and leave my setup information for anyone facing the same issue...

My issue can be summarised as me not understanding what docker was doing.
I did not understand what the build step was doing.
I hadn't download the build (app) directory for my docker-compose, so I wasn't running that step and I thought manual intervention was required.

FYI this is my docker-compose.yml file which works perfectly for me now.

version: "3.4"

services:
  app:
    build: ./setup
    image: monica-app
    depends_on:
      - db
    ports:
      - 8555:80
    environment:
      - APP_KEY=xxxx
      - DB_HOST=db
      - APP_ENV=production
      - APP_URL=xxxx
      - MAIL_MAILER=smtp
      - MAIL_HOST=smtp.mailgun.org
      - MAIL_PORT=587
      - MAIL_USERNAME=xxxx
      - MAIL_PASSWORD=xxxx
      - MAIL_ENCRYPTION=tls
      - MAIL_FROM_ADDRESS=xxxx
      - MAIL_FROM_NAME=Monica

    volumes:
      - ./app:/var/www/html/storage
    restart: always

  db:
    image: mysql:5.7
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=true
      - MYSQL_DATABASE=monica
      - MYSQL_USER=xxxx
      - MYSQL_PASSWORD=xxxx
    volumes:
      - ./db:/var/lib/mysql
    restart: always

In the directory ./setup I have the two files, Dockerfile and supervisord.conf copied form here.

You will notice I am not using the .env file, mainly because I got it working prior to realising that was an option - and I don't want to mess with it. Plus I think I've addressed the main env variables in the docker-compose.yml file.

In my setup, I now have a directory with my docker-compose file, the setup dir and my mounted volumes. So backing this up is quite simple, I just rsync the whole dir and I should be able to restore by just copying the whole folder.

@github-actions
Copy link

This issue has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants