I use a self-hosted Monica instance to keep on top of birthdays and other useful/interesting notes about friends and family.
This note documents my setup.
Create a docker-compose.yml file:
version: "3.4"
services:
monica:
image: monica:latest
depends_on:
- monicadb
environment:
- APP_KEY=CHANGEME
- DB_HOST=monicadb
- APP_ENV=nonprod # See note below
- APP_URL=http://CHANGEME
- APP_TRUSTED_PROXIES=*
- MAIL_DRIVER=smtp
- MAIL_HOST=CHANGEME
- MAIL_PORT=587
- MAIL_USERNAME=CHANGEME
- MAIL_PASSWORD=CHANGEME
- MAIL_ENCRYPTION=tls
- MAIL_FROM_ADDRESS=CHANGEME
- MAIL_FROM_NAME=Monica
volumes:
- ./monica_data:/var/www/html/storage
restart: always
ports:
- 8082:80
monicadb:
image: mysql:5.7
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=true
- MYSQL_DATABASE=monica
- MYSQL_USER=homestead
- MYSQL_PASSWORD=CHANGEME
volumes:
- ./mysql:/var/lib/mysql
restart: always
Note on APP_ENV
When running with APP_ENV=production, Monica enforces HTTPS connections. I run Monica in my Tailscale network without TLS certificates, and so I run Monica in nonprod (which I made up) mode to allow this to work.
As far as I can tell, everything still seems to work OK.
If you run Monica behind a reverse-proxy for which you can configure TLS certficates, you can leave this as production.
Using the app
Bring the service up and navigate to the address you gave it to get started.