Skip to content

Repository files navigation

Moouro - Container Image

Tests

*** PROJECT UNDER DEVELOPMENT. NOT READY FOR PRODUCTION ***

Database and Filestore Management for Odoo environments

-- Grupo Isonor --


Features

  • unaccent PostgreSQL extension
  • vector (13+) PostgreSQL extension
  • Point-in-Time Recovery (PITR)
  • Replica-Ready (streaming)
  • pgBackRest – PostgreSQL backups
  • restic – Filestore backups
  • resticprofile – Restic profile management
  • rclone – Extended storage support for restic
  • apprise – Push notifications

Documentation

You can also get inspiration from the configurations used in the tests: https://github.com/GrupoIsonor/moouro/tree/master/tests/data/project_demo/config

Database Backup (pgBackRest)

When using pgBackRest, the stanza must be named main. archive_mode must be enabled in PostgreSQL.

  • If /etc/pgbackrest/pgbackrest.conf is not present, pgBackRest will not be initialized.

Filestore Backup (ResticProfile + Restic + RClone)

The image uses ResticProfile for filestore backups.

  • Use of scheduled backups via resticprofile is not available (can use an external solution).
  • If /etc/resticprofile/profiles.yaml is not present, ResticProfile will not be initialized.

Environment Variables

All environment variables supported by the official PostgreSQL Docker image are available: https://hub.docker.com/_/postgres#environment-variables

Name Description Required Default
POSTGRES_ODOO_USER The username for odoo user Yes ""
POSTGRES_ODOO_PASSWORD The password for odoo user Yes ""
POSTGRES_ODOO_DB The database for odoo user No ""
POSTGRES_REPLICATOR_USER The name for the 'replicator' role No replicator
POSTGRES_REPLICATOR_PASSWORD The password for 'replicator' role. If it is not specified, the role will not be created. No ""

** Can use POSTGRES_ODOO_PASSWORD_FILE to set the password using the contents of a file.

Environment Variables (Replication Mode)

Name Description Required Default
POSTGRES_REPLICATION Enables replication No false
POSTGRES_MASTER_HOST The master host No ""
POSTGRES_MASTER_PORT The master host port No ""
POSTGRES_MASTER_REPLICATOR_USER The name for the master 'replicator' role No replicator
POSTGRES_MASTER_REPLICATOR_PASSWORD_FILE The password for master 'replicator' role No ""

Points Of Interest

Path Description
/etc/pgbackrest/pgbackrest.conf pbBackRest configuration
/etc/postgresql/postgresql.conf Postgres configuration
/etc/resticprofile/profiles.yaml ResticProfile configuration
/etc/apprise/apprise.yaml AppRise configuration

Scripts

These scripts are available to help you get started with the tools. It is highly recommend that you learn how to use pgBackRest and ResticProfile by consulting their respective documentation.

  • moouro_backup – Execute pgBackRest and Restic backups

    Syntax: moouro_backup <full|incr> [dry-run] [--notify]

    Examples:

      moouro_backup full                  # normal backup
      moouro_backup incr                  # incremental backup
      moouro_backup full dry-run          # dry run (no changes)
      moouro_backup full --notify         # with notification
      moouro_backup incr dry-run --notify # combined
  • moouro_restore – Restore pgBackRest and Restic backups.

    Syntax: moouro_restore <destination> <pgBackrest_date|latest> <restic_snapshot_id|latest> [dry-run]

    WARNING: This restore script is very aggressive. It will overwrite all data and discard any unwritten changes available in the WAL.

    Example:

      moouro_restore /var/lib/odoo/filestore latest latest
      moouro_restore /var/lib/odoo/filestore 2026-04-08 abc123def
      moouro_restore /var/lib/odoo/filestore 2026-04-08 abc123def dry-run
  • moouro_check – Run pgBackRest and Restic checks

    Syntax: moouro_check [--notify]

    Example:

      moouro_check
      moouro_check --notify
  • moouro_list – List available restore points

    Syntax: moouro_list

    Example:

      moouro_list
  • moouro_init_replica – Launch pg_basebackup to start the replica. It should be called only once, when the database is empty.

    Syntax: moouro_init_replica

    Example:

      moouro_init_replica

FAQ

  • How to use scripts?

    Example with docker:

    • With psql running: docker compose exec -u postgres moouro_backup full
    • Without psql running: docker compose run --rm --entrypoint /bin/sh -u postgres moouro -c 'moouro_restore /var/lib/odoo/data'
  • I've already initialized the database, but I want to add new backup profile. What should I do?

    Simply add the profile to the pgbackrest and resticprofile configuration files. Moouro attempts to initialize the profiles every time it starts up.


Very Basic Usage Example

Folder Tree

myproject/
  - compose.yaml
  - secrets/
    - backup_password.txt
  - config/
    - apprise.yaml
    - pgbackrest.conf
    - postgresql.conf
    - resticprofile.yaml

compose.yaml

services:
  db:
    image: ghcr.io/grupoisonor/moouro:18
    environment:
      POSTGRES_DB: odoodb
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD_FILE: /run/secrets/postgres_db_password
      POSTGRES_ODOO_USER: odoo
      POSTGRES_ODOO_PASSWORD_FILE: /run/secrets/odoo_db_password
      POSTGRES_ODOO_DB: odoodb
      POSTGRES_INITDB_ARGS: --locale=C --encoding=UTF8
    volumes:
      - ./pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf:ro,Z
      - ./postgresql.conf:/etc/postgresql/postgresql.conf:ro,Z
      - ./resticprofile.yaml:/etc/resticprofile/profiles.yaml:ro,Z
      - ./apprise.yaml:/etc/apprise/apprise.yaml:ro,Z
      - filestore:/var/lib/odoo/data
      - db:/var/lib/postgresql
    secrets:
      - backup_password
      - postgres_db_password
      - odoo_db_password
    command: postgres -c config_file=/etc/postgresql/postgresql.conf
    hostname: odoo-db
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U odoo -d odoodb"]
      interval: 10s
      timeout: 5s
      retries: 15
      start_period: 30s

  odoo:
    image: isodoo:my-custom-image-19
    depends_on:
      db:
        condition: service_healthy
    ports:
      - '127.0.0.1:8069:8069'
    secrets:
      - odoo_db_password
    environment:
      OCONF__options__log_level: debug
      OCONF__options__db_filter: odoodb$
      OCONF__options__db_user: odoo
      FOCONF__options__db_password: /run/secrets/odoo_db_password
      OCONF__options__db_host: odoo-db
      OCONF__options__db_name: odoodb
      OCONF__options__proxy_mode: false
      OCONF__options__workers: 0
      OCONF__options__max_cron_threads: 0
      OCONF__options__without_demo: all
    volumes:
      - filestore:/var/lib/odoo/data
    hostname: odoo


secrets:
  backup_password:
    x-podman.relabel: Z
    file: ./secrets/backup_password.txt
  postgres_db_password:
    x-podman.relabel: Z
    file: ./secrets/postgres_db_password.txt
  odoo_db_password:
    x-podman.relabel: Z
    file: ./secrets/odoo_db_password.txt

volumes:
  filestore:
  db:

About

Database and Filestore Management for Odoo environments

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Packages

Contributors

Languages