Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion apps/weblate/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,53 @@ [email protected]
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

#### ----------------------------------------------------------------------------------------- ####


# 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
# [email protected]
# [email protected]

Expand Down
8 changes: 8 additions & 0 deletions apps/weblate/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

41 changes: 39 additions & 2 deletions apps/weblate/Notes.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
# weblate
# Weblate

1、Websoft9 控制台安装 Dify 后,通过**我的应用**查看应用详情,在**访问**标签页中获取访问URL。
1、Websoft9 控制台安装 Weblate 后,通过**我的应用**查看应用详情,在**访问**标签页中获取访问URL。

2、在**访问**标签页中获取初始账号,完成登录后请修改账户。

3、配置SMTP(可选):
- 通过**我的应用**查看应用详情,在**编排**标签页中选择修改当前应用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
[email protected]
WEBLATE_EMAIL_HOST_PASSWORD=your-app-password
WEBLATE_EMAIL_USE_TLS=1
[email protected]
[email protected]
```
29 changes: 27 additions & 2 deletions apps/weblate/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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



Expand Down
19 changes: 19 additions & 0 deletions apps/weblate/src/nginx_proxy.conf
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion apps/weblate/variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down