2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2025-11-25 12:27:53 +03:30
2026-08-25 17:58:41 +03:30
2025-11-25 12:27:53 +03:30

Selfhost Cloud Compose Stack

This repository provides modular Docker Compose configurations for a self-hosted stack built around OpenCloud, with Traefik at the root and optional Odoo, Gitea, Postgres, and backup services.

Overview

The stack uses a modular compose layout. The root docker-compose.yml starts Traefik only. OpenCloud and other apps are added as overlay files.

OpenCloud options:

  • Standard deployment with Traefik reverse proxy and Let's Encrypt certificates or certificates from files
  • External proxy support for environments with existing reverse proxies (like Nginx, Caddy, etc.)
  • Collabora Online integration for document editing
  • Keycloak and LDAP integration for centralized identity management
  • Full text search with Apache Tika for content extraction and metadata analysis
  • Monitoring with metrics endpoints for observability and performance monitoring
  • Radicale integration for Calendar and Contacts

Additional services in this repo:

Note

: Traefik is always present via docker-compose.yml. OpenCloud lives in opencloud/opencloud.yml (with Traefik labels). Overlays that attach services to opencloud-net (Collabora, Keycloak, Tika, Radicale, monitoring) typically also include traefik/opencloud.yml so Traefik joins that network.

Quick Start Guide

Prerequisites

  • Docker and Docker Compose v2 installed.
  • Domain names pointing to your server (for production deployment)
  • Basic understanding of Docker Compose concepts

Important

Please use the docker installation guide from the Official Documentation to ensure using docker compose v2. Official linux distro package repositories might still contain docker compose v1, e.g. Debian 12 "Bookworm". Using docker compose v1 will lead to a broken docker deployment.

Local Development

  1. Clone the repository:

    git clone ssh://git@git.faryad.top:2222/rhino/selfhost-cloud-compose-stack.git
    cd selfhost-cloud-compose-stack
    
  2. Create environment file:

    cp .env.example .env
    

    Note

    : The repository includes .env.example as a template with default settings and documentation. Your actual .env file is excluded from version control (via .gitignore) to prevent accidentally committing sensitive information like passwords and domain-specific settings.

  3. Set admin password: set INITIAL_ADMIN_PASSWORD=your_secure_password environment variable in your .env file

  4. Domain: optionally, set OC_DOMAIN=your-domain.com to overwrite the default cloud.opencloud.test

  5. Configure deployment options:

    You can deploy using explicit -f flags:

    docker compose -f docker-compose.yml -f opencloud/opencloud.yml up -d
    

    Or by adding the COMPOSE_FILE variable in .env:

    COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml
    

    Then simply run:

    docker compose up -d
    
  6. Add local domains to /etc/hosts (for local development only):

    127.0.0.1 cloud.opencloud.test
    127.0.0.1 traefik.opencloud.test
    127.0.0.1 keycloak.opencloud.test
    127.0.0.1 git.opencloud.test
    127.0.0.1 odoo.opencloud.test
    
  7. Access OpenCloud:

Production Deployment

DNS Requirements: For production deployments, you need real DNS entries pointing to your server for all required subdomains. You can either create individual DNS A/AAAA records for each subdomain (e.g., cloud.example.com, collabora.example.com, keycloak.example.com) or use a wildcard DNS entry (*.example.com) that covers all subdomains.

  1. Edit the .env file and configure:

    • Domain names (replace .opencloud.test domains with your real domains)
    • Admin password
    • SSL certificate email
    • Storage paths
  2. Configure deployment options in .env:

    COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
    
  3. Start the stack:

    docker compose up -d
    

Deployment Options

With Keycloak and LDAP using a Shared User Directory

OpenCloud can be deployed with Keycloak for identity management and LDAP for the shared user directory:

DNS Requirements: This setup requires DNS entries for both the main OpenCloud domain and the Keycloak subdomain. Configure DNS A/AAAA records for your domains (e.g., cloud.example.com, keycloak.example.com) or use a wildcard DNS entry (*.example.com).

Using -f flags:

docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f idm/ldap-keycloak.yml -f traefik/opencloud.yml -f traefik/ldap-keycloak.yml up -d

Or by setting in .env:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/ldap-keycloak.yml

For local development only: Add to /etc/hosts:

127.0.0.1 keycloak.opencloud.test

This setup includes:

  • Keycloak for authentication and identity management
  • Shared LDAP server as a user directory with demo users and groups
  • Integration with Keycloak using OpenCloud clients (web, OpenCloudDesktop, OpenCloudAndroid, OpenCloudIOS)

With Collabora Online

Include Collabora for document editing using either method:

DNS Requirements: This setup requires DNS entries for the main OpenCloud domain, Collabora subdomain, and WOPI server subdomain. Configure DNS A/AAAA records for your domains (e.g., cloud.example.com, collabora.example.com, wopiserver.example.com) or use a wildcard DNS entry (*.example.com).

Using -f flags:

docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f weboffice/collabora.yml -f traefik/opencloud.yml -f traefik/collabora.yml up -d

Or by setting in .env:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml

For local development only: Add to /etc/hosts:

127.0.0.1 collabora.opencloud.test
127.0.0.1 wopiserver.opencloud.test

Enable full text search capabilities with Apache Tika using either method:

DNS Requirements: This setup requires DNS entries for the main OpenCloud domain. Configure a DNS A/AAAA record for your domain (e.g., cloud.example.com) or use a wildcard DNS entry (*.example.com).

Using -f flags:

docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f search/tika.yml -f traefik/opencloud.yml up -d

Or by setting in .env:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:search/tika.yml:traefik/opencloud.yml

This setup includes:

  • Apache Tika for text extraction and metadata analysis from various file formats
  • Full text search functionality in the OpenCloud interface
  • Support for documents, PDFs, images, and other file types

With Radicale

Enable CalDAV (calendars, to-do lists) and CardDAV (contacts) server.

DNS Requirements: This setup requires DNS entries for the main OpenCloud domain. Configure a DNS A/AAAA record for your domain (e.g., cloud.example.com) or use a wildcard DNS entry (*.example.com).

Using -f flags:

docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f radicale/radicale.yml -f traefik/opencloud.yml up -d

Or by setting in .env:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:radicale/radicale.yml:traefik/opencloud.yml

This setup includes:

  • Radicale as a CalDAV (calendars, to-do lists) and CardDAV (contacts) server
  • Users access to a Personal Calendar and Addressbook

With Monitoring

Enable monitoring capabilities with metrics endpoints using either method:

DNS Requirements: This setup requires DNS entries for the main OpenCloud domain. Configure a DNS A/AAAA record for your domain (e.g., cloud.example.com) or use a wildcard DNS entry (*.example.com).

OpenCloud proxy metrics (monitoring/monitoring.yml):

docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f monitoring/monitoring.yml -f traefik/opencloud.yml up -d

Or by setting in .env:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:monitoring/monitoring.yml:traefik/opencloud.yml

For Collabora collaboration-service metrics, also include monitoring/monitoring-collaboration.yml (requires the Collabora overlay):

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:monitoring/monitoring.yml:monitoring/monitoring-collaboration.yml:traefik/opencloud.yml:traefik/collabora.yml

This setup includes:

  • Metrics endpoint for the OpenCloud proxy service (listens on port 9205 inside the container)
  • Metrics endpoint for the collaboration service (listens on port 9304 inside the container; needs monitoring/monitoring-collaboration.yml)
  • Prometheus-compatible metrics format

Note

: These overlays set listen addresses only; they do not publish host ports. Scrape metrics from the Docker network (for example http://opencloud:9205/metrics or http://collaboration:9304/metrics), or add your own port mappings if you need host access.

Note

: The monitoring configuration uses an external network opencloud-net. You need to create this network manually before starting the services:

docker network create opencloud-net

Behind External Proxy

If you already have a reverse proxy (Nginx, Caddy, etc.), use either method:

DNS Requirements: When using an external proxy, you need to configure your external proxy to handle DNS and SSL termination. Ensure your DNS entries point to your external proxy server, and configure your proxy to forward requests to the exposed OpenCloud ports.

Using -f flags:

docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f weboffice/collabora.yml -f external-proxy/opencloud.yml -f external-proxy/collabora.yml up -d

Or by setting in .env:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml

This exposes the necessary ports:

  • OpenCloud: 9200
  • Collabora: 9980
  • WOPI server: 9300

Please note: If you're using Nginx Proxy Manager (NPM), you should NOT activate "Block Common Exploits" for the Proxy Host. Otherwise, the desktop app authentication will return error 403 Forbidden.

With Odoo, Gitea, and Shared Postgres

Odoo and Gitea share Postgres from database/postgres.yml. Traefik labels for Odoo are already in odoo/odoo.yml (there is no traefik/odoo.yml).

Example:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:odoo/odoo.yml:odoo/odoo-init.yml:database/postgres.yml:version-control/gitea.yml

Using -f flags:

docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f odoo/odoo.yml -f odoo/odoo-init.yml -f database/postgres.yml -f version-control/gitea.yml up -d

For local development only: Add to /etc/hosts:

127.0.0.1 odoo.opencloud.test
127.0.0.1 git.opencloud.test

Backups

Scheduled Postgres dumps and volume archives are defined in backup/backup.yml; restores use backup/restore.yml. Optional Borgmatic is in backup/borgmatic.yml.

See backup/README.md and backup/borgmatic-README.md for configuration and restore workflows. Do not copy outdated volume names from older docs; Odoo uses odoo-db-data and odoo-config (see below).

SSL Certificate Support

This stack supports adding SSL certificates for public domains and development environments. This feature enables you to use the "Let's Encrypt ACME challenge" to generate certificates for your public domains as well as using your own certificates.

Use Let's Encrypt with ACME Challenge

  1. Enable Let's Encrypt:

    • Set TRAEFIK_ACME_MAIL to your email address for the ACME challenge
    • Set TRAEFIK_SERVICES_TLS_CONFIG="tls.certresolver=letsencrypt" to use Let's Encrypt (default value)
    # In your .env file
    TRAEFIK_ACME_MAIL=devops@your-domain.tld
    TRAEFIK_SERVICES_TLS_CONFIG="tls.certresolver=letsencrypt"
    
  2. Use DNS-01 challenge with Cloudflare (recommended if Let's Encrypt cannot reach your server):

    • Set TRAEFIK_ACME_CHALLENGE=dns
    • Set TRAEFIK_ACME_DNS_PROVIDER=cloudflare
    • Set CF_DNS_API_TOKEN to a Cloudflare token with DNS edit permissions for your zone
    # In your .env file
    TRAEFIK_ACME_MAIL=devops@your-domain.tld
    TRAEFIK_SERVICES_TLS_CONFIG="tls.certresolver=letsencrypt"
    TRAEFIK_ACME_CHALLENGE=dns
    TRAEFIK_ACME_DNS_PROVIDER=cloudflare
    CF_DNS_API_TOKEN=your-cloudflare-token
    # Optional: helps in split-DNS environments
    # TRAEFIK_ACME_DNS_RESOLVERS=1.1.1.1:53,8.8.8.8:53
    

    Then restart Traefik:

    docker compose up -d traefik
    

Use Certificates from the certs/ directory

  1. Place your certificates:

    • Copy your certificate files (.crt, .pem, .key) to the certs/ directory
    • The directory structure is flexible - organize as needed for your setup
  2. Configure Traefik dynamic configuration:

    • Place Traefik dynamic configuration files in config/traefik/dynamic/

    Example config/traefik/dynamic/certs.yml:

    tls:
      certificates:
        - certFile: /certs/opencloud.test.crt
          keyFile: /certs/opencloud.test.key
          stores:
            - default
        - certFile: /certs/wildcard.example.com.crt
          keyFile: /certs/wildcard.example.com.key
          stores:
            - default
    
  3. Configure environment variables:

    • Set TRAEFIK_SERVICES_TLS_CONFIG="tls=true" to use your local certificates

      # In your .env file
      TRAEFIK_SERVICES_TLS_CONFIG="tls=true"
      

The certificate directory and configuration directories are now available and automatically mounted in the containers:

  • certs/ → /certs/ (inside the Traefik container)
  • config/traefik/dynamic/ → dynamic configuration loading

Tip

Local development or testing with mkcert For local development, you can use mkcert to generate self-signed certificates for your local domains. This allows you to test SSL/TLS configurations without needing a public domain or Let's Encrypt. It also brings the advantage that you don't have to accept self-signed certificates in your browser all the time.

# Install mkcert (if not already installed)
# macOS: brew install mkcert
# Linux: apt install mkcert or similar
# Windows: choco install mkcert or download from GitHub
  
# Install the local CA
mkcert -install
  
# Generate certificates for your local domains
mkcert -cert-file certs/opencloud.test.crt -key-file certs/opencloud.test.key "*.opencloud.test" opencloud.test

Important

The contents of the certs/ directory and configuration directories are ignored by git to prevent accidentally committing sensitive certificate files.

Configuration

Environment Variables

The configuration is managed through environment variables in the .env file:

  • We provide .env.example as a template with documentation for all options
  • Your personal .env file is ignored by git to keep sensitive information private
  • This pattern allows everyone to customize their deployment without affecting the repository

Key variables:

Variable Description Default
COMPOSE_FILE Colon-separated list of compose files to use (commented out)
OC_DOMAIN OpenCloud domain cloud.opencloud.test
INITIAL_ADMIN_PASSWORD OpenCloud password for the admin user (no value)
OC_DOCKER_TAG OpenCloud image tag latest
OC_CONFIG_DIR Config directory path (Docker volume)
OC_DATA_DIR Data directory path (Docker volume)
INSECURE Skip certificate validation true
COLLABORA_DOMAIN Collabora domain collabora.opencloud.test
WOPISERVER_DOMAIN WOPI server domain wopiserver.opencloud.test
TIKA_IMAGE Apache Tika image tag apache/tika:latest-full
KEYCLOAK_DOMAIN Keycloak domain keycloak.opencloud.test
KEYCLOAK_ADMIN Keycloak admin username kcadmin
KEYCLOAK_ADMIN_PASSWORD Keycloak admin password admin
LDAP_BIND_PASSWORD LDAP password for the bind user admin
KC_DB_USERNAME Database user for keycloak keycloak
KC_DB_PASSWORD Database password for keycloak keycloak
TRAEFIK_ACME_MAIL Email Address for the Let's Encrypt ACME challenge example@example.org
TRAEFIK_SERVICES_TLS_CONFIG Tell traefik and the services which TLS config to use tls.certresolver=letsencrypt
TRAEFIK_ACME_CHALLENGE ACME challenge type (http, dns, tls) http
TRAEFIK_ACME_DNS_PROVIDER DNS provider for ACME DNS challenge cloudflare
CF_DNS_API_TOKEN Cloudflare token used for DNS-01 challenge (no value)
TRAEFIK_CERTS_DIR Directory for custom certificates. ./certs

See .env.example for all available options and their documentation.

Admin Password Configuration

The INITIAL_ADMIN_PASSWORD environment variable is required for OpenCloud to work properly:

  • Only needed when using the built-in LDAP server (idm)
  • Must be set before the first start of OpenCloud. Changes in the ENV variable after the first startup will be ignored.
  • If not set, OpenCloud will not work properly and the container will keep restarting
  • After first initialization, the admin password can only be changed via:
    • OpenCloud User Settings UI
    • OpenCloud CLI

For external LDAP servers, the admin password is managed by the LDAP server itself.

Important: Set this variable in your .env file before starting OpenCloud for the first time:

INITIAL_ADMIN_PASSWORD=your-secure-password-here

For more details, see the OpenCloud documentation.

Persistent Storage

For production, configure persistent storage:

OC_CONFIG_DIR=/path/to/opencloud/config
OC_DATA_DIR=/path/to/opencloud/data

Ensure proper permissions:

mkdir -p /path/to/opencloud/{config,data}
chown -R 1000:1000 /path/to/opencloud

Odoo volumes and first-time init

Odoo uses:

  • named volume odoo-db-data → /var/lib/odoo (filestore, sessions, attachments)
  • named volume odoo-config → /etc/odoo
  • bind mount ./odoo/addons → /mnt/extra-addons

On first deploy, include odoo/odoo-init.yml. The one-shot odoo-init service chowns the named volumes and initializes the database. Details: scripts/odoo/README.md.

Odoo startup page (Projects instead of Discuss)

By default, Odoo 19 opens Discuss after login. The custom addon odoo/addons/project_home_action restores the Home Action field on user Preferences and sets it to Projects for internal users.

./odoo/addons is already mounted into the container at /mnt/extra-addons via odoo/odoo.yml. After deploying a revision that includes this addon:

  1. Restart Odoo if the container was already running, so it picks up the new module files:
    docker compose restart odoo
    
  2. In Odoo, open Settings → Apps.
  3. Remove the Apps filter (and enable developer mode if the Apps menu is limited), then Update Apps List.
  4. Search for Project as Home Action (project_home_action) and Install it.
  5. Log out and log back in. You should land on Projects (/odoo/project) instead of Discuss.

On install, existing internal users with an empty Home Action are updated automatically. New internal users get the same default. You can still change Home Action per user under Settings → Users → Preferences (or My Preferences).

Requires the Project app to be installed (depends: project).

Compose File Structure

This repository uses a modular approach with multiple compose files:

  • docker-compose.yml — Traefik reverse proxy (always included)
  • opencloud/ — OpenCloud service
  • odoo/ — Odoo 19 and first-boot init
  • version-control/ — Gitea
  • database/ — Shared Postgres for Gitea and Odoo
  • backup/ — Backup, restore, and optional Borgmatic helpers
  • weboffice/ — Web office integrations (Collabora Online)
  • storage/ — Storage backend configurations (decomposeds3)
  • search/ — Search and content analysis services (Apache Tika)
  • monitoring/ — Monitoring and metrics configurations
  • idm/ — Identity management configurations (Keycloak & LDAP)
  • traefik/ — Extra Traefik network aliases and labels for overlays
  • external-proxy/ — Configuration for external reverse proxies
  • radicale/ — Radicale configuration
  • config/ — Configuration files for OpenCloud, Keycloak, LDAP, Traefik, etc.

Advanced Usage

Understanding the COMPOSE_FILE Variable

The COMPOSE_FILE environment variable is a powerful way to manage complex Docker Compose deployments:

  • It uses colons (:) as separators between files (configurable with COMPOSE_PATH_SEPARATOR)
  • Files are processed in order, with later files overriding settings from earlier ones
  • It allows you to run just docker compose up -d without specifying -f flags
  • Perfect for automation, CI/CD pipelines, and consistent deployments

Example configurations:

Baseline OpenCloud:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml

Production with Collabora:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml

Production with Keycloak and LDAP:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/ldap-keycloak.yml

Production with both Collabora and Keycloak/LDAP:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/collabora.yml:traefik/ldap-keycloak.yml

Production with monitoring:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:monitoring/monitoring.yml:traefik/opencloud.yml

OpenCloud with Odoo, Gitea, and Postgres:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:odoo/odoo.yml:odoo/odoo-init.yml:database/postgres.yml:version-control/gitea.yml

Automation and GitOps

For automated deployments, using the COMPOSE_FILE variable in .env is recommended:

COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml

This allows tools like Ansible or CI/CD pipelines to deploy the stack without modifying the compose files.

Custom compose file overrides

You can create custom compose files to override specific settings after creating a custom directory:

mkdir -p custom

Then create a docker-compose.override.yml file in the custom directory with your overrides.

This folder is ignored by git, allowing you to customize your deployment without affecting the repository. This can be useful in scenarios like portainer where the git repository is configured as a stack.

You can for example add custom labels to the OpenCloud service:

services:
  opencloud:
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.opencloud.rule=Host(`cloud.opencloud.test`)"
      - "traefik.http.services.opencloud.loadbalancer.server.port=80"
      - "traefik.http.routers.opencloud.tls.certresolver=my-resolver"

Troubleshooting

Common Issues

  • SSL Certificate Errors: For local development, accept self-signed certificates by visiting each domain directly in your browser.
  • Port Conflicts: If you have services already using ports 80/443, use the external proxy configuration.
  • Permission Issues: Ensure data and config directories have proper permissions (owned by user/group 1000). For Odoo named volumes, use odoo/odoo-init.yml on first start.

Logs

View logs with:

docker compose logs -f

For specific service logs:

docker compose logs -f opencloud

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the GNU General Public License v3 (GPLv3).

Description
No description provided
Readme GPL-3.0 376 KiB
Languages
Shell 62%
Python 26.4%
JavaScript 10.2%
CSS 1.4%