Upload files to "/"
This commit is contained in:
1 parent
891040a56c
commit
54082d8c6e
2 files changed
+303
No files matched your search
@@ -0,0 +1,203 @@
|
|||||||
|
# OpenClaw Homelab Stack
|
||||||
|
|
||||||
|
Docker Compose deployment for OpenClaw, WireGuard UI (wg-easy), Gitea, Nginx Proxy Manager, and MariaDB.
|
||||||
|
|
||||||
|
The Compose file is [compose.yaml](./compose.yaml).
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Debian 12 or another Linux host
|
||||||
|
- Public DNS name or static public IP for WireGuard
|
||||||
|
- At least 2 GB RAM recommended
|
||||||
|
- Available host ports: 80/tcp, 443/tcp, 81/tcp, 51820/udp, 18789/tcp, 3000/tcp, 2222/tcp, and 51821/tcp
|
||||||
|
|
||||||
|
## Install Docker Engine and Compose
|
||||||
|
|
||||||
|
Run as root or an account with sudo access:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y ca-certificates curl
|
||||||
|
sudo install -m 0755 -d /etc/apt/keyrings
|
||||||
|
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||||
|
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||||
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo \"$VERSION_CODENAME\") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
sudo systemctl enable --now docker
|
||||||
|
sudo usermod -aG docker "$USER"
|
||||||
|
```
|
||||||
|
|
||||||
|
Log out and back in, then verify:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker version
|
||||||
|
docker compose version
|
||||||
|
```
|
||||||
|
|
||||||
|
This OpenClaw workspace has no root or sudo, so Docker Engine cannot be installed directly here. A standalone Compose CLI at .local/bin/docker-compose can validate YAML but cannot start containers without a Docker daemon.
|
||||||
|
|
||||||
|
## Configure secrets and host settings
|
||||||
|
|
||||||
|
From the directory containing docker-compose.yaml, create .env:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat > .env <<'EOF'
|
||||||
|
TZ=UTC
|
||||||
|
OPENCLAW_PORT=18789
|
||||||
|
|
||||||
|
# Public WireGuard endpoint
|
||||||
|
WG_HOST=vpn.example.com
|
||||||
|
WG_PORT=51820
|
||||||
|
WG_UI_PORT=51821
|
||||||
|
WG_UI_USERNAME=admin
|
||||||
|
WG_UI_PASSWORD=replace-with-a-long-random-password
|
||||||
|
|
||||||
|
# Gitea
|
||||||
|
GITEA_DOMAIN=git.example.com
|
||||||
|
GITEA_ROOT_URL=https://git.example.com/
|
||||||
|
GITEA_HTTP_PORT=3000
|
||||||
|
GITEA_SSH_PORT=2222
|
||||||
|
|
||||||
|
# Nginx Proxy Manager database
|
||||||
|
NPM_DB_NAME=npm
|
||||||
|
NPM_DB_USER=npm
|
||||||
|
NPM_DB_PASSWORD=replace-with-a-long-random-password
|
||||||
|
NPM_DB_ROOT_PASSWORD=replace-with-a-different-long-random-password
|
||||||
|
NPM_HTTP_PORT=80
|
||||||
|
NPM_ADMIN_PORT=81
|
||||||
|
NPM_HTTPS_PORT=443
|
||||||
|
EOF
|
||||||
|
chmod 600 .env
|
||||||
|
```
|
||||||
|
|
||||||
|
Use unique random values and never commit .env to Git.
|
||||||
|
|
||||||
|
## Validate and start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose config --quiet
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d
|
||||||
|
docker compose ps
|
||||||
|
docker compose logs -f --tail=100
|
||||||
|
```
|
||||||
|
|
||||||
|
The first startup may take a few minutes while images download and MariaDB initializes.
|
||||||
|
|
||||||
|
## Initial access
|
||||||
|
|
||||||
|
- Nginx Proxy Manager: http://SERVER_IP:81
|
||||||
|
- Default email: admin@example.com
|
||||||
|
- Default password: changeme
|
||||||
|
- Change both immediately.
|
||||||
|
- Gitea: http://SERVER_IP:3000
|
||||||
|
- WireGuard UI: http://SERVER_IP:51821
|
||||||
|
- OpenClaw gateway: http://SERVER_IP:18789 if configured for HTTP access.
|
||||||
|
|
||||||
|
For internet-facing deployments, place Gitea, OpenClaw, and the WireGuard UI behind Nginx Proxy Manager with HTTPS. Do not expose admin interfaces publicly without authentication and TLS.
|
||||||
|
|
||||||
|
## Configure Nginx Proxy Manager
|
||||||
|
|
||||||
|
1. Log in at port 81 and change the default credentials.
|
||||||
|
2. Create Proxy Hosts for the services you want to publish.
|
||||||
|
3. On the Compose network, use these forward hosts:
|
||||||
|
- gitea:3000
|
||||||
|
- openclaw:18789
|
||||||
|
- wireguard-ui:51821
|
||||||
|
4. Request Let's Encrypt certificates and enable Force SSL.
|
||||||
|
|
||||||
|
WireGuard itself remains UDP on 51820; proxying the web UI does not replace that port.
|
||||||
|
|
||||||
|
## Firewall example
|
||||||
|
|
||||||
|
Open only the ports required by your deployment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo ufw allow 80/tcp
|
||||||
|
sudo ufw allow 443/tcp
|
||||||
|
sudo ufw allow 51820/udp
|
||||||
|
sudo ufw enable
|
||||||
|
```
|
||||||
|
|
||||||
|
Do not expose ports 81, 18789, 3000, 2222, or 51821 to the whole internet unless needed. Restrict them to your management network or VPN.
|
||||||
|
|
||||||
|
## Updates and shutdown
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d
|
||||||
|
docker image prune
|
||||||
|
```
|
||||||
|
|
||||||
|
Stop without deleting data:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
Never use docker compose down -v unless you intentionally want to delete persistent application data. Back up named volumes before upgrades.
|
||||||
|
|
||||||
|
## Backups
|
||||||
|
|
||||||
|
Back up these data sets:
|
||||||
|
|
||||||
|
- OpenClaw configuration and data
|
||||||
|
- WireGuard configuration and keys
|
||||||
|
- Gitea repositories and /data
|
||||||
|
- Nginx Proxy Manager /data and /etc/letsencrypt
|
||||||
|
- Nginx Proxy Manager MariaDB data
|
||||||
|
|
||||||
|
List volumes with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker volume ls | grep -E 'openclaw|wireguard|gitea|npm'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose ps
|
||||||
|
docker compose logs -f openclaw
|
||||||
|
docker compose logs -f wireguard-ui
|
||||||
|
docker compose logs -f gitea
|
||||||
|
docker compose logs -f nginx-proxy-manager
|
||||||
|
```
|
||||||
|
|
||||||
|
After changing .env or the Compose file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d --force-recreate
|
||||||
|
```
|
||||||
|
|
||||||
|
If a port is already in use, change the host-side variable in .env and rerun deployment. Keep container-side ports in docker-compose.yaml unchanged.
|
||||||
|
## Automated configuration tests
|
||||||
|
|
||||||
|
Gitea Actions runs `.gitea/workflows/test.yml` on every push, pull request,
|
||||||
|
and manual dispatch. It requires a Linux x86-64 runner labelled
|
||||||
|
`ubuntu-latest`, with outbound HTTPS access to GitHub for pinned tooling.
|
||||||
|
|
||||||
|
This repository contains deployment configuration, not application source.
|
||||||
|
The five Python standard-library tests validate the actual Compose schema,
|
||||||
|
service inventory and persistent storage, database health dependency,
|
||||||
|
WireGuard UI binding/TLS setting and UDP port, custom port/database settings,
|
||||||
|
and rejection of missing database passwords. There is no application build,
|
||||||
|
linter or existing application test suite to run.
|
||||||
|
|
||||||
|
Run the same checks locally with Python 3.13.9 and Docker Compose v5.6.1:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
COMPOSE_BINARY=/absolute/path/to/docker-compose python3 scripts/test_compose.py
|
||||||
|
```
|
||||||
|
|
||||||
|
`COMPOSE_BINARY` must point to the standalone Compose CLI (the Docker CLI
|
||||||
|
plugin binary also works). CI verifies its pinned SHA-256 before execution.
|
||||||
|
No Python packages, Docker daemon, production credentials or deployed services
|
||||||
|
are needed. Tests use a temporary copy of `compose.yaml`, an empty env file,
|
||||||
|
a clean subprocess environment and synthetic passwords; the repository's
|
||||||
|
`.env` is never loaded. Nothing is started, pulled or deployed by the tests.
|
||||||
|
These are configuration regression checks, not live integration/health tests.
|
||||||
|
|
||||||
|
The workflow has a ten-minute timeout, read-only contents permissions and no
|
||||||
|
persisted checkout credentials. Use an isolated, unprivileged runner for
|
||||||
|
untrusted pull requests; do not mount production secrets or a Docker socket.
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
name: homelab
|
||||||
|
|
||||||
|
services:
|
||||||
|
wireguard-ui:
|
||||||
|
image: ghcr.io/wg-easy/wg-easy:15.4.0@sha256:0e7bc9d34e86ddcaa92bc700d4d7dc9b33291dbc07ac8d13382f7c2095f949ec
|
||||||
|
container_name: wireguard-ui
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
TZ: ${TZ:-UTC}
|
||||||
|
PORT: 51821
|
||||||
|
DISABLE_IPV6: "true"
|
||||||
|
INSECURE: "false"
|
||||||
|
volumes:
|
||||||
|
- wireguard_data:/etc/wireguard
|
||||||
|
ports:
|
||||||
|
- "${WG_PORT:-51820}:51820/udp"
|
||||||
|
- "127.0.0.1:${WG_UI_PORT:-51821}:51821/tcp"
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- SYS_MODULE
|
||||||
|
sysctls:
|
||||||
|
net.ipv4.ip_forward: "1"
|
||||||
|
net.ipv4.conf.all.src_valid_mark: "1"
|
||||||
|
networks:
|
||||||
|
- apps
|
||||||
|
|
||||||
|
gitea:
|
||||||
|
image: gitea/gitea:latest
|
||||||
|
container_name: gitea
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
USER_UID: ${GITEA_UID:-1000}
|
||||||
|
USER_GID: ${GITEA_GID:-1000}
|
||||||
|
GITEA__server__DOMAIN: ${GITEA_DOMAIN:-localhost}
|
||||||
|
GITEA__server__ROOT_URL: ${GITEA_ROOT_URL:-http://localhost:3000/}
|
||||||
|
GITEA__server__SSH_PORT: ${GITEA_SSH_PORT:-2222}
|
||||||
|
volumes:
|
||||||
|
- gitea_data:/data
|
||||||
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
ports:
|
||||||
|
- "${GITEA_HTTP_PORT:-3000}:3000"
|
||||||
|
- "${GITEA_SSH_PORT:-2222}:22"
|
||||||
|
networks:
|
||||||
|
- apps
|
||||||
|
|
||||||
|
nginx-proxy-manager:
|
||||||
|
image: jc21/nginx-proxy-manager:latest
|
||||||
|
container_name: nginx-proxy-manager
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
TZ: ${TZ:-UTC}
|
||||||
|
DB_MYSQL_HOST: npm-db
|
||||||
|
DB_MYSQL_PORT: 3306
|
||||||
|
DB_MYSQL_USER: ${NPM_DB_USER:-npm}
|
||||||
|
DB_MYSQL_PASSWORD: ${NPM_DB_PASSWORD:?Set NPM_DB_PASSWORD before starting the stack}
|
||||||
|
DB_MYSQL_NAME: ${NPM_DB_NAME:-npm}
|
||||||
|
volumes:
|
||||||
|
- npm_data:/data
|
||||||
|
- npm_letsencrypt:/etc/letsencrypt
|
||||||
|
ports:
|
||||||
|
- "${NPM_HTTP_PORT:-80}:80"
|
||||||
|
- "${NPM_ADMIN_PORT:-81}:81"
|
||||||
|
- "${NPM_HTTPS_PORT:-443}:443"
|
||||||
|
depends_on:
|
||||||
|
npm-db:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- apps
|
||||||
|
|
||||||
|
npm-db:
|
||||||
|
image: mariadb:11
|
||||||
|
container_name: npm-db
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
MARIADB_DATABASE: ${NPM_DB_NAME:-npm}
|
||||||
|
MARIADB_USER: ${NPM_DB_USER:-npm}
|
||||||
|
MARIADB_PASSWORD: ${NPM_DB_PASSWORD:?Set NPM_DB_PASSWORD before starting the stack}
|
||||||
|
MARIADB_ROOT_PASSWORD: ${NPM_DB_ROOT_PASSWORD:?Set NPM_DB_ROOT_PASSWORD before starting the stack}
|
||||||
|
volumes:
|
||||||
|
- npm_db_data:/var/lib/mysql
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
networks:
|
||||||
|
- apps
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
wireguard_data:
|
||||||
|
gitea_data:
|
||||||
|
npm_data:
|
||||||
|
npm_letsencrypt:
|
||||||
|
npm_db_data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
apps:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
Reference in new issue
Block a user