Self-Hosting Monica CRM with Docker Compose
If you struggle to remember birthdays, keep track of who you last talked to, or recall what someone’s kids are named — Monica was built for exactly that problem. It’s a personal CRM that helps you organize your relationships the way a sales CRM organizes leads, except the “leads” are your actual friends and family.
Monica replaces scattered notes, forgotten conversations, and the guilt of losing touch. Unlike corporate CRMs like Salesforce or HubSpot, Monica focuses on personal relationships — logging calls, tracking gift ideas, remembering important dates, and journaling interactions.
Prerequisites
- A Linux server (Ubuntu 22.04+ recommended)
- Docker and Docker Compose installed (guide)
- 1 GB of free RAM (minimum)
- 2 GB of free disk space
- A domain name (optional, for remote access)
Updated March 2026: Verified with latest Docker images and configurations.
Docker Compose Configuration
Create a docker-compose.yml file:
services:
monica:
image: monica:4.1.2-apache
container_name: monica
restart: unless-stopped
depends_on:
db:
condition: service_healthy
ports:
- "8085:80"
environment:
- APP_ENV=production
- APP_DEBUG=false
- APP_KEY=${APP_KEY}
- APP_URL=${APP_URL}
- APP_TRUSTED_PROXIES=*
- DB_CONNECTION=mysql
- DB_HOST=db
- DB_PORT=3306
- DB_DATABASE=monica
- DB_USERNAME=monica
- DB_PASSWORD=${DB_PASSWORD}
- CACHE_STORE=database
- SESSION_DRIVER=database
- QUEUE_CONNECTION=sync
- MAIL_MAILER=log
volumes:
- monica-storage:/var/www/html/storage
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
db:
image: mariadb:10.11
container_name: monica-db
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=monica
- MYSQL_USER=monica
- MYSQL_PASSWORD=${DB_PASSWORD}
volumes:
- monica-db:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
volumes:
monica-storage:
monica-db:
Create a .env file alongside:
# Generate with: echo "base64:$(openssl rand -base64 32)"
APP_KEY=base64:CHANGE_ME_GENERATE_A_REAL_KEY
# URL where Monica will be accessed
APP_URL=http://localhost:8085
# Database passwords — change these
DB_PASSWORD=change-me-strong-password
MYSQL_ROOT_PASSWORD=change-me-root-password
Start the stack:
docker compose up -d
Initial Setup
After the containers start, Monica runs database migrations automatically on first boot. This takes 30-60 seconds. Access the web UI at http://your-server:8085.
- Click Register to create your first account
- Fill in your name, email, and password
- After registration, you’ll land on the dashboard
To disable public registration after creating your account, add APP_DISABLE_SIGNUP=true to the Monica service environment variables and restart.
Configuration
| Setting | Variable | Default | Description |
|---|---|---|---|
| Application URL | APP_URL | — | Must match how users access Monica |
| Debug mode | APP_DEBUG | false | Never enable in production |
| Registration | APP_DISABLE_SIGNUP | false | Set true after creating your account |
| Mail driver | MAIL_MAILER | log | Set to smtp for email notifications |
| Cache | CACHE_STORE | database | Use redis for better performance |
| Queue | QUEUE_CONNECTION | sync | Use redis for background processing |
Email Configuration
For birthday reminders and notifications, configure SMTP:
environment:
- MAIL_MAILER=smtp
- MAIL_HOST=smtp.gmail.com
- MAIL_PORT=587
- [email protected]
- MAIL_PASSWORD=your-app-password
- MAIL_ENCRYPTION=tls
- [email protected]
- MAIL_FROM_NAME=Monica
Advanced Configuration
Adding Redis for Performance
For faster caching and background job processing:
services:
redis:
image: redis:7-alpine
container_name: monica-redis
restart: unless-stopped
volumes:
- monica-redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
volumes:
monica-redis:
Then update Monica’s environment:
environment:
- CACHE_STORE=redis
- REDIS_HOST=redis
- REDIS_PORT=6379
- QUEUE_CONNECTION=redis
Full-Text Search with Meilisearch
For fast search across contacts:
services:
meilisearch:
image: getmeili/meilisearch:v1.6
container_name: monica-search
restart: unless-stopped
environment:
- MEILI_NO_ANALYTICS=true
volumes:
- monica-search:/meili_data
Add to Monica’s environment: SCOUT_DRIVER=meilisearch and MEILISEARCH_URL=http://meilisearch:7700.
Reverse Proxy
For HTTPS access, place Monica behind a reverse proxy. With Nginx Proxy Manager, point your domain to monica:80 on the Docker network. Set APP_URL to your HTTPS domain and ensure APP_TRUSTED_PROXIES=* is set.
See Reverse Proxy Setup for detailed instructions.
Backup
Back up these volumes:
- monica-storage — uploaded files, avatars, documents
- monica-db — all contact data, activities, notes
Database backup:
docker exec monica-db mysqldump -u monica -p monica > monica-backup.sql
See Backup Strategy for a complete approach.
Troubleshooting
APP_KEY Error on Startup
Symptom: “No application encryption key has been specified” error.
Fix: Generate a proper key: echo "base64:$(openssl rand -base64 32)" and set it in your .env file. The key must start with base64:.
Blank Page After Login
Symptom: White screen after logging in.
Fix: Check that APP_URL matches exactly how you access Monica (including port). Clear the cache: docker exec monica php artisan cache:clear.
Storage Permission Errors
Symptom: “Permission denied” errors when uploading files.
Fix: The storage volume must be writable by www-data (UID 33): docker exec monica chown -R www-data:www-data /var/www/html/storage.
IntlException on Contact Pages
Symptom: “Constructor failed” error viewing contacts.
Fix: This affects some locale configurations. Set LANG=en_US.UTF-8 in the container environment.
Resource Requirements
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | 256 MB | 512 MB |
| CPU | 1 core | 2 cores |
| Disk | 500 MB (app) | 2 GB+ (with uploads) |
MariaDB adds ~200 MB RAM. Total stack: ~500 MB minimum.
Verdict
Monica is the best personal CRM for self-hosting. Nothing else in the open-source world combines contact management, relationship tracking, activity logging, and gift/debt tracking in such a polished package. It’s built specifically for personal use — not a stripped-down enterprise tool.
The trade-off is that Monica v4 development has slowed (last release May 2024), and v5 is still in beta. For now, v4.1.2 is stable and fully functional. If you want a CRM for business leads, look at SuiteCRM or Twenty instead.
FAQ
Can Monica import contacts from Google Contacts?
Yes. Export from Google Contacts as vCard (.vcf), then import via Monica’s Settings → Import. The vCard importer handles names, emails, phones, and addresses.
Does Monica support multiple users?
Yes. Each user gets their own contact database. Users don’t share contacts by default. Disable registration after setup with APP_DISABLE_SIGNUP=true.
How does Monica compare to a spreadsheet for tracking contacts?
Monica adds structure that spreadsheets lack: automatic birthday reminders, activity timelines, relationship links between contacts, gift tracking, and journal entries tied to specific people. A spreadsheet doesn’t remind you to call your mom.
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments