3.0 KiB
Docker examples for Monica
In this section you will find some examples about how to use monica's docker images.
| Example | Description |
|---|---|
supervisor |
uses supervisor to run a cron and a queue inside your container. |
nginx-proxy-self-signed-ssl |
shows you how to run monica with a self signed ssl certificate. |
nginx-proxy |
shows you how to run monica with https and generate a Let's Encrypt certificate. |
maxsize |
shows you how to adapt the max upload size of you php settings in the app container. |
Run with docker-compose
Configuration (all versions)
First, download a copy of Monica example configuration file:
curl -sS https://raw.githubusercontent.com/monicahq/monica/master/.env.example -o .env
Open the file in an editor and update it for your own needs:
- Set
APP_KEYto a random 32-character string. For example, if you have thepwgenutility installed, you could copy and paste the output ofpwgen -s 32 1. - Edit the
MAIL_*settings to point to your own mailserver. - Set
DB_*settings to point to your database configuration. If you don't want to set a db prefix, be careful to setDB_PREFIX=and notDB_PREFIX=''as docker will not expand this as an empty string. - Set
DB_HOST=dbor any name of the database container you will link to.
With supervisor
The supervisor examples shows you how to run monica with
- a db container (mysql:5.7)
- an app container, which run
supervisordto handle a web server/fpm, a cron, and a queue.
This let you use QUEUE_CONNECTION=database in your .env file.
With nginx proxy and a self-signed certificate
nginx-proxy-self-signed-ssl example shows you how to run monica with a self signed ssl certificate, to run the application in https mode.
Set VIRTUAL_HOST and SSL_SUBJECT with the right domain name, and update SSL_KEY, SSL_CSR, and SSL_CERT accordingly.
This example generates a new self-signed certificate.
Your browser might warn you about security issue, as a self-signed certificate is not trusted in production mode. For a real domain certificate, see the next section.
With nginx proxy and a Let's Encrypt certificate
nginx-proxy example shows you how to run monica and generate a Let's Encrypt certificate for your domain.
Don't forget to set:
VIRTUAL_HOSTandLETSENCRYPT_HOSTwith your domainLETSENCRYPT_EMAILwith a valid emailAPP_URLin your.envfile with the right domain url
You may want to set APP_ENV=production to force the use of https scheme.
This example add a redis container, that can be used too, adding these variables to your .env file:
REDIS_HOST=redis: mandatoryCACHE_DRIVER=redis: to use redis as a cache tableQUEUE_CONNECTION=redis: to use redis as a queue table