From f71dcaee68e3e666e8cdbf95b1a6c6f72ac814e1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 Aug 2025 06:42:54 +0000 Subject: [PATCH 1/3] Initial plan From 4e44a1beaafa68b29c029d995fa3c9b7d1d47aa4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 Aug 2025 06:49:40 +0000 Subject: [PATCH 2/3] Enhanced Weblate docker-compose project with standardized syntax and comprehensive configuration Co-authored-by: chendelin1982 <16741975+chendelin1982@users.noreply.github.com> --- apps/weblate/.env | 30 +++++++++++++++++++++- apps/weblate/Notes.md | 41 +++++++++++++++++++++++++++++-- apps/weblate/docker-compose.yml | 29 ++++++++++++++++++++-- apps/weblate/src/nginx_proxy.conf | 19 ++++++++++++++ 4 files changed, 114 insertions(+), 5 deletions(-) create mode 100644 apps/weblate/src/nginx_proxy.conf diff --git a/apps/weblate/.env b/apps/weblate/.env index c327620fc..2a1ecd4e5 100644 --- a/apps/weblate/.env +++ b/apps/weblate/.env @@ -9,6 +9,8 @@ W9_LOGIN_USER=weblate.admin@example.com W9_LOGIN_PASSWORD=$W9_POWER_PASSWORD W9_DB_EXPOSE="postgresql" W9_URL='internet_ip:$W9_HTTP_PORT_SET' +W9_URL_REPLACE=true +W9_ADMIN_PATH="" W9_NETWORK=websoft9 #### ----------------------------------------------------------------------------------------- #### @@ -16,18 +18,44 @@ W9_NETWORK=websoft9 # Below environment is created by this app +# Core Weblate settings WEBLATE_SITE_DOMAIN=$W9_URL WEBLATE_ADMIN_EMAIL=$W9_LOGIN_USER WEBLATE_ADMIN_PASSWORD=$W9_POWER_PASSWORD + +# Database connection (PostgreSQL) POSTGRES_DB=weblate POSTGRES_PASSWORD=$W9_POWER_PASSWORD POSTGRES_USER=weblate POSTGRES_HOST=$W9_ID-db +WEBLATE_DATABASE_HOST=$W9_ID-db +WEBLATE_DATABASE_NAME=weblate +WEBLATE_DATABASE_USER=weblate +WEBLATE_DATABASE_PASSWORD=$W9_POWER_PASSWORD + +# Cache connection (Redis) +REDIS_HOST=$W9_ID-cache +WEBLATE_REDIS_HOST=$W9_ID-cache +WEBLATE_CACHE_HOST=$W9_ID-cache + +# Security settings +WEBLATE_SECRET_KEY=changeme-weblate-secret-key +WEBLATE_ALLOWED_HOSTS=* + +# Registration and user settings +WEBLATE_REGISTRATION_OPEN=1 +WEBLATE_REGISTRATION_ALLOW_BACKENDS=email + +# Internationalization settings +WEBLATE_TIME_ZONE=UTC +WEBLATE_USE_TZ=1 -# 通过下面这些变量配置SMTP +# Optional: SMTP configuration (uncomment and configure as needed) # WEBLATE_EMAIL_HOST=smtp.example.com +# WEBLATE_EMAIL_PORT=587 # WEBLATE_EMAIL_HOST_USER=user # WEBLATE_EMAIL_HOST_PASSWORD=pass +# WEBLATE_EMAIL_USE_TLS=1 # WEBLATE_SERVER_EMAIL=weblate@example.com # WEBLATE_DEFAULT_FROM_EMAIL=weblate@example.com diff --git a/apps/weblate/Notes.md b/apps/weblate/Notes.md index 5e291e02a..39b83cc1b 100644 --- a/apps/weblate/Notes.md +++ b/apps/weblate/Notes.md @@ -1,6 +1,6 @@ -# weblate +# Weblate -1、Websoft9 控制台安装 Dify 后,通过**我的应用**查看应用详情,在**访问**标签页中获取访问URL。 +1、Websoft9 控制台安装 Weblate 后,通过**我的应用**查看应用详情,在**访问**标签页中获取访问URL。 2、在**访问**标签页中获取初始账号,完成登录后请修改账户。 @@ -8,3 +8,40 @@ - 通过**我的应用**查看应用详情,在**编排**标签页中选择修改当前应用git仓库; - 在.env文件内配置对应SMTP环境变量配置; - 修改成功后重建应用。 + +## 配置要点 + +### 初始设置 +- 默认管理员邮箱:由 `WEBLATE_ADMIN_EMAIL` 环境变量设置 +- 默认管理员密码:由 `WEBLATE_ADMIN_PASSWORD` 环境变量设置 +- 网站域名:由 `WEBLATE_SITE_DOMAIN` 环境变量设置 + +### 数据库连接 +- 使用 PostgreSQL 17-alpine 作为数据库 +- 连接字符串:`postgresql://weblate:password@weblate-db/weblate` +- 数据持久化存储在 `postgres_data` 卷中 + +### 缓存设置 +- 使用 Redis 8-alpine 作为缓存服务器 +- 缓存主机:`weblate-cache` +- 数据持久化存储在 `redis_data` 卷中 + +### 国际化支持 +- 时区设置:UTC(可通过 `WEBLATE_TIME_ZONE` 修改) +- 支持多语言界面和翻译项目管理 + +### 注册设置 +- 默认开启用户注册(`WEBLATE_REGISTRATION_OPEN=1`) +- 支持邮箱注册验证 + +### SMTP 邮件配置 +在 .env 文件中取消注释并配置相关 SMTP 变量: +``` +WEBLATE_EMAIL_HOST=smtp.example.com +WEBLATE_EMAIL_PORT=587 +WEBLATE_EMAIL_HOST_USER=your-email@example.com +WEBLATE_EMAIL_HOST_PASSWORD=your-app-password +WEBLATE_EMAIL_USE_TLS=1 +WEBLATE_SERVER_EMAIL=weblate@example.com +WEBLATE_DEFAULT_FROM_EMAIL=weblate@example.com +``` diff --git a/apps/weblate/docker-compose.yml b/apps/weblate/docker-compose.yml index fb71470c2..097e8d86d 100644 --- a/apps/weblate/docker-compose.yml +++ b/apps/weblate/docker-compose.yml @@ -10,6 +10,11 @@ services: read_only: true volumes: - redis_data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 30s + timeout: 10s + retries: 3 database: image: postgres:17-alpine @@ -21,6 +26,11 @@ services: - POSTGRES_DB=$POSTGRES_DB volumes: - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"] + interval: 30s + timeout: 10s + retries: 5 weblate: image: $W9_REPO:$W9_VERSION @@ -29,8 +39,12 @@ services: - $W9_HTTP_PORT_SET:8080 restart: unless-stopped depends_on: - - cache - - database + cache: + condition: service_healthy + restart: true + database: + condition: service_healthy + restart: true env_file: .env volumes: - weblate_data:/app/data @@ -39,6 +53,17 @@ services: tmpfs: - /run - /tmp + logging: + driver: "json-file" + options: + max-file: "5" + max-size: 10m + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/healthz/"] + interval: 30s + timeout: 10s + retries: 5 + start_period: 60s diff --git a/apps/weblate/src/nginx_proxy.conf b/apps/weblate/src/nginx_proxy.conf new file mode 100644 index 000000000..d550914cf --- /dev/null +++ b/apps/weblate/src/nginx_proxy.conf @@ -0,0 +1,19 @@ +location / { + proxy_pass $forward_scheme://$server:$port$request_uri; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + + # WebSocket support for Weblate real-time features + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + # Increase timeouts for translation operations + proxy_connect_timeout 60s; + proxy_send_timeout 60s; + proxy_read_timeout 60s; +} \ No newline at end of file From 43d45ea1e5b0330db2e852ad52bcef5407528146 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 Aug 2025 06:52:23 +0000 Subject: [PATCH 3/3] Final enhancements: Fix variables.json URL and update CHANGELOG.md Co-authored-by: chendelin1982 <16741975+chendelin1982@users.noreply.github.com> --- apps/weblate/CHANGELOG.md | 8 ++++++++ apps/weblate/variables.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/weblate/CHANGELOG.md b/apps/weblate/CHANGELOG.md index 582cf46c5..c674b9260 100644 --- a/apps/weblate/CHANGELOG.md +++ b/apps/weblate/CHANGELOG.md @@ -3,3 +3,11 @@ ## Release ### Fixes and Enhancements +- Enhanced docker-compose.yml with health checks for all services (Redis, PostgreSQL, Weblate) +- Added proper service dependencies with health check conditions +- Implemented logging configuration with rotation limits +- Comprehensive environment variable configuration for all Weblate features +- Added nginx_proxy.conf for reverse proxy support with WebSocket compatibility +- Updated Notes.md with detailed configuration instructions +- Added internationalization and SMTP configuration support + diff --git a/apps/weblate/variables.json b/apps/weblate/variables.json index d8a62dcb1..5ffbc860f 100644 --- a/apps/weblate/variables.json +++ b/apps/weblate/variables.json @@ -3,7 +3,7 @@ "trademark": "Weblate", "release": false, "fork_url": "https://github.com/WeblateOrg/weblate", - "version_from": "https:/hub.docker.com/r/weblate/weblate/tags", + "version_from": "https://hub.docker.com/r/weblate/weblate/tags", "edition": [ { "dist": "community",