Monica

version: "3.9"

services:
  certbot:
    image: certbot/certbot:latest
    container_name: certbot
    volumes:
      - ./certbot/www:/var/www/certbot
      - ./certbot/conf:/etc/letsencrypt

  nginx:
    image: nginx:alpine
    container_name: nginx
    restart: unless-stopped
    depends_on:
      - freshrss
      - wallabag
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/conf.d:/etc/nginx/conf.d:ro
      - ./certbot/www:/var/www/certbot:ro
      - ./certbot/conf:/etc/letsencrypt:ro

  postgres:
    image: postgres:16
    container_name: postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: change_this_admin_password
    volumes:
      - ./postgres_data:/var/lib/postgresql/data
      - ./initdb:/docker-entrypoint-initdb.d
    ports:
      - "5432:5432"

  freshrss:
    image: freshrss/freshrss:latest
    container_name: freshrss
    restart: unless-stopped
    depends_on:
      - postgres
    environment:
      TZ: UTC
    volumes:
      - ./freshrss_data:/var/www/FreshRSS/data
      - ./freshrss_extensions:/var/www/FreshRSS/extensions

  wallabag:
    image: wallabag/wallabag:latest
    container_name: wallabag
    restart: unless-stopped
    depends_on:
      - postgres
    environment:
      SYMFONY__ENV__DOMAIN_NAME: "https://wallabag.manxialiu.org"
      SYMFONY__ENV__DATABASE_DRIVER: pdo_pgsql
      SYMFONY__ENV__DATABASE_HOST: postgres
      SYMFONY__ENV__DATABASE_PORT: 5432
      SYMFONY__ENV__DATABASE_NAME: wallabag
      SYMFONY__ENV__DATABASE_USER: wallabag
      SYMFONY__ENV__DATABASE_PASSWORD: change_this_wallabag_password
    volumes:
      - ./wallabag/data:/var/www/wallabag/data
      - ./wallabag/images:/var/www/wallabag/web/assets/images
  monica:
    image: monica:latest
    container_name: monica
    restart: unless-stopped
    depends_on:
      - monica_db
    environment:
      APP_ENV: production
      APP_KEY: base64:SvGCjh161p/00kgNrZm7E8xhotqnpX94d46w8cnkM0g=
      APP_DEBUG: "false"
      APP_URL: https://monica.manxialiu.org
      DB_CONNECTION: mysql
      DB_HOST: monica_db
      DB_PORT: 3306
      DB_DATABASE: monica
      DB_USERNAME: monica
      DB_PASSWORD: change_this_monica_password
      TRUSTED_PROXIES: "**"
    volumes:
      - ./monica_data:/var/www/html/storage
  monica_db:
    image: mariadb:11
    container_name: monica_db
    restart: unless-stopped
    environment:
      MARIADB_DATABASE: monica
      MARIADB_USER: monica
      MARIADB_PASSWORD: change_this_monica_password
      MARIADB_ROOT_PASSWORD: change_this_root_password
    volumes:
      - ./monica_db_data:/var/lib/mysql

Data migration

Copy the Monica application data

  • Copy the Monica volume from the old server to the new server.
  • Use the volume path from your Docker Compose file.

Dump the Monica database (old server)

Dump the database using the credentials from the old server:

docker compose exec db mariadb-dump -u monica -psecret monica > monica.sql

Copy monica.sql to the new server. {% endstep %}

{% step %}

Restore the Monica database (new server)

Import into the new database container (for example, monica_db):

docker compose exec -T monica_db mariadb -u monica -pchange_this_monica_password monica < monica.sql
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9