Added new account export and config files, updated nginx configuration
This commit is contained in:
parent
672cb8abb8
commit
3b3fa3d28b
11
Makefile
11
Makefile
@ -14,7 +14,7 @@ endif
|
||||
|
||||
HOSTS_FILE ?= /etc/hosts
|
||||
HOSTS_IP ?= 127.0.0.1
|
||||
HOSTS_DOMAINS ?= accounts.svc.plus api.svc.plus accounts-dev.svc.plus dev-api.svc.plus
|
||||
HOSTS_DOMAINS ?= dev-accounts.svc.plus dev-api.svc.plus
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
NGINX_PREFIX ?= /opt/homebrew/openresty/nginx
|
||||
@ -27,11 +27,16 @@ NGINX_CONF_ROOT ?= $(NGINX_PREFIX)/conf
|
||||
NGINX_CONF_DIR ?= $(NGINX_CONF_ROOT)/conf.d
|
||||
NGINX_MAIN_CONF ?= $(NGINX_CONF_ROOT)/nginx.conf
|
||||
|
||||
NGINX_SIT_CONFIGS := example/sit/nginx/accounts-dev.svc.plus.conf
|
||||
NGINX_SIT_CONFIGS := example/sit/nginx/nginx.conf
|
||||
NGINX_SIT_CONFIGS += example/sit/nginx/dev.svc.plus.conf
|
||||
NGINX_SIT_CONFIGS += example/sit/nginx/dev-api.svc.plus.conf
|
||||
NGINX_SIT_CONFIGS := example/sit/nginx/dev-accounts.svc.plus.conf
|
||||
|
||||
NGINX_PROD_CONFIGS := example/prod/nginx/nginx.conf
|
||||
NGINX_PROD_CONFIGS := example/prod/nginx/dev.svc.plus.conf
|
||||
NGINX_PROD_CONFIGS := example/prod/nginx/api.svc.plus.conf
|
||||
NGINX_PROD_CONFIGS := example/prod/nginx/accounts.svc.plus.conf
|
||||
|
||||
NGINX_PROD_CONFIGS := example/prod/nginx/accounts.svc.plus.conf example/prod/nginx/api.svc.plus.conf
|
||||
NGINX_ALL_CONFIGS := $(NGINX_SIT_CONFIGS) $(NGINX_PROD_CONFIGS)
|
||||
|
||||
export PATH := $(GO_BIN):$(PATH)
|
||||
|
||||
@ -245,21 +245,14 @@ upgrade: build
|
||||
cp xcontrol-account /usr/bin/xcontrol-account
|
||||
systemctl start xcontrol-account
|
||||
|
||||
start:
|
||||
@./$(APP_NAME) --config config/account.yaml &
|
||||
start: build
|
||||
@./$(APP_NAME) --config config/account.yaml
|
||||
|
||||
stop:
|
||||
@pkill -f "$(APP_NAME)" || echo "⚠️ 未找到运行进程"
|
||||
|
||||
restart: stop start
|
||||
|
||||
dev:
|
||||
@if command -v air >/dev/null; then \
|
||||
PORT=$(PORT) air -c .air.toml; \
|
||||
else \
|
||||
PORT=$(PORT) go run $(MAIN_FILE); \
|
||||
fi
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
|
||||
70
account/account-export.yaml
Normal file
70
account/account-export.yaml
Normal file
@ -0,0 +1,70 @@
|
||||
metadata:
|
||||
version: v1
|
||||
schemaHash: 49cee41b49a0afed72f131755569aab9b2104258d86833d83ba29905a4a7e96c
|
||||
exportedAt: 2025-10-30T08:09:23.126876215Z
|
||||
users:
|
||||
- uuid: 5d7e41c6-7f11-405b-bced-154491233207
|
||||
username: shenlan
|
||||
password: $2a$10$D5vekDyFlfgyJ3P.YfK6tuGw2WdgGhopoaaUCDjF1xr5o7B/lzJLy
|
||||
email: manbuzhe2009@qq.com
|
||||
emailVerified: true
|
||||
emailVerifiedAt: 2025-10-13T13:16:57.342443+08:00
|
||||
level: 0
|
||||
role: admin
|
||||
groups:
|
||||
- Admin
|
||||
permissions:
|
||||
- '*'
|
||||
createdAt: 2025-10-13T13:16:57.34396+08:00
|
||||
updatedAt: 2025-10-30T15:55:10.810148+08:00
|
||||
mfaTotpSecret: MFA_SECRET_PLACEHOLDER
|
||||
mfaEnabled: true
|
||||
mfaSecretIssuedAt: 2025-10-13T13:50:20.32674+08:00
|
||||
mfaConfirmedAt: 2025-10-13T13:50:57.827772+08:00
|
||||
- uuid: 6d6e6ce5-9683-483b-ad07-7b0115df4acd
|
||||
username: Haitao Pan
|
||||
password: $2a$10$vneWsrGLOl1pu6C0xPQp7.XkCihBpie7FG8i01rhCnx0C9Dw2QaAu
|
||||
email: manbuzhe2008@gmail.com
|
||||
emailVerified: true
|
||||
emailVerifiedAt: 2025-10-13T16:35:18.907188+08:00
|
||||
level: 20
|
||||
role: user
|
||||
groups:
|
||||
- User
|
||||
createdAt: 2025-10-13T16:35:18.936655+08:00
|
||||
updatedAt: 2025-10-13T16:37:07.822322+08:00
|
||||
mfaTotpSecret: MFA_SECRET_PLACEHOLDER
|
||||
mfaEnabled: true
|
||||
mfaSecretIssuedAt: 2025-10-13T16:35:46.634698+08:00
|
||||
mfaConfirmedAt: 2025-10-13T16:37:07.792588+08:00
|
||||
- uuid: e1088323-81a1-485e-a4e5-d012c55b34b0
|
||||
username: Henry
|
||||
password: $2a$10$.VEywxWJT5Mn/SOKwheVyeW.J5lh3qEjyOH.TSqHQ2ShjeohWMRV.
|
||||
email: henry@qq.com
|
||||
emailVerified: true
|
||||
emailVerifiedAt: 2025-10-27T10:18:13.225911+08:00
|
||||
level: 20
|
||||
role: user
|
||||
groups:
|
||||
- User
|
||||
createdAt: 2025-10-27T10:18:13.253954+08:00
|
||||
updatedAt: 2025-10-30T15:55:10.810148+08:00
|
||||
mfaTotpSecret: MFA_SECRET_PLACEHOLDER
|
||||
mfaEnabled: true
|
||||
mfaSecretIssuedAt: 2025-10-27T13:04:30.526604+08:00
|
||||
mfaConfirmedAt: 2025-10-27T13:04:44.81372+08:00
|
||||
- uuid: 7a8136c7-c9dc-40be-b9a0-f288b43f4d12
|
||||
username: Demo
|
||||
password: $2a$10$WpLN3v0DfM7cqQAK657wYOee8bw.33RW0bNdn9i7tP0dWvYz07S7O
|
||||
email: demo@svc.plus
|
||||
emailVerified: true
|
||||
emailVerifiedAt: 2025-10-27T20:34:36.991099+08:00
|
||||
level: 20
|
||||
role: user
|
||||
groups:
|
||||
- User
|
||||
createdAt: 2025-10-27T20:34:37.04563+08:00
|
||||
updatedAt: 2025-10-30T15:55:10.810148+08:00
|
||||
mfaTotpSecret: MFA_SECRET_PLACEHOLDER
|
||||
mfaEnabled: false
|
||||
mfaSecretIssuedAt: 2025-10-27T20:34:52.986381+08:00
|
||||
50
account/config/sync.yaml
Normal file
50
account/config/sync.yaml
Normal file
@ -0,0 +1,50 @@
|
||||
# ============================================
|
||||
# 🔄 XControl Account Sync Configuration
|
||||
# ============================================
|
||||
# 将本地与远端账号服务通过 SSH 安全同步。默认提供单向 push/pull/mirror
|
||||
# 三种模式,可直接通过 `go run ./cmd/syncctl/main.go push --config config/sync.yaml`
|
||||
# 等命令执行。
|
||||
#
|
||||
# 请复制本文件为 config/sync.yaml 并按需修改。
|
||||
# ============================================
|
||||
|
||||
local:
|
||||
# 本地 PostgreSQL 连接地址,用于导入/导出账号数据
|
||||
dsn: "postgres://shenlan:password@127.0.0.1:5432/account?sslmode=disable"
|
||||
# 可选:按 email 关键字过滤导出的账号
|
||||
email_keyword: ""
|
||||
# 导出的快照文件路径(默认 account-export.yaml)
|
||||
export_path: "account-export.yaml"
|
||||
# 导入行为配置,支持 merge / dry-run / allowlist 等参数
|
||||
import:
|
||||
merge: false
|
||||
merge_strategy: ""
|
||||
dry_run: false
|
||||
allowlist: []
|
||||
|
||||
remote:
|
||||
# 远端服务器地址与 SSH 账户
|
||||
address: "cn-homepage.svc.plus"
|
||||
port: 22
|
||||
user: "root"
|
||||
|
||||
# SSH 私钥与 known_hosts 用于强化安全(推荐使用专用部署密钥)
|
||||
identity_file: "/root/.ssh/id_rsa"
|
||||
known_hosts_file: "/root/.ssh/known_hosts"
|
||||
|
||||
# 远端账号服务所在目录,用于执行 make account-export/import
|
||||
account_dir: "/var/www/XControl/account"
|
||||
|
||||
# 远端快照文件路径(默认 account-export.yaml,可使用绝对路径)
|
||||
export_path: "account-export.yaml"
|
||||
import_path: "account-export.yaml"
|
||||
|
||||
# 可选:覆盖远端的 ACCOUNT_EMAIL_KEYWORD 环境变量
|
||||
email_keyword: ""
|
||||
|
||||
# 可选:额外注入的环境变量,例如覆盖数据库连接信息
|
||||
env: {}
|
||||
|
||||
# SSH 连接超时时间
|
||||
timeout: 30s
|
||||
|
||||
@ -10,11 +10,6 @@ environments:
|
||||
baseUrl: https://dev-accounts.svc.plus
|
||||
serverService:
|
||||
baseUrl: https://dev-api.svc.plus
|
||||
test:
|
||||
accountService:
|
||||
baseUrl: https://dev-accounts.svc.plus
|
||||
serverService:
|
||||
baseUrl: https://dev-api.svc.plus
|
||||
production:
|
||||
accountService:
|
||||
baseUrl: https://accounts.svc.plus
|
||||
|
||||
20
example/prod/nginx/nginx.conf
Normal file
20
example/prod/nginx/nginx.conf
Normal file
@ -0,0 +1,20 @@
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# 开启 gzip
|
||||
gzip on;
|
||||
|
||||
# 包含所有虚拟主机配置
|
||||
include conf.d/*.conf;
|
||||
}
|
||||
|
||||
20
example/sit/nginx/nginx.conf
Normal file
20
example/sit/nginx/nginx.conf
Normal file
@ -0,0 +1,20 @@
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# 开启 gzip
|
||||
gzip on;
|
||||
|
||||
# 包含所有虚拟主机配置
|
||||
include conf.d/*.conf;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user