refactor: all-in-one docker deployment with auto-tuned resources and per-mode compose templates
This commit is contained in:
+18
-103
@@ -33,33 +33,20 @@ sudo bash quick_start.sh
|
||||
|
||||
2. Configure Reverse Proxy:
|
||||
```nginx
|
||||
location /ws/ {
|
||||
proxy_pass http://127.0.0.1:8076;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
|
||||
location ^~ / {
|
||||
proxy_pass http://127.0.0.1:7001;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-PORT $remote_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Scheme $scheme;
|
||||
proxy_set_header Server-Protocol $server_protocol;
|
||||
proxy_set_header Server-Name $server_name;
|
||||
proxy_set_header Server-Addr $server_addr;
|
||||
proxy_set_header Server-Port $server_port;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
}
|
||||
```
|
||||
> The `/ws/` location enables WebSocket real-time node synchronization via `ws-server`. This service is enabled by default and can be toggled in Admin Panel > System Settings > Server.
|
||||
> The all-in-one container's embedded Caddy fuses HTTP and the panel↔node WebSocket on port 7001. The single `Upgrade`/`Connection` pair above is enough; no separate `/ws/` location is needed. To opt out and expose Octane / `:8076` directly, set `ENABLE_CADDY=false` in `compose.yaml`.
|
||||
|
||||
3. Install Xboard:
|
||||
```bash
|
||||
@@ -74,85 +61,22 @@ yum update && yum install -y git
|
||||
|
||||
# Clone repository
|
||||
git clone -b compose --depth 1 https://github.com/cedar2025/Xboard ./
|
||||
# (Optional shortcut: skip the clone and just fetch the sample file with
|
||||
# curl -fsSL https://raw.githubusercontent.com/cedar2025/Xboard/master/compose.sample.yaml -o compose.yaml
|
||||
# — the running PHP code is in the Docker image, not in the clone.)
|
||||
|
||||
# Configure Docker Compose
|
||||
```
|
||||
|
||||
4. Edit compose.yaml:
|
||||
```yaml
|
||||
services:
|
||||
web:
|
||||
image: ghcr.io/cedar2025/xboard:new
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
- ./.env:/www/.env
|
||||
- ./.docker/.data/:/www/.docker/.data
|
||||
- ./storage/logs:/www/storage/logs
|
||||
- ./storage/theme:/www/storage/theme
|
||||
- ./plugins:/www/plugins
|
||||
environment:
|
||||
- docker=true
|
||||
depends_on:
|
||||
- redis
|
||||
command: php artisan octane:start --host=0.0.0.0 --port=7001
|
||||
restart: on-failure
|
||||
ports:
|
||||
- 7001:7001
|
||||
networks:
|
||||
- 1panel-network
|
||||
|
||||
horizon:
|
||||
image: ghcr.io/cedar2025/xboard:new
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
- ./.env:/www/.env
|
||||
- ./.docker/.data/:/www/.docker/.data
|
||||
- ./storage/logs:/www/storage/logs
|
||||
- ./plugins:/www/plugins
|
||||
restart: on-failure
|
||||
command: php artisan horizon
|
||||
networks:
|
||||
- 1panel-network
|
||||
depends_on:
|
||||
- redis
|
||||
ws-server:
|
||||
image: ghcr.io/cedar2025/xboard:new
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
- ./.env:/www/.env
|
||||
- ./.docker/.data/:/www/.docker/.data
|
||||
- ./storage/logs:/www/storage/logs
|
||||
- ./plugins:/www/plugins
|
||||
restart: on-failure
|
||||
ports:
|
||||
- 8076:8076
|
||||
networks:
|
||||
- 1panel-network
|
||||
command: php artisan ws-server start
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
command: redis-server --unixsocket /data/redis.sock --unixsocketperm 777
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- 1panel-network
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
|
||||
volumes:
|
||||
redis-data:
|
||||
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
||||
4. Prepare `compose.yaml` from the **1Panel-specific** sample. This sample joins the external `1panel-network` so the container can reach the 1Panel-managed MySQL/Redis containers by their hostname:
|
||||
```bash
|
||||
cp compose.1panel.sample.yaml compose.yaml
|
||||
```
|
||||
The file is gitignored so your edits survive `git pull`. See [docker-compose.md](./docker-compose.md) for tuning environment variables (`RESOURCE_PROFILE`, `ENABLE_HORIZON`, `ENABLE_REDIS`, etc.) and the other `compose.*.sample.yaml` alternatives.
|
||||
|
||||
5. Initialize Installation:
|
||||
```bash
|
||||
# Install dependencies and initialize
|
||||
docker compose run -it --rm web php artisan xboard:install
|
||||
docker compose run -it --rm xboard php artisan xboard:install
|
||||
```
|
||||
|
||||
⚠️ Important Configuration Notes:
|
||||
@@ -186,20 +110,11 @@ docker compose up -d
|
||||
|
||||
## 4. Version Update
|
||||
|
||||
> 💡 Important Note: The update command varies depending on your installation version:
|
||||
> - If you installed recently (new version), use this command:
|
||||
```bash
|
||||
docker compose pull && \
|
||||
docker compose run -it --rm web php artisan xboard:update && \
|
||||
docker compose up -d
|
||||
docker compose pull && docker compose up -d
|
||||
```
|
||||
> - If you installed earlier (old version), replace `web` with `xboard`:
|
||||
```bash
|
||||
docker compose pull && \
|
||||
docker compose run -it --rm xboard php artisan xboard:update && \
|
||||
docker compose up -d
|
||||
```
|
||||
> 🤔 Not sure which to use? Try the new version command first, if it fails, use the old version command.
|
||||
|
||||
The container always runs `php artisan xboard:update` (migrate + plugin install + version cache + theme refresh) on boot, so no extra command is required.
|
||||
|
||||
## Important Notes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user