Commit c61bf2
2026-01-29 17:59:51 Freedom: wechat-official-editor| /dev/null .. wechat-official-editor.md | |
| @@ 0,0 1,122 @@ | |
| + | # Wechat-Official-Editor |
| + | |
| + | ## Goal |
| + | |
| + | * Run the WeChat Official Account editor as a Docker container. |
| + | * Persist data with volumes. |
| + | * Expose it at `woeditor.manxialiu.org` behind Nginx + TLS. |
| + | |
| + | ## Prerequisites |
| + | |
| + | * A working Docker + Docker Compose setup. |
| + | * An Nginx reverse proxy container (or host Nginx). |
| + | * A Certbot flow that can issue/renew certs for `woeditor.manxialiu.org`. |
| + | |
| + | I’m assuming you already use the shared `nginx` + `certbot` pattern from the other services. |
| + | |
| + | ## Docker Compose service |
| + | |
| + | Add a service to your existing `compose.yml`. |
| + | |
| + | Replace: |
| + | |
| + | * `REPLACE_WITH_IMAGE` with the actual image name. |
| + | * `INTERNAL_PORT` with the port the app listens on inside the container. |
| + | |
| + | ```yaml |
| + | woeditor: |
| + | image: REPLACE_WITH_IMAGE |
| + | container_name: woeditor |
| + | restart: unless-stopped |
| + | environment: |
| + | TZ: "UTC" |
| + | # Add app-specific env vars here. |
| + | volumes: |
| + | - ./woeditor/data:/data |
| + | # Add other persistent paths required by the app. |
| + | expose: |
| + | - "INTERNAL_PORT" |
| + | ``` |
| + | |
| + | |
| + | Don’t publish the app port directly (`ports:`) if Nginx is the only entry point. Use `expose:` so it stays internal to the Docker network. |
| + | |
| + | ## Nginx reverse proxy config |
| + | |
| + | Add a server block for the subdomain. |
| + | |
| + | ```yaml |
| + | version: "3.9" |
| + | |
| + | services: |
| + | certbot: |
| + | image: certbot/certbot:latest |
| + | container_name: certbot |
| + | volumes: |
| + | - ./certbot/www:/var/www/certbot |
| + | - ./certbot/conf:/etc/letsencrypt |
| + | |
| + | nginx: |
| + | image: nginx:alpine |
| + | container_name: nginx |
| + | restart: unless-stopped |
| + | depends_on: |
| + | - freshrss |
| + | - wallabag |
| + | ports: |
| + | - "80:80" |
| + | - "443:443" |
| + | volumes: |
| + | - ./nginx/conf.d:/etc/nginx/conf.d:ro |
| + | - ./certbot/www:/var/www/certbot:ro |
| + | - ./certbot/conf:/etc/letsencrypt:ro |
| + | |
| + | woeditor: |
| + | image: wechatofficial:latest |
| + | container_name: woeditor |
| + | ports: |
| + | - "5173:5173" |
| + | environment: |
| + | - NODE_ENV=development |
| + | # Hot reload: mount your code into the container |
| + | volumes: |
| + | - ./WechatOfficialEditor:/app |
| + | # Keep container's node_modules (avoids overwriting by the bind mount) |
| + | - /app/node_modules |
| + | command: pnpm web dev --host 0.0.0.0 --port 5173 |
| + | ``` |
| + | |
| + | ## Certificates |
| + | |
| + | If you’re using a single SAN cert, add `woeditor.manxialiu.org` to the cert request and re-run Certbot. |
| + | |
| + | ```bash |
| + | docker compose run --rm certbot certonly \ |
| + | --webroot -w /var/www/certbot \ |
| + | -d woeditor.manxialiu.org \ |
| + | --email you@example.com \ |
| + | --agree-tos \ |
| + | --no-eff-email |
| + | ``` |
| + | |
| + | ## Bring it up |
| + | |
| + | ```bash |
| + | docker compose up -d woeditor nginx |
| + | ``` |
| + | |
| + | Quick checks: |
| + | |
| + | * `docker compose ps` |
| + | * `docker logs -f woeditor` |
| + | * `curl -I https://woeditor.manxialiu.org` |
| + | |
| + | ## What I need from you to make this exact |
| + | |
| + | Send these and I’ll tighten the section with concrete values: |
| + | |
| + | * Docker image name (or repo URL) |
| + | * Internal port the app listens on |
| + | * Any required env vars |
| + | * Any DB requirement (Postgres/MariaDB/SQLite) |
| + | * Which paths must be persisted |
