Setting Up Monica CRM with Docker Compose: A Step-by-Step Guide

Monica is more than just a personal relationship management (PRM) tool; it’s your digital assistant, designed to help you cultivate and maintain the important connections in your life. Think of it as a CRM tailored for personal relationships rather than sales leads. Whether you want to remember friends’ birthdays, track interactions, or simply keep your social life organized, Monica stands out as a powerful ally. And deploying it via Docker Compose? That’s like giving yourself the best toolkit for the job.

In this guide, I’ll walk you through the process of deploying Monica with Docker Compose, along with some recommendations to optimize your experience after setup.


Step 1: Prerequisites

Before diving in, ensure you have Docker and Docker Compose installed on your machine. If this is your first experience with Docker, welcome to the world of containerization—where applications run consistently across environments, making deployment and updates a breeze.

  1. Install Docker: Head over to Docker’s official website for installation instructions tailored to your operating system.
  2. Install Docker Compose: Follow the Docker Compose installation instructions to get set up.

Step 2: Create a docker-compose.yml File

Next, we’ll create a docker-compose.yml file to define how Monica will be set up. This file serves as a roadmap, detailing how to deploy the Monica application alongside a MySQL database—an essential component for storing your data.

Open your terminal, navigate to the directory where you want Monica to reside, and create a new docker-compose.yml file. Here’s a sample configuration to get you started:

version: '3'

services:
  monica:
    image: monica:latest
    env_file:
      - .env
    ports:
      - "8080:80"
    depends_on:
      - db

  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: monica
      MYSQL_USER: monica
      MYSQL_PASSWORD: monicapassword
    volumes:
      - monica_db_data:/var/lib/mysql

volumes:
  monica_db_data:

In this setup:

  • Monica runs as a dedicated service, pulling the latest image from Docker Hub.
  • MySQL operates as a separate service, managing the database with specified environment variables for security.

Note: Be sure to replace rootpassword and monicapassword with secure passwords.

Step 3: Create an .env File for Monica’s Environment Variables

To keep sensitive information like database credentials separate from the docker-compose.yml file, we’ll create an .env file. This makes it easier to manage environment variables without editing the core configuration.

In the same directory, create a file named .env:

APP_KEY=base64:YOUR_APP_KEY
APP_ENV=production
APP_DEBUG=false
APP_URL=http://localhost:8080
DB_HOST=db
DB_DATABASE=monica
DB_USERNAME=monica
DB_PASSWORD=monicapassword

For the APP_KEY, you’ll generate a new key after running the Monica container for the first time.

Step 4: Run Docker Compose

With your docker-compose.yml and .env files in place, it’s time to launch Monica:

docker-compose up -d

Docker Compose will pull the necessary images, create the defined services, and start them in the background.

Step 5: Generate Monica’s APP_KEY

To complete the application initialization, generate your APP_KEY by entering the Monica container:

docker-compose exec monica php artisan key:generate --show

This command will output a new key that you should add to the APP_KEY field in your .env file. Once you’ve updated the key, restart the container:

docker-compose down
docker-compose up -d

Congratulations! Monica is now fully configured and accessible at http://localhost:8080.


Initial Setup Recommendations

After logging into the Monica dashboard for the first time, consider these steps to maximize your PRM experience:

1. Create a User Account

Start by setting up your initial user account. Follow the prompts, providing essential information and a secure password.

2. Configure Personal Details and Preferences

In your profile settings, add details like your name and birthday. These particulars enhance reminders and reports, so it’s worth taking a moment to fill them in.

3. Add Your Contacts

Begin by entering a few close contacts. Monica allows you to store extensive information for each person—birthdays, addresses, contact details, and even custom notes. As you add contacts, consider incorporating tags and relationships (e.g., family, friend, coworker) to help you stay organized.

4. Set Up Reminders and Notifications

Take advantage of Monica’s ability to set reminders for birthdays, anniversaries, and other significant dates. This feature is a cornerstone of what makes Monica such a valuable PRM tool, so configure your reminders thoughtfully.

5. Explore Custom Fields and Tags

If you have specific information to track—like favorite activities or meeting history—utilize custom fields and tags. Tags are particularly useful for grouping contacts by characteristics like “work,” “family,” or “volunteer group,” making it easy to filter and find relevant connections.

6. Integrate with Email and Calendars

Monica can seamlessly integrate with various email and calendar applications, centralizing your reminders and events. Check the integrations section in settings for options that can streamline your contact management.

7. Regularly Back Up Your Data

While Docker Compose simplifies managing and maintaining your Monica installation, regular data backups are essential—especially if you’re entering sensitive or irreplaceable information. Consider setting up periodic backups of your database or using Docker volumes to create snapshots.


Maintenance Tips

  • Updating Monica: When a new version of Monica is released, update by pulling the latest image and restarting the container with:

    docker-compose pull
    docker-compose up -d
    
  • Checking Logs: To troubleshoot any issues, view logs for both services using docker-compose logs monica or docker-compose logs db.

  • Restoring from Backup: Regular backups of the monica_db_data volume will simplify data recovery if needed.


With Docker Compose, deploying Monica CRM is straightforward and reliable. The application’s user-friendly interface and feature set make it an invaluable tool for managing personal relationships. Once you’re set up, you’ll find that Monica becomes a trusted assistant, helping you navigate life’s most important connections with ease.