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
|
||||
|
||||
|
||||
@@ -65,14 +65,14 @@ cd /www/wwwroot/your-domain
|
||||
chattr -i .user.ini
|
||||
rm -rf .htaccess 404.html 502.html index.html .user.ini
|
||||
|
||||
# Clone repository
|
||||
git clone https://github.com/cedar2025/Xboard.git ./
|
||||
# Clone the compose branch
|
||||
git clone -b compose --depth 1 https://github.com/cedar2025/Xboard.git ./
|
||||
|
||||
# Prepare configuration file
|
||||
cp compose.sample.yaml compose.yaml
|
||||
|
||||
# Install dependencies and initialize
|
||||
docker compose run -it --rm web sh init.sh
|
||||
docker compose run -it --rm xboard php artisan xboard:install
|
||||
```
|
||||
> ⚠️ Please save the admin dashboard URL, username, and password shown after installation
|
||||
|
||||
@@ -84,54 +84,30 @@ docker compose up -d
|
||||
#### 3.4 Configure Reverse Proxy
|
||||
Add the following content to your site configuration:
|
||||
```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 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`.
|
||||
|
||||
## Maintenance Guide
|
||||
|
||||
### Version Updates
|
||||
|
||||
> 💡 Important Note: Update commands may vary depending on your installed version:
|
||||
> - For recent installations (new version), use:
|
||||
```bash
|
||||
docker compose pull && \
|
||||
docker compose run -it --rm web sh update.sh && \
|
||||
docker compose up -d
|
||||
docker compose pull && docker compose up -d
|
||||
```
|
||||
> - For older installations, replace `web` with `xboard`:
|
||||
```bash
|
||||
git config --global --add safe.directory $(pwd)
|
||||
git fetch --all && git reset --hard origin/master && git pull origin master
|
||||
docker compose pull && \
|
||||
docker compose run -it --rm xboard sh update.sh && \
|
||||
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.
|
||||
|
||||
### Routine Maintenance
|
||||
- Regular log checking: `docker compose logs`
|
||||
|
||||
@@ -15,11 +15,12 @@ systemctl start docker
|
||||
|
||||
### 2. Deployment Steps
|
||||
|
||||
1. Get project files:
|
||||
```bash
|
||||
git clone -b compose --depth 1 https://github.com/cedar2025/Xboard
|
||||
cd Xboard
|
||||
```
|
||||
1. Clone the `compose` branch (it ships `compose.sample.yaml` and the other `compose.*.sample.yaml` variants):
|
||||
```bash
|
||||
git clone -b compose --depth 1 https://github.com/cedar2025/Xboard
|
||||
cd Xboard
|
||||
cp compose.sample.yaml compose.yaml
|
||||
```
|
||||
|
||||
2. Install database:
|
||||
|
||||
@@ -29,13 +30,23 @@ docker compose run -it --rm \
|
||||
-e ENABLE_SQLITE=true \
|
||||
-e ENABLE_REDIS=true \
|
||||
-e ADMIN_ACCOUNT=admin@demo.com \
|
||||
web php artisan xboard:install
|
||||
xboard php artisan xboard:install
|
||||
```
|
||||
- Custom configuration installation (Advanced users)
|
||||
```bash
|
||||
docker compose run -it --rm web php artisan xboard:install
|
||||
docker compose run -it --rm xboard php artisan xboard:install
|
||||
```
|
||||
> Please save the admin dashboard URL, username, and password shown after installation
|
||||
> The repository ships **four** compose templates in the `compose` branch — pick the one matching your setup, copy it to `compose.yaml`, then run the install command:
|
||||
>
|
||||
> | File | Network | When to use |
|
||||
> |------|---------|-------------|
|
||||
> | `compose.sample.yaml` | bridge + ports `7001:7001` | bare docker, custom reverse proxy, aaPanel + Docker (default) |
|
||||
> | `compose.host.sample.yaml` | `network_mode: host` | aaPanel native (openresty on host) |
|
||||
> | `compose.1panel.sample.yaml` | bridge + external `1panel-network` | 1Panel users (so the container can reach 1Panel-managed MySQL/Redis) |
|
||||
> | `compose.split.sample.yaml` | multi-container (web/horizon/ws-server/redis split) | K8s migration, advanced scaling |
|
||||
>
|
||||
> The local `compose.yaml` is gitignored so your edits survive `git pull` when you do clone the repo.
|
||||
|
||||
3. Start services:
|
||||
```bash
|
||||
@@ -48,22 +59,10 @@ docker compose up -d
|
||||
|
||||
### 3. Version Updates
|
||||
|
||||
> 💡 Important Note: Update commands may vary depending on your installed version:
|
||||
> - For recent installations (new version), use:
|
||||
```bash
|
||||
cd Xboard
|
||||
docker compose pull && \
|
||||
docker compose run -it --rm web php artisan xboard:update && \
|
||||
docker compose up -d
|
||||
docker compose pull && docker compose up -d
|
||||
```
|
||||
> - For older installations, replace `web` with `xboard`:
|
||||
```bash
|
||||
cd Xboard
|
||||
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.
|
||||
|
||||
### 4. Version Rollback
|
||||
|
||||
|
||||
Reference in New Issue
Block a user