From a76eba4ea041f78640a5993ff9f0b1d8ed292d40 Mon Sep 17 00:00:00 2001 From: icyleaf Date: Thu, 7 Mar 2024 22:38:03 +0800 Subject: [PATCH] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=20docker=20=E8=AF=A6?= =?UTF-8?q?=E7=BB=86=E6=AD=A5=E9=AA=A4=E7=9A=84=E6=9C=80=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deployment/docker/step-by-step.md | 112 +++++++++++++++++- .../deployment/docker/step-by-step.md | 111 ++++++++++++++++- .../deployment/docker/step-by-step.md | 111 ++++++++++++++++- .../deployment/docker/step-by-step.md | 112 +++++++++++++++++- 4 files changed, 434 insertions(+), 12 deletions(-) diff --git a/docs/self-hosted/deployment/docker/step-by-step.md b/docs/self-hosted/deployment/docker/step-by-step.md index 77865885..5e70b64f 100644 --- a/docs/self-hosted/deployment/docker/step-by-step.md +++ b/docs/self-hosted/deployment/docker/step-by-step.md @@ -50,14 +50,16 @@ The configuration file will generate at least three services, using the first tw - `zealot-zealot`: Use reverse-generation gateway services to deliver core Web and API services - `zealot-postgres`: Database service - `zealot-redis`: Cache service +- `zealot-web`: Provides a reverse proxy gateway service for (services and certificates), optional. ### Create docker volumes for persistent storage Persistent storage Data: -- `zealot-data`: Uploaded apps, icons and debug files. -- `zealot-postgres`: Core database data -- `zealot-redis`: Hot cache and background jobs data +- `zealot-uploads`: Uploaded app file with extracted icon, uploaded debugging files. +- `zealot-backup`: backup files. +- `zealot-postgres`: Core database data. +- `zealot-redis`: Hot cache and background jobs data. ### Pull images @@ -139,3 +141,107 @@ volumes: type: none device: /data/zealot/postgres ``` + +## Complete example + +```yaml +version: "3.8" + +x-restart-policy: &restart_policy + restart: unless-stopped + +x-defaults: &defaults + <<: *restart_policy + image: ghcr.io/tryzealot/zealot:nightly + depends_on: + - redis + - postgres + env_file: .env + volumes: + - zealot-uploads:/app/public/uploads + - zealot-backup:/app/public/backup + - ./log:/app/log # Optional: persisting log files. + healthcheck: + test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost/health || exit 1"] + +services: + redis: + <<: *restart_policy + image: redis:7-alpine + command: redis-server + volumes: + - zealot-redis:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + postgres: + <<: *restart_policy + image: postgres:14-alpine + volumes: + - zealot-postgres:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ze@l0t + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres"] + zealot: + <<: *defaults + # Port mapping can be enabled without the need for reverse proxy, + # mutually exclusive with the web reverse proxy service below. + ports: + - "80:80" + # Optional: Use a reverse proxy to host SSL certificates and services. + web: + image: caddy:2-alpine + ports: + - "80:80" + - "443:443" + volumes: + - ./caddy/etc/caddy/Caddyfile:/etc/caddy/Caddyfile:ro + - ./caddy/etc/caddy/certs:/etc/caddy/certs:ro + env_file: .env + environment: + ACME_AGREE: "true" + +# There are three methods of persistence: +volumes: + # 1. docker compose inside volumes + - zealot-uploads + - zealot-backup + - zealot-redis + - zealot-postgres + + # 2. docker compose external volumes + zealot-uploads: + external: true + zealot-backup: + external: true + zealot-redis: + external: true + zealot-postgres: + external: true + + # 3. mount local path + zealot-uploads: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/zealot/uploads + zealot-backup: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/zealot/backup + zealot-redis: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/redis + zealot-postgres: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/postgres +``` diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/self-hosted/deployment/docker/step-by-step.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/self-hosted/deployment/docker/step-by-step.md index 6ce1b522..0f701775 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/self-hosted/deployment/docker/step-by-step.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/self-hosted/deployment/docker/step-by-step.md @@ -45,10 +45,9 @@ Github Container Registry: https://github.com/tryzealot/zealot/pkgs/container/ze ### 生成 docker-compose.yml -配置文件会生成至少四个服务(service),使用上面前两个证书方式会额外增加一个服务: +配置文件会生成至少三个服务(service),使用上面前两个证书方式会额外增加一个服务: - `zealot-zealot`: 核心 Web 和 API 服务 -- `zealot-worker`: 核心异步任务服务 - `zealot-postgres`: 数据库服务 - `zealot-redis`: 缓存服务 - `zealot-web`: 提供(服务和证书)反代的网关服务,非必需 @@ -57,7 +56,8 @@ Github Container Registry: https://github.com/tryzealot/zealot/pkgs/container/ze 存储持久化数据 -- `zealot-data`: 静态资源,JS、CSS、图片以及上传的应用、应用图标和调试文件 +- `zealot-uploads`: 上传应用和解析后的应用图标、上传的调试文件 +- `zealot-backup`: 备份计划生成备份文件 - `zealot-postgres`: 数据库数据 - `zealot-redis`: 缓存数据 @@ -136,3 +136,108 @@ volumes: type: none device: /data/zealot/postgres ``` + +## 完整范例 + +```yaml +version: "3.8" + +x-restart-policy: &restart_policy + restart: unless-stopped + +x-defaults: &defaults + <<: *restart_policy + image: ghcr.io/tryzealot/zealot:nightly + depends_on: + - redis + - postgres + env_file: .env + volumes: + - zealot-uploads:/app/public/uploads + - zealot-backup:/app/public/backup + - ./log:/app/log # 持久化日志文件,可选 + healthcheck: + test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost/health || exit 1"] + +services: + redis: + <<: *restart_policy + image: redis:7-alpine + command: redis-server + volumes: + - zealot-redis:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + postgres: + <<: *restart_policy + image: postgres:14-alpine + volumes: + - zealot-postgres:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ze@l0t + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres"] + zealot: + <<: *defaults + # 无需反代可开启端口映射,与下面 web 反代服务互斥 + ports: + - "80:80" + # 可选:使用反代托管 SSL 证书和服务 + web: + image: caddy:2-alpine + ports: + - "80:80" + - "443:443" + volumes: + - ./caddy/etc/caddy/Caddyfile:/etc/caddy/Caddyfile:ro + - ./caddy/etc/caddy/certs:/etc/caddy/certs:ro + env_file: .env + environment: + ACME_AGREE: "true" + + +# 持久化有三种方式: +volumes: + # 1. docker compose 内部自动生成 volumes + - zealot-uploads + - zealot-backup + - zealot-redis + - zealot-postgres + + # 2. docker compose 外部创建的 volumes + zealot-uploads: + external: true + zealot-backup: + external: true + zealot-redis: + external: true + zealot-postgres: + external: true + + + # 3. 挂载自定义本地路径 + zealot-uploads: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/zealot/uploads + zealot-backup: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/zealot/backup + zealot-redis: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/redis + zealot-postgres: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/postgres +``` diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-5.1.0/self-hosted/deployment/docker/step-by-step.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-5.1.0/self-hosted/deployment/docker/step-by-step.md index 6ce1b522..0f701775 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-5.1.0/self-hosted/deployment/docker/step-by-step.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-5.1.0/self-hosted/deployment/docker/step-by-step.md @@ -45,10 +45,9 @@ Github Container Registry: https://github.com/tryzealot/zealot/pkgs/container/ze ### 生成 docker-compose.yml -配置文件会生成至少四个服务(service),使用上面前两个证书方式会额外增加一个服务: +配置文件会生成至少三个服务(service),使用上面前两个证书方式会额外增加一个服务: - `zealot-zealot`: 核心 Web 和 API 服务 -- `zealot-worker`: 核心异步任务服务 - `zealot-postgres`: 数据库服务 - `zealot-redis`: 缓存服务 - `zealot-web`: 提供(服务和证书)反代的网关服务,非必需 @@ -57,7 +56,8 @@ Github Container Registry: https://github.com/tryzealot/zealot/pkgs/container/ze 存储持久化数据 -- `zealot-data`: 静态资源,JS、CSS、图片以及上传的应用、应用图标和调试文件 +- `zealot-uploads`: 上传应用和解析后的应用图标、上传的调试文件 +- `zealot-backup`: 备份计划生成备份文件 - `zealot-postgres`: 数据库数据 - `zealot-redis`: 缓存数据 @@ -136,3 +136,108 @@ volumes: type: none device: /data/zealot/postgres ``` + +## 完整范例 + +```yaml +version: "3.8" + +x-restart-policy: &restart_policy + restart: unless-stopped + +x-defaults: &defaults + <<: *restart_policy + image: ghcr.io/tryzealot/zealot:nightly + depends_on: + - redis + - postgres + env_file: .env + volumes: + - zealot-uploads:/app/public/uploads + - zealot-backup:/app/public/backup + - ./log:/app/log # 持久化日志文件,可选 + healthcheck: + test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost/health || exit 1"] + +services: + redis: + <<: *restart_policy + image: redis:7-alpine + command: redis-server + volumes: + - zealot-redis:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + postgres: + <<: *restart_policy + image: postgres:14-alpine + volumes: + - zealot-postgres:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ze@l0t + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres"] + zealot: + <<: *defaults + # 无需反代可开启端口映射,与下面 web 反代服务互斥 + ports: + - "80:80" + # 可选:使用反代托管 SSL 证书和服务 + web: + image: caddy:2-alpine + ports: + - "80:80" + - "443:443" + volumes: + - ./caddy/etc/caddy/Caddyfile:/etc/caddy/Caddyfile:ro + - ./caddy/etc/caddy/certs:/etc/caddy/certs:ro + env_file: .env + environment: + ACME_AGREE: "true" + + +# 持久化有三种方式: +volumes: + # 1. docker compose 内部自动生成 volumes + - zealot-uploads + - zealot-backup + - zealot-redis + - zealot-postgres + + # 2. docker compose 外部创建的 volumes + zealot-uploads: + external: true + zealot-backup: + external: true + zealot-redis: + external: true + zealot-postgres: + external: true + + + # 3. 挂载自定义本地路径 + zealot-uploads: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/zealot/uploads + zealot-backup: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/zealot/backup + zealot-redis: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/redis + zealot-postgres: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/postgres +``` diff --git a/versioned_docs/version-5.1.0/self-hosted/deployment/docker/step-by-step.md b/versioned_docs/version-5.1.0/self-hosted/deployment/docker/step-by-step.md index 77865885..5e70b64f 100644 --- a/versioned_docs/version-5.1.0/self-hosted/deployment/docker/step-by-step.md +++ b/versioned_docs/version-5.1.0/self-hosted/deployment/docker/step-by-step.md @@ -50,14 +50,16 @@ The configuration file will generate at least three services, using the first tw - `zealot-zealot`: Use reverse-generation gateway services to deliver core Web and API services - `zealot-postgres`: Database service - `zealot-redis`: Cache service +- `zealot-web`: Provides a reverse proxy gateway service for (services and certificates), optional. ### Create docker volumes for persistent storage Persistent storage Data: -- `zealot-data`: Uploaded apps, icons and debug files. -- `zealot-postgres`: Core database data -- `zealot-redis`: Hot cache and background jobs data +- `zealot-uploads`: Uploaded app file with extracted icon, uploaded debugging files. +- `zealot-backup`: backup files. +- `zealot-postgres`: Core database data. +- `zealot-redis`: Hot cache and background jobs data. ### Pull images @@ -139,3 +141,107 @@ volumes: type: none device: /data/zealot/postgres ``` + +## Complete example + +```yaml +version: "3.8" + +x-restart-policy: &restart_policy + restart: unless-stopped + +x-defaults: &defaults + <<: *restart_policy + image: ghcr.io/tryzealot/zealot:nightly + depends_on: + - redis + - postgres + env_file: .env + volumes: + - zealot-uploads:/app/public/uploads + - zealot-backup:/app/public/backup + - ./log:/app/log # Optional: persisting log files. + healthcheck: + test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost/health || exit 1"] + +services: + redis: + <<: *restart_policy + image: redis:7-alpine + command: redis-server + volumes: + - zealot-redis:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + postgres: + <<: *restart_policy + image: postgres:14-alpine + volumes: + - zealot-postgres:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ze@l0t + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres"] + zealot: + <<: *defaults + # Port mapping can be enabled without the need for reverse proxy, + # mutually exclusive with the web reverse proxy service below. + ports: + - "80:80" + # Optional: Use a reverse proxy to host SSL certificates and services. + web: + image: caddy:2-alpine + ports: + - "80:80" + - "443:443" + volumes: + - ./caddy/etc/caddy/Caddyfile:/etc/caddy/Caddyfile:ro + - ./caddy/etc/caddy/certs:/etc/caddy/certs:ro + env_file: .env + environment: + ACME_AGREE: "true" + +# There are three methods of persistence: +volumes: + # 1. docker compose inside volumes + - zealot-uploads + - zealot-backup + - zealot-redis + - zealot-postgres + + # 2. docker compose external volumes + zealot-uploads: + external: true + zealot-backup: + external: true + zealot-redis: + external: true + zealot-postgres: + external: true + + # 3. mount local path + zealot-uploads: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/zealot/uploads + zealot-backup: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/zealot/backup + zealot-redis: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/redis + zealot-postgres: + driver: local + driver_opts: + o: bind + type: none + device: /tmp/postgres +```