Stop Forgetting the Small Stuff: Self-Host Monica CRM on Docker

HomeLab tutorial - IT technology blog
HomeLab tutorial - IT technology blog

The Struggle of Remembering the Little Things

I used to pride myself on having a sharp memory. Then life happened. Suddenly, I was blanking on my manager’s kid’s name, forgetting that a close friend had a peanut allergy, or losing track of a 2022 book recommendation. Between Slack pings and social media noise, our most meaningful interactions often vanish into the chaos of a busy week.

Social media platforms like Facebook or LinkedIn aren’t built for deep personal management. They prioritize engagement and ad revenue over genuine connection. If you want to remember that your mentor prefers email over phone calls or that your cousin just started a new job, you need a dedicated system. This is where a Personal CRM (Customer Relationship Management) changes the game.

Why Our Social Circles Decay

It isn’t just laziness that causes us to lose touch; it’s cognitive overload. Human brains aren’t wired to store thousands of discrete details about 150 different people—a limit often called Dunbar’s Number. Relying on memory alone forces us to fall back on the “recency effect.” We only reach out to the people we’ve spoken to in the last seven days, while older friendships slowly fade.

Fragmented tools make this worse. You probably have a phone number in your contacts, a birthday on a Google Calendar, and a chat history buried somewhere in WhatsApp. There is no single source of truth. Without a centralized hub, maintaining long-term relationships becomes reactive. You only reach out when you see a notification, rather than being proactive.

Evaluating the Options

When I started looking for a solution, I explored three main paths:

  • The Spreadsheet Method: Excel or Google Sheets. While free, it’s a nightmare to navigate on a phone and lacks automated reminders. It feels like manual data entry, and that leads to burnout within a month.
  • Enterprise CRMs: Salesforce or HubSpot. These are powerful but feel cold. Seeing your best friend listed as a “Lead” in a “Sales Pipeline” is just weird.
  • Proprietary Personal CRMs: Apps like Clay or Dex. They are sleek and user-friendly. However, they usually demand a $15–$20 monthly subscription and store your most sensitive data on their servers.

For anyone running a HomeLab, the choice is obvious. We want a tool built for relationships that keeps our data under our own roof. That leads us to Monica.

The Solution: Monica CRM on Docker

Monica is an open-source Personal Relationship Management system. It tracks everything from a friend’s favorite whiskey to the last time you grabbed coffee. By hosting it yourself via Docker, you ensure your data stays on your hardware. No one is mining your contact list to sell you targeted ads.

I’ve run this setup for over a year, and it’s remarkably stable. Monica is lightweight, typically using only 150MB to 200MB of RAM. Using Docker Compose makes the deployment repeatable and easy to back up, which is vital for a system that will eventually hold years of your history.

Prerequisites

Before we dive in, ensure your server (Ubuntu 22.04 or similar) is ready:

  • Docker and Docker Compose installed.
  • Basic comfort with the terminal.
  • A local IP or a domain name for access.

Step 1: Setting Up the Directory

Let’s keep things organized. I recommend a dedicated folder for all your Docker projects.

mkdir -p ~/docker/monica
cd ~/docker/monica

Step 2: Configuring the Environment

Monica needs a few variables to handle database encryption and session security. Create a .env file:

nano .env

Paste the following content. You must change the APP_KEY and passwords. The APP_KEY must be exactly 32 characters long.

# Monica Configuration
APP_KEY=ChangeThisToA32CharSecretKey!!!
DB_USERNAME=monica
DB_PASSWORD=your_secure_password

# Database Configuration
MYSQL_RANDOM_ROOT_PASSWORD=true
MYSQL_DATABASE=monica
MYSQL_USER=monica
MYSQL_PASSWORD=your_secure_password

Pro tip: Generate a valid key by running: echo -n "base64:$(openssl rand -base64 32)".

Step 3: The Docker Compose File

Next, we’ll define the services. We need the Monica app and a MySQL database. Create docker-compose.yml:

version: '3.8'

services:
  app:
    image: monica:latest
    depends_on:
      - db
    ports:
      - 8080:80
    environment:
      - APP_KEY=${APP_KEY}
      - DB_USERNAME=${DB_USERNAME}
      - DB_PASSWORD=${DB_PASSWORD}
      - APP_ENV=production
    volumes:
      - monica_data:/var/www/html/storage
    restart: unless-stopped

  db:
    image: mysql:5.7
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
    restart: unless-stopped

volumes:
  monica_data:
  mysql_data:

Step 4: Spin Up the Containers

Fire up the system with one command:

docker-compose up -d

Monica will take about 30 to 60 seconds to initialize the database schema on the first run. You can watch the progress by checking the logs:

docker-compose logs -f app

Step 5: Access and Initial Setup

Navigate to http://your-server-ip:8080 in your browser. You’ll see the Monica registration page. The first account you create becomes the administrator.

Once you’re in, try these three things immediately:

  • Add 5 Core Contacts: Start with family or your closest friends.
  • Set a Recurring Reminder: Maybe a “Call Mom” reminder every two weeks.
  • Log an Activity: Record a brief note about the last time you went out for dinner. It’s a great way to see how the timeline feature works.

Going Further: Reverse Proxies and Security

Accessing your CRM via an IP and port is fine for testing, but it’s clunky for daily use. If you want to access Monica on the go, put it behind a reverse proxy like Nginx Proxy Manager or Cloudflare Tunnels. This adds an SSL certificate, making your connection secure.

Adding SSL is more than just a security checkbox. It enables smoother synchronization if you decide to use the Monica mobile app, which relies on the API to pull your contact data.

Don’t Forget the Backups

Since this database will eventually hold years of personal milestones, you cannot lose it. A simple cron job can dump your database daily. Run this command to test a manual backup:

docker-compose exec db mysqldump -u monica -p'your_secure_password' monica > monica_backup_$(date +%F).sql

Move these files to a NAS or an encrypted cloud bucket for safekeeping.

Final Thoughts

Installing Monica isn’t just a technical project; it’s a commitment to being a more present friend and partner. It offloads the mental heavy lifting to a system you control. Once you have your first dozen contacts and start getting reminders to reach out to old friends, you’ll see the impact immediately. It turns your social life from accidental to intentional.

Share: