彻底删除 Docker 部署配置
This commit is contained in:
parent
accd8b0cf1
commit
b1dfb4c823
@ -1,9 +0,0 @@
|
|||||||
# Go build context
|
|
||||||
.git
|
|
||||||
.gitignore
|
|
||||||
data
|
|
||||||
frontend/node_modules
|
|
||||||
frontend/dist
|
|
||||||
*.log
|
|
||||||
*.pkg
|
|
||||||
*.exe
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
FROM golang:1.26-alpine AS build
|
|
||||||
WORKDIR /src
|
|
||||||
COPY go.mod ./
|
|
||||||
COPY cmd ./cmd
|
|
||||||
COPY internal ./internal
|
|
||||||
COPY pkg ./pkg
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o /out/scout-server ./cmd/scout-server
|
|
||||||
|
|
||||||
FROM alpine:3.22
|
|
||||||
RUN addgroup -S scout && adduser -S -G scout scout \
|
|
||||||
&& apk add --no-cache ca-certificates tzdata
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=build /out/scout-server /app/scout-server
|
|
||||||
RUN mkdir -p /var/lib/scout && chown -R scout:scout /var/lib/scout /app
|
|
||||||
USER scout
|
|
||||||
ENV SCOUT_ENV=production \
|
|
||||||
SCOUT_ADDR=:8080 \
|
|
||||||
SCOUT_DATA_DIR=/var/lib/scout
|
|
||||||
EXPOSE 8080
|
|
||||||
VOLUME ["/var/lib/scout"]
|
|
||||||
ENTRYPOINT ["/app/scout-server"]
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
services:
|
|
||||||
scout:
|
|
||||||
build:
|
|
||||||
context: ..
|
|
||||||
dockerfile: deploy/Dockerfile
|
|
||||||
restart: unless-stopped
|
|
||||||
env_file:
|
|
||||||
- ./scout.env
|
|
||||||
environment:
|
|
||||||
SCOUT_ENV: production
|
|
||||||
SCOUT_ADDR: :8080
|
|
||||||
SCOUT_DATA_DIR: /var/lib/scout
|
|
||||||
volumes:
|
|
||||||
- scout-data:/var/lib/scout
|
|
||||||
expose:
|
|
||||||
- "8080"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--spider", "--quiet", "http://127.0.0.1:8080/healthz"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 3
|
|
||||||
start_period: 10s
|
|
||||||
|
|
||||||
web:
|
|
||||||
build:
|
|
||||||
context: ..
|
|
||||||
dockerfile: deploy/frontend.Dockerfile
|
|
||||||
restart: unless-stopped
|
|
||||||
depends_on:
|
|
||||||
scout:
|
|
||||||
condition: service_healthy
|
|
||||||
ports:
|
|
||||||
- "127.0.0.1:8081:80"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
scout-data:
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
FROM node:24-alpine AS build
|
|
||||||
WORKDIR /src/frontend
|
|
||||||
COPY frontend/package*.json ./
|
|
||||||
RUN npm ci
|
|
||||||
COPY frontend ./
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
FROM nginx:1.29-alpine
|
|
||||||
COPY --from=build /src/frontend/dist /usr/share/nginx/html
|
|
||||||
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
EXPOSE 80
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
map $http_x_forwarded_proto $scout_forwarded_proto {
|
|
||||||
default $http_x_forwarded_proto;
|
|
||||||
"" $scheme;
|
|
||||||
}
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
client_max_body_size 512m;
|
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
|
||||||
add_header X-Frame-Options "DENY" always;
|
|
||||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
||||||
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
||||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; font-src 'self'; frame-ancestors 'none'" always;
|
|
||||||
|
|
||||||
location /api/v1/updates/stream {
|
|
||||||
proxy_pass http://scout:8080;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
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 $scout_forwarded_proto;
|
|
||||||
proxy_buffering off;
|
|
||||||
proxy_cache off;
|
|
||||||
proxy_read_timeout 1h;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api/ {
|
|
||||||
proxy_pass http://scout:8080;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
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 $scout_forwarded_proto;
|
|
||||||
proxy_request_buffering off;
|
|
||||||
proxy_read_timeout 10m;
|
|
||||||
}
|
|
||||||
|
|
||||||
location = /healthz {
|
|
||||||
proxy_pass http://scout:8080;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scout_forwarded_proto;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
10
使用说明.md
10
使用说明.md
@ -280,9 +280,9 @@ chmod 600 /etc/scout/scout.env
|
|||||||
|
|
||||||
生产环境会拒绝默认测试管理员密码、缺少允许来源、缺少允许主机和缺少 SMTP 发件配置。`SCOUT_ALLOW_LEGACY_TOKEN` 默认关闭;推荐使用开发者账户会话上传,不要在公网长期保留兼容令牌。
|
生产环境会拒绝默认测试管理员密码、缺少允许来源、缺少允许主机和缺少 SMTP 发件配置。`SCOUT_ALLOW_LEGACY_TOKEN` 默认关闭;推荐使用开发者账户会话上传,不要在公网长期保留兼容令牌。
|
||||||
|
|
||||||
### 原生 systemd 部署(当前使用,不使用 Docker)
|
### 原生 systemd 部署
|
||||||
|
|
||||||
当前部署不需要安装 Docker 或 Docker Compose。建议在 Linux 服务器上直接运行 Go 编译后的二进制,并由 `systemd` 管理服务。
|
建议在 Linux 服务器上直接运行 Go 编译后的二进制,并由 `systemd` 管理服务。
|
||||||
|
|
||||||
先在构建机编译服务端和前端:
|
先在构建机编译服务端和前端:
|
||||||
|
|
||||||
@ -326,9 +326,7 @@ sudo journalctl -u scout.service -f
|
|||||||
|
|
||||||
### Nginx 转发要求
|
### Nginx 转发要求
|
||||||
|
|
||||||
`deploy/nginx-native.conf` 是非 Docker 部署使用的 Nginx 参考配置,默认从 `/opt/scout/frontend/dist` 提供前端文件,并转发到本机 `127.0.0.1:8080`。部署时请将 `server_name _;` 按外部网关实际要求调整。
|
`deploy/nginx-native.conf` 是 Nginx 参考配置,默认从 `/opt/scout/frontend/dist` 提供前端文件,并转发到本机 `127.0.0.1:8080`。部署时请将 `server_name _;` 按外部网关实际要求调整。
|
||||||
|
|
||||||
`deploy/nginx.conf` 仅保留给 Docker 前端容器使用;当前非 Docker 部署不需要它。
|
|
||||||
|
|
||||||
外部网关需要满足以下要求:
|
外部网关需要满足以下要求:
|
||||||
|
|
||||||
@ -341,7 +339,7 @@ sudo journalctl -u scout.service -f
|
|||||||
|
|
||||||
外部网关终止 HTTPS 后,必须将 `X-Forwarded-Proto: https` 传给 Scout;否则生产配置中的 `SCOUT_FORCE_HTTPS=true` 会拒绝请求。这是协议边界检查,不是 Scout 的证书管理功能。
|
外部网关终止 HTTPS 后,必须将 `X-Forwarded-Proto: https` 传给 Scout;否则生产配置中的 `SCOUT_FORCE_HTTPS=true` 会拒绝请求。这是协议边界检查,不是 Scout 的证书管理功能。
|
||||||
|
|
||||||
`deploy/Caddyfile` 仅是非 Docker 部署下的 Caddy 反向代理参考配置,其中的示例主机名需要替换为实际访问地址。它直接代理本机 `127.0.0.1:8080`,并从 `/opt/scout/frontend/dist` 提供前端文件。它不会申请或配置 SSL 证书,也不会执行 DNS 解析、域名绑定或服务商 API 操作;如果 SSL 和 DNS 已由其他服务处理,请继续让该服务负责 TLS 终止,并把请求转发到 Scout 的入口。
|
`deploy/Caddyfile` 是 Caddy 反向代理参考配置,其中的示例主机名需要替换为实际访问地址。它直接代理本机 `127.0.0.1:8080`,并从 `/opt/scout/frontend/dist` 提供前端文件。它不会申请或配置 SSL 证书,也不会执行 DNS 解析、域名绑定或服务商 API 操作;如果 SSL 和 DNS 已由其他服务处理,请继续让该服务负责 TLS 终止,并把请求转发到 Scout 的入口。
|
||||||
|
|
||||||
### 健康检查、备份和升级
|
### 健康检查、备份和升级
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user