From 7616ff9f89fe75c357a9a58016f215d2782346ab Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 5 Oct 2026 10:49:47 +0700 Subject: [PATCH] feat(owncloud): add ownCloud with MariaDB and Redis --- README.md | 1 + owncloud/.env.example | 17 +++++++++++ owncloud/README.md | 57 +++++++++++++++++++++++++++++++++++++ owncloud/compose.yml | 66 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 owncloud/.env.example create mode 100644 owncloud/README.md create mode 100644 owncloud/compose.yml diff --git a/README.md b/README.md index 410b934..f4f9c92 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ Each links to its own README for variables, ports, and storage. | [litellm](litellm/README.md) | LiteLLM proxy in front of many LLM providers, with PostgreSQL and Redis | | [open-webui](open-webui/README.md) | Open WebUI chat interface for OpenAI-compatible and Ollama providers | | [opencode](opencode/README.md) | opencode coding agent, served as a browser UI | +| [owncloud](owncloud/README.md) | ownCloud file sync and share, with MariaDB and Redis | | [paseo](paseo/README.md) | Paseo coding-agent daemon and web UI | | [traffmonetizer](traffmonetizer/README.md) | TraffMonetizer bandwidth-sharing client | | [webtop](webtop/README.md) | Ubuntu XFCE desktop in the browser | diff --git a/owncloud/.env.example b/owncloud/.env.example new file mode 100644 index 0000000..634ec36 --- /dev/null +++ b/owncloud/.env.example @@ -0,0 +1,17 @@ +# Copy to .env and fill in. Never commit .env. +# +# cp .env.example .env + +# Public hostname, without scheme. Also the only trusted domain. +OWNCLOUD_DOMAIN=owncloud.example.com + +# Admin account, created on first start only. +# Generate a password with: openssl rand -base64 24 +OWNCLOUD_ADMIN_USERNAME=admin +OWNCLOUD_ADMIN_PASSWORD= + +# MariaDB credentials, used by the database and by ownCloud. +DB_NAME=owncloud +DB_USER=owncloud +DB_PASSWORD= +DB_ROOT_PASSWORD= diff --git a/owncloud/README.md b/owncloud/README.md new file mode 100644 index 0000000..8dbbe10 --- /dev/null +++ b/owncloud/README.md @@ -0,0 +1,57 @@ +# owncloud + +[ownCloud](https://doc.owncloud.com/server/10.16/admin_manual/installation/docker/) +Server: file sync and share, with web, desktop and mobile clients. + +Three containers: `owncloud`, `mariadb` for metadata, users and shares, and +`redis` for file locking and the distributed cache. + +## Setup + +1. Set `OWNCLOUD_DOMAIN`, `OWNCLOUD_ADMIN_PASSWORD`, `DB_PASSWORD` and + `DB_ROOT_PASSWORD`. +2. Map the domain to port `8080` and deploy. The first start installs + ownCloud and creates the admin account. +3. Log in with `OWNCLOUD_ADMIN_USERNAME` / `OWNCLOUD_ADMIN_PASSWORD`. + +Health check: `/usr/bin/healthcheck`, the image's own script, also the compose +healthcheck. + +## Environment + +| Variable | Default | Purpose | +| --- | --- | --- | +| `OWNCLOUD_DOMAIN` | — | Public hostname, without scheme | +| `OWNCLOUD_ADMIN_USERNAME` / `OWNCLOUD_ADMIN_PASSWORD` | `admin` / — | Admin account | +| `DB_NAME` / `DB_USER` / `DB_PASSWORD` | `owncloud` / `owncloud` / — | Database credentials, read by both containers | +| `DB_ROOT_PASSWORD` | — | MariaDB root password | + +`OWNCLOUD_DOMAIN` also fills `OWNCLOUD_TRUSTED_DOMAINS`; ownCloud rejects +requests for any host not on that list. + +The admin variables are read only by the first-start install. Changing them +later does not change the account; use the web UI or `occ user:resetpassword`. + +The database credentials are stored inside the MariaDB data directory when it +is first created. Changing them in the environment afterwards breaks the +connection rather than changing the password. + +## Storage + +| Volume | Mount | Holds | +| --- | --- | --- | +| `owncloud-data` | `/mnt/data` | User files, apps, `config.php` | +| `owncloud-mysql-data` | `/var/lib/mysql` | The database | + +Redis has no named volume. It holds only locks and cache, which ownCloud +rebuilds after a restart. + +## Images + +`owncloud/server:10` tracks the 10.x line. `latest` points at the same +release today, but ownCloud now also publishes 11.x, and a move to a new major +should be a deliberate upgrade with a backup, not a side effect of a pull. + +`mariadb:12` and `redis:6` track their major versions. A MariaDB data +directory cannot move back to an older major, so back up the database volume +before changing it. diff --git a/owncloud/compose.yml b/owncloud/compose.yml new file mode 100644 index 0000000..f4f7b3d --- /dev/null +++ b/owncloud/compose.yml @@ -0,0 +1,66 @@ +services: + owncloud: + image: owncloud/server:10 + restart: unless-stopped + environment: + - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN:?required} + - OWNCLOUD_TRUSTED_DOMAINS=${OWNCLOUD_DOMAIN:?required} + - OWNCLOUD_ADMIN_USERNAME=${OWNCLOUD_ADMIN_USERNAME:-admin} + - OWNCLOUD_ADMIN_PASSWORD=${OWNCLOUD_ADMIN_PASSWORD:?required} + - OWNCLOUD_DB_TYPE=mysql + - OWNCLOUD_DB_HOST=mariadb + - OWNCLOUD_DB_NAME=${DB_NAME:-owncloud} + - OWNCLOUD_DB_USERNAME=${DB_USER:-owncloud} + - OWNCLOUD_DB_PASSWORD=${DB_PASSWORD:?required} + - OWNCLOUD_MYSQL_UTF8MB4=true + - OWNCLOUD_REDIS_ENABLED=true + - OWNCLOUD_REDIS_HOST=redis + volumes: + - owncloud-data:/mnt/data + depends_on: + mariadb: + condition: service_healthy + redis: + condition: service_healthy + healthcheck: + test: ["CMD", "/usr/bin/healthcheck"] + interval: 30s + timeout: 10s + retries: 5 + + # MariaDB for file metadata, users and shares. + mariadb: + image: mariadb:12 + restart: unless-stopped + command: + - --character-set-server=utf8mb4 + - --collation-server=utf8mb4_bin + - --max-allowed-packet=128M + - --innodb-log-file-size=64M + environment: + - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:?required} + - MYSQL_DATABASE=${DB_NAME:-owncloud} + - MYSQL_USER=${DB_USER:-owncloud} + - MYSQL_PASSWORD=${DB_PASSWORD:?required} + volumes: + - owncloud-mysql-data:/var/lib/mysql + healthcheck: + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + interval: 5s + timeout: 20s + retries: 10 + + # Redis for file locking and the distributed cache. + redis: + image: redis:6 + restart: unless-stopped + command: ["--databases", "1"] + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + +volumes: + owncloud-data: + owncloud-mysql-data: