From b5c440a9003fff67492165fe04a545e6faa0fa65 Mon Sep 17 00:00:00 2001 From: diaco Date: Sun, 20 Sep 2026 08:30:31 +0330 Subject: [PATCH] docs: align README and env examples with actual stack Co-authored-by: Cursor --- .env.example | 25 ++++---- README.md | 166 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 124 insertions(+), 67 deletions(-) diff --git a/.env.example b/.env.example index 61f2a24..c724e00 100644 --- a/.env.example +++ b/.env.example @@ -9,23 +9,26 @@ INSECURE=true ## Features ## # The following variable is a convenience variable to enable or disable features of this compose project. -# Example: if you want to use traefik and letsencrypt, you can set the variable to -#COMPOSE_FILE=docker-compose.yml:traefik/opencloud.yml +# Root docker-compose.yml starts Traefik only; always include opencloud/opencloud.yml for OpenCloud. +# Example: baseline OpenCloud with Traefik +#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml # This enables you to just run `docker compose up -d` and the compose files will be added to the stack. -# As alternative approach you can run `docker compose -f docker-compose.yml -f docker-compose.traefik.yml up -d` -# Default: OpenCloud and Collabora with traefik and letsencypt +# As alternative approach you can run `docker compose -f docker-compose.yml -f opencloud/opencloud.yml up -d` +# OpenCloud and Collabora with Traefik and Let's Encrypt # This needs DNS entries for the domain names used in the .env file. -#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml +#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml # If you want to use the external proxy, you can use the following combination. # DNS entries and certificates need to be managed by the external environment. # The domain names need to be entered into the .env file. -#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml +#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml # Keycloak Shared User Directory -#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml:idm/ldap-keycloak.yml:traefik/ldap-keycloak.yml -# OpenCloud, Planka and Gitea -#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:project/planka.yml:version-control/gitea.yml:traefik/opencloud.yml:traefik/planka.yml:database/postgres.yml:traefik/gitea.yml -# Odoo, Gitea, opencloud -#Compose_File=docker-compose.yml:odoo/odoo.yml:opencloud/opencloud.yml:version-control/gitea.yml:traefik/opencloud.yml:traefik/planka.yml:database/postgres.yml:traefik/gitea.yml:traefik/odoo.yml +#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml:idm/ldap-keycloak.yml:traefik/ldap-keycloak.yml +# OpenCloud and Gitea (shared Postgres) +#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:version-control/gitea.yml:database/postgres.yml +# Odoo, Gitea, and OpenCloud (shared Postgres; include odoo-init on first start) +#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:odoo/odoo.yml:odoo/odoo-init.yml:version-control/gitea.yml:database/postgres.yml +# Odoo, Gitea, OpenCloud, Postgres, with backup and restore helpers +#COMPOSE_FILE=docker-compose.yml:odoo/odoo.yml:opencloud/opencloud.yml:version-control/gitea.yml:database/postgres.yml:backup/backup.yml:odoo/odoo-init.yml:backup/restore.yml ## Traefik Settings ## # Note: Traefik is always enabled and can't be disabled. diff --git a/README.md b/README.md index cebf06b..dc0d07c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -# OpenCloud Compose +# Selfhost Cloud Compose Stack -This repository provides Docker Compose configurations for deploying OpenCloud in various environments. +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 -OpenCloud Compose offers a modular approach to deploying OpenCloud with several configuration options: +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.) @@ -14,6 +16,15 @@ OpenCloud Compose offers a modular approach to deploying OpenCloud with several - **Monitoring** with metrics endpoints for observability and performance monitoring - **Radicale** integration for Calendar and Contacts +Additional services in this repo: + +- **Odoo 19** (`odoo/odoo.yml` + `odoo/odoo-init.yml`) +- **Gitea** (`version-control/gitea.yml`, SSH on port 2222) — see [version-control/README.md](version-control/README.md) +- **Shared Postgres** (`database/postgres.yml`) for Gitea and Odoo +- **Backups** (`backup/backup.yml`, `backup/restore.yml`, optional Borgmatic) — see [backup/README.md](backup/README.md) and [backup/borgmatic-README.md](backup/borgmatic-README.md) + +> **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 @@ -29,8 +40,8 @@ OpenCloud Compose offers a modular approach to deploying OpenCloud with several 1. **Clone the repository**: ```bash - git clone https://github.com/opencloud-eu/opencloud-compose.git - cd opencloud-compose + git clone ssh://git@git.faryad.top:2222/rhino/selfhost-cloud-compose-stack.git + cd selfhost-cloud-compose-stack ``` 2. **Create environment file**: @@ -48,12 +59,12 @@ OpenCloud Compose offers a modular approach to deploying OpenCloud with several You can deploy using explicit `-f` flags: ```bash - docker compose -f docker-compose.yml -f traefik/opencloud.yml up -d + 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:traefik/opencloud.yml + COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml ``` Then simply run: @@ -66,6 +77,8 @@ OpenCloud Compose offers a modular approach to deploying OpenCloud with several 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**: @@ -85,10 +98,10 @@ OpenCloud Compose offers a modular approach to deploying OpenCloud with several 2. **Configure deployment options** in `.env`: ``` - COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml + COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml ``` -3. **Start OpenCloud**: +3. **Start the stack**: ```bash docker compose up -d ``` @@ -103,12 +116,12 @@ OpenCloud can be deployed with Keycloak for identity management and LDAP for the Using `-f` flags: ```bash -docker compose -f docker-compose.yml -f idm/ldap-keycloak.yml -f traefik/opencloud.yml -f traefik/ldap-keycloak.yml up -d +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:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/ldap-keycloak.yml +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`: @@ -129,12 +142,12 @@ Include Collabora for document editing using either method: Using `-f` flags: ```bash -docker compose -f docker-compose.yml -f weboffice/collabora.yml -f traefik/opencloud.yml -f traefik/collabora.yml up -d +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:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml +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`: @@ -151,12 +164,12 @@ Enable full text search capabilities with Apache Tika using either method: Using `-f` flags: ```bash -docker compose -f docker-compose.yml -f search/tika.yml -f traefik/opencloud.yml up -d +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:search/tika.yml:traefik/opencloud.yml +COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:search/tika.yml:traefik/opencloud.yml ``` This setup includes: @@ -172,12 +185,12 @@ Enable CalDAV (calendars, to-do lists) and CardDAV (contacts) server. Using `-f` flags: ```bash -docker compose -f docker-compose.yml -f radicale/radicale.yml -f traefik/opencloud.yml up -d +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:radicale/radicale.yml:traefik/opencloud.yml +COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:radicale/radicale.yml:traefik/opencloud.yml ``` This setup includes: @@ -190,25 +203,27 @@ 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`). -Using `-f` flags: +OpenCloud proxy metrics (`monitoring/monitoring.yml`): ```bash -docker compose -f docker-compose.yml -f monitoring/monitoring.yml -f traefik/opencloud.yml up -d +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:monitoring/monitoring.yml:traefik/opencloud.yml +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 endpoints for OpenCloud proxy service (port 9205) -- Metrics endpoints for collaboration service (port 9304) -- Performance monitoring and observability data +- 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 -Access metrics endpoints: -- OpenCloud metrics: `http://localhost:9205/metrics` -- Collaboration metrics: `http://localhost:9304/metrics` +> **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: > ```bash @@ -223,12 +238,12 @@ If you already have a reverse proxy (Nginx, Caddy, etc.), use either method: Using `-f` flags: ```bash -docker compose -f docker-compose.yml -f weboffice/collabora.yml -f external-proxy/opencloud.yml -f external-proxy/collabora.yml up -d +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:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml +COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml ``` This exposes the necessary ports: @@ -240,10 +255,38 @@ This exposes the necessary ports: 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: +```bash +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 +> ``` + +- **Odoo**: include `odoo/odoo-init.yml` on first start so volume ownership is fixed automatically — see [scripts/odoo/README.md](scripts/odoo/README.md) +- **Gitea**: web UI via Traefik; SSH on host port **2222** — see [version-control/README.md](version-control/README.md) + +### 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](backup/README.md) and [backup/borgmatic-README.md](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 -OpenCloud Compose 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. +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 @@ -350,7 +393,7 @@ Key variables: |-------------------------------|-------------------------------------------------------|------------------------------| | `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) | +| `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) | @@ -408,19 +451,15 @@ mkdir -p /path/to/opencloud/{config,data} chown -R 1000:1000 /path/to/opencloud ``` -#### Odoo Volume Permissions (First-Time Setup) +#### Odoo volumes and first-time init -When deploying Odoo for the first time, the named volumes are created with root ownership by default. To allow Odoo to write to its filestore and other directories, fix the ownership before starting the services: +Odoo uses: -```bash -# Detect Odoo UID:GID and fix volume ownership -OG=$(docker run --rm odoo:19 sh -c "printf \"%s:%s\" \"\$(id -u odoo)\" \"\$(id -g odoo)\"") -for v in odoo-filestore odoo-db-data odoo-config odoo-logs odoo-web-data odoo-addons; do - docker run --rm -v "${v}:/data" alpine chown -R "$OG" /data -done -``` +- named volume `odoo-db-data` → `/var/lib/odoo` (filestore, sessions, attachments) +- named volume `odoo-config` → `/etc/odoo` +- bind mount `./odoo/addons` → `/mnt/extra-addons` -This ensures Odoo can create attachments, logs, and configuration files without permission errors. +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](scripts/odoo/README.md). #### Odoo startup page (Projects instead of Discuss) @@ -445,16 +484,21 @@ Requires the **Project** app to be installed (`depends: project`). This repository uses a modular approach with multiple compose files: -- `docker-compose.yml` - Core OpenCloud service -- `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/` - Traefik reverse proxy configurations -- `external-proxy/` - Configuration for external reverse proxies -- `radicale/` - Radicale configuration -- `config/` - Configuration files for OpenCloud, Keycloak, and LDAP +- `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 @@ -469,24 +513,34 @@ The `COMPOSE_FILE` environment variable is a powerful way to manage complex Dock Example configurations: +Baseline OpenCloud: +``` +COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml +``` + Production with Collabora: ``` -COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml +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:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/ldap-keycloak.yml +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:weboffice/collabora.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/collabora.yml:traefik/ldap-keycloak.yml +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:monitoring/monitoring.yml:traefik/opencloud.yml +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 @@ -494,7 +548,7 @@ COMPOSE_FILE=docker-compose.yml:monitoring/monitoring.yml:traefik/opencloud.yml For automated deployments, using the `COMPOSE_FILE` variable in `.env` is recommended: ``` -COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml +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. @@ -528,7 +582,7 @@ services: - **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). +- **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 -- 2.49.1