mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-09 18:57:43 +08:00
1.3 KiB
1.3 KiB
DS2API Deployment Guide (Go)
Contents
- Vercel deployment
- Docker deployment
- Local run
- systemd deployment
Vercel Deployment
- Import the repository into Vercel
- Set required environment variables:
DS2API_ADMIN_KEYDS2API_CONFIG_JSON(JSON or Base64)
- Deploy and open
/admin
The project uses api/index.go as the serverless entrypoint. See vercel.json.
Docker Deployment
cp .env.example .env
# edit .env
docker-compose up -d
docker-compose logs -f
Rebuild after updates:
docker-compose up -d --build
Local Run
cp config.example.json config.json
# edit config
go run ./cmd/ds2api
Default port is 5001 (override with PORT).
systemd Deployment (Linux)
Example unit file:
[Unit]
Description=DS2API (Go)
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/ds2api
Environment=PORT=5001
Environment=DS2API_CONFIG_PATH=/opt/ds2api/config.json
Environment=DS2API_ADMIN_KEY=your-admin-secret-key
ExecStart=/opt/ds2api/ds2api
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Useful commands:
sudo systemctl daemon-reload
sudo systemctl enable ds2api
sudo systemctl start ds2api
sudo systemctl status ds2api