Add gateway deploy workflow
Some checks failed
Build and Deploy Gateway / build-and-deploy (push) Failing after 39s
Some checks failed
Build and Deploy Gateway / build-and-deploy (push) Failing after 39s
This commit is contained in:
60
scripts/deploy-gateway.sh
Normal file
60
scripts/deploy-gateway.sh
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DEPLOY_PATH="${DEPLOY_PATH:-/opt/vpn-proxy}"
|
||||
GATEWAY_IMAGE="${GATEWAY_IMAGE:?GATEWAY_IMAGE is required}"
|
||||
|
||||
echo "Preparing deploy directory: ${DEPLOY_PATH}"
|
||||
mkdir -p "${DEPLOY_PATH}"
|
||||
|
||||
cat > "${DEPLOY_PATH}/docker-compose.server.yml" <<EOF
|
||||
services:
|
||||
vpn-proxy-gateway:
|
||||
image: ${GATEWAY_IMAGE}
|
||||
container_name: vpn-proxy-gateway
|
||||
network_mode: host
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
DATA_DIR: /var/lib/vpn-proxy
|
||||
SING_BOX_CONFIG: /etc/sing-box/config.json
|
||||
SING_BOX_CACHE: /var/lib/sing-box/cache.db
|
||||
volumes:
|
||||
- vpn-proxy-data:/var/lib/vpn-proxy
|
||||
- sing-box-cache:/var/lib/sing-box
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
vpn-proxy-data:
|
||||
sing-box-cache:
|
||||
EOF
|
||||
|
||||
if [ ! -f "${DEPLOY_PATH}/.env" ]; then
|
||||
cat > "${DEPLOY_PATH}/.env" <<'EOF'
|
||||
PORT=3456
|
||||
PROXY_PORT=8080
|
||||
TPROXY_PORT=7895
|
||||
TPROXY_MARK=1
|
||||
TPROXY_TABLE=100
|
||||
TPROXY_CHAIN=VPN_PROXY_TPROXY
|
||||
ROUTING_RU_DIRECT=true
|
||||
LOG_LEVEL=info
|
||||
EOF
|
||||
echo "Created default .env. Edit ${DEPLOY_PATH}/.env if this server needs different ports."
|
||||
else
|
||||
echo "Preserving existing .env"
|
||||
fi
|
||||
|
||||
cd "${DEPLOY_PATH}"
|
||||
|
||||
echo "Pulling image: ${GATEWAY_IMAGE}"
|
||||
docker compose -f docker-compose.server.yml pull
|
||||
|
||||
echo "Starting gateway..."
|
||||
docker compose -f docker-compose.server.yml up -d
|
||||
|
||||
echo "Current container:"
|
||||
docker ps --filter "name=vpn-proxy-gateway"
|
||||
Reference in New Issue
Block a user