Files
tailscale-custom/.agent/workflows/docker-deploy.md
T
huanld 2fb067ecbf
checklocks / checklocks (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
natlab-integrationtest / natlab-integrationtest (push) Has been cancelled
CI / gomod-cache (push) Has been cancelled
CI / race-root-integration (1/4) (push) Has been cancelled
CI / race-root-integration (2/4) (push) Has been cancelled
CI / race-root-integration (3/4) (push) Has been cancelled
CI / race-root-integration (4/4) (push) Has been cancelled
CI / test (-race, amd64, 1/3) (push) Has been cancelled
CI / test (-race, amd64, 2/3) (push) Has been cancelled
CI / test (-race, amd64, 3/3) (push) Has been cancelled
CI / test (386) (push) Has been cancelled
CI / test (amd64) (push) Has been cancelled
CI / Windows (benchmarks) (push) Has been cancelled
CI / Windows (1/2) (push) Has been cancelled
CI / Windows (2/2) (push) Has been cancelled
CI / macos (push) Has been cancelled
CI / privileged (push) Has been cancelled
CI / vm (push) Has been cancelled
CI / cross (386, linux) (push) Has been cancelled
CI / cross (amd64, darwin) (push) Has been cancelled
CI / cross (amd64, freebsd) (push) Has been cancelled
CI / cross (amd64, openbsd) (push) Has been cancelled
CI / cross (amd64, windows) (push) Has been cancelled
CI / cross (arm, 5, linux) (push) Has been cancelled
CI / cross (arm, 7, linux) (push) Has been cancelled
CI / cross (arm64, darwin) (push) Has been cancelled
CI / cross (arm64, linux) (push) Has been cancelled
CI / cross (arm64, windows) (push) Has been cancelled
CI / cross (loong64, linux) (push) Has been cancelled
CI / ios (push) Has been cancelled
CI / crossmin (amd64, illumos) (push) Has been cancelled
CI / crossmin (amd64, plan9) (push) Has been cancelled
CI / crossmin (amd64, solaris) (push) Has been cancelled
CI / crossmin (ppc64, aix) (push) Has been cancelled
CI / android (push) Has been cancelled
CI / wasm (push) Has been cancelled
CI / tailscale_go (push) Has been cancelled
CI / fuzz (push) Has been cancelled
CI / depaware (push) Has been cancelled
CI / go_generate (push) Has been cancelled
CI / make_tidy (push) Has been cancelled
CI / licenses (push) Has been cancelled
CI / staticcheck (macOS) (push) Has been cancelled
CI / staticcheck (Linux) (push) Has been cancelled
CI / staticcheck (Windows) (push) Has been cancelled
CI / staticcheck (Portable (1/4)) (push) Has been cancelled
CI / staticcheck (Portable (2/4)) (push) Has been cancelled
CI / staticcheck (Portable (3/4)) (push) Has been cancelled
CI / staticcheck (Portable (4/4)) (push) Has been cancelled
CI / notify_slack (push) Has been cancelled
CI / merge_blocker (push) Has been cancelled
CI / check_mergeability_strict (push) Has been cancelled
CI / check_mergeability (push) Has been cancelled
Dockerfile build / deploy (push) Has been cancelled
test installer.sh / test (curl, alpine:3.21) (push) Has been cancelled
test installer.sh / test (curl, alpine:edge) (push) Has been cancelled
test installer.sh / test (curl, alpine:latest) (push) Has been cancelled
test installer.sh / test (curl, amazonlinux:latest) (push) Has been cancelled
test installer.sh / test (curl, archlinux:latest) (push) Has been cancelled
test installer.sh / test (curl, debian:oldstable-slim) (push) Has been cancelled
test installer.sh / test (curl, debian:sid-slim) (push) Has been cancelled
test installer.sh / test (curl, debian:stable-slim, 1.80.0) (push) Has been cancelled
test installer.sh / test (curl, debian:testing-slim) (push) Has been cancelled
test installer.sh / test (curl, elementary/docker:stable) (push) Has been cancelled
test installer.sh / test (curl, elementary/docker:unstable) (push) Has been cancelled
test installer.sh / test (curl, fedora:latest, 1.80.0) (push) Has been cancelled
test installer.sh / test (curl, kalilinux/kali-dev) (push) Has been cancelled
test installer.sh / test (curl, kalilinux/kali-rolling) (push) Has been cancelled
test installer.sh / test (curl, opensuse/leap:latest) (push) Has been cancelled
test installer.sh / test (curl, opensuse/tumbleweed:latest) (push) Has been cancelled
test installer.sh / test (curl, oraclelinux:8) (push) Has been cancelled
test installer.sh / test (curl, oraclelinux:9) (push) Has been cancelled
test installer.sh / test (curl, parrotsec/core:latest) (push) Has been cancelled
test installer.sh / test (curl, rockylinux:8.7) (push) Has been cancelled
test installer.sh / test (curl, rockylinux:9) (push) Has been cancelled
test installer.sh / test (curl, ubuntu:20.04) (push) Has been cancelled
test installer.sh / test (curl, ubuntu:22.04) (push) Has been cancelled
test installer.sh / test (curl, ubuntu:24.04, 1.80.0) (push) Has been cancelled
test installer.sh / test (wget, debian:oldstable-slim) (push) Has been cancelled
test installer.sh / test (wget, debian:sid-slim) (push) Has been cancelled
update-flake / update-flake (push) Has been cancelled
tailscale.com/cmd/vet / vet (push) Has been cancelled
test installer.sh / notify-slack (push) Has been cancelled
feat: security hardening, production roadmap, admin panel v1
Client security fixes (cmd/tailscale-tray/main.go):
- SSRF protection in Add Server dialog (validateControlURL): reject
  private/loopback/link-local/cloud-metadata IPs via DNS resolution
- RCE gate on AuthURL/BrowseToURL exec paths (validateAuthURL)
- Sanitized URL logging (sanitizeURLForLog drops query auth tokens)
- Error handling on exec.Command with user-facing showError()

Admin panel security (web-admin):
- Bcrypt password hashing (replaces SHA256)
- Rate limiting: 5 failed logins → 15-min lockout
- Session + login attempt cleanup goroutine (hourly)
- url.QueryEscape / encodeURIComponent for all API params
- Fail-hard startup when no TLS and non-loopback bind
- ADMIN_PASSWORD required (no default), password min 12 chars
- Username regex whitelist

Installer hardening (Setup.wxs):
- util:PermissionEx restricts SCM access: only Administrators +
  SYSTEM can start/stop/reconfigure service. Authenticated Users
  limited to QueryStatus/QueryConfig/Interrogate
- Vital="yes" on ServiceInstall

Docs & roadmap:
- PRODUCTION_ROADMAP.md: 5-milestone plan (security + features +
  distribution + ops) with granular tasks, effort, done-when
- CLIENT_SECURITY_AUDIT.md, SECURITY_FIXES.md, DEPLOYMENT.md
- AI assistant rules (.cursorrules, .antigravityrules, etc.)

Build & distribution:
- build-msi.ps1, deploy-and-sign.ps1, sign-release.ps1
- redeploy.ps1, tray-deploy.ps1, test-msi.ps1
- installer/msi/ alternative WXS setup
- Restored .github/workflows/ removed in mirror cleanup

.gitignore hardened: *.pfx, *.p12, *.key, *.pem, .env*
2026-04-22 15:18:11 +07:00

7.5 KiB

description
description
Deploy any INS module to VPS with pre-flight connectivity checks, local build, and post-deploy verification

Docker VPS Release Workflow

RULE: Never build on VPS. Always publish locally and create Docker image with pre-built DLLs only.

// turbo-all

Prerequisites

  • Docker Desktop running locally
  • SSH access to VPS: root@36.50.176.30
  • SSH key: ~/.ssh/id_rsa or ~/.ssh/id_ed25519

Phase 1: Pre-flight — Check VPS Infrastructure

1.1. SSH into VPS and check Docker network

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker network ls --format 'table {{.Name}}\t{{.Driver}}\t{{.Scope}}'"

1.2. List all containers on app-network with health status

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}\t{{.Networks}}' | head -30"

1.3. Verify SSO container is running and healthy

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker inspect sso-instratech --format '{{.State.Status}} | Health: {{.State.Health.Status}} | Network: {{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' 2>/dev/null || echo 'SSO container NOT FOUND'"

1.4. Verify Redis is running

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker exec ins-redis redis-cli ping 2>/dev/null || echo 'Redis NOT AVAILABLE'"

1.5. Verify inter-container DNS resolution (from a running container)

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker exec sso-instratech sh -c 'getent hosts ins-redis && getent hosts ins-rabbitmq' 2>/dev/null || echo 'DNS resolution check failed'"

1.6. Check gRPC health on SSO (port 8082)

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "curl -sf http://localhost:8082/health || echo 'gRPC health endpoint not responding'"

STOP: If SSO or Redis are NOT running/healthy, fix them FIRST before deploying any module.


Phase 2: Validate Configuration

2.1. Identify the correct appsettings file for the target module

Check the module's Dockerfile to see which CONFIG_FILE is used:

Select-String -Path "Dockerfile" -Pattern "CONFIG_FILE"
  • appsettings.container.release.json → Production VPS (sso.instratech.net)
  • appsettings.container.debug.json → Local Docker Desktop
  • appsettings.container.json → Generic container mode

2.2. Verify appsettings has correct service hostnames

Review the release config and verify:

Get-Content "src\*Backend\appsettings.container.release.json" | Select-String -Pattern "ServerUrl|ConnectionString|Host|redis|rabbitmq|sso-instratech"

Expected hostnames inside Docker network:

Service Hostname Port
SSO (HTTP) sso-instratech 8080
SSO (gRPC) sso-instratech 8082
Redis ins-redis or redis 6379
RabbitMQ ins-rabbitmq or rabbitmq 5672
SQL Server External IP (e.g., 203.167.14.22) 1433

CRITICAL: Connection strings MUST use Docker network hostnames, NOT localhost.

2.3. Verify startup order

Container startup dependencies:

1. Redis (ins-redis)          ← No dependencies
2. RabbitMQ (ins-rabbitmq)    ← No dependencies  
3. SSO (sso-instratech)       ← Depends on: Redis, RabbitMQ, SQL Server
4. INS.PRO (ins-pro)          ← Depends on: SSO, Redis, SQL Server
5. INS.CDE (ins-cde)          ← Depends on: SSO, Redis, SQL Server
6. INS.WJC (ins-wjc)          ← Depends on: SSO, Redis, SQL Server

All modules depend on SSO for gRPC token validation. SSO MUST be healthy before starting modules.


Phase 3: Build Locally (NEVER on VPS)

3.1. Clean previous publish output

Remove-Item -Path "publish" -Recurse -ErrorAction SilentlyContinue

3.2. Publish with Release configuration (no debug symbols)

dotnet publish src\<MODULE>.Backend\<MODULE>.Backend.csproj -c Release -o publish/backend /p:DebugType=none /p:DebugSymbols=false

3.3. Build Docker image with production config

docker build -t <image-name>:latest --build-arg CONFIG_FILE=appsettings.container.release.json -f Dockerfile .

3.4. Save image as .tar for transfer

$ts = Get-Date -Format 'yyyyMMdd-HHmmss'; docker save -o "<image-name>-$ts.tar" <image-name>:latest

Phase 4: Deploy to VPS

4.1. Upload .tar to VPS

scp -o StrictHostKeyChecking=no "<image-name>-*.tar" "root@36.50.176.30:/tmp/"

4.2. Load image and deploy on VPS

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker load -i /tmp/<image-name>-*.tar && docker stop <container-name> 2>/dev/null; docker rm <container-name> 2>/dev/null; docker run -d --name <container-name> --network app-network --restart unless-stopped -p <host-port>:<container-port> -e ASPNETCORE_ENVIRONMENT=Production -e DOTNET_RUNNING_IN_CONTAINER=true --health-cmd 'curl -f http://localhost:<container-port>/health/ready || exit 1' --health-interval 30s --health-timeout 10s --health-retries 3 --health-start-period 60s <image-name>:latest && rm -f /tmp/<image-name>-*.tar"

4.3. Clean up local .tar

Remove-Item -Path "<image-name>-*.tar" -Force -ErrorAction SilentlyContinue

Phase 5: Post-Deploy Verification

5.1. Check container health status

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker ps --filter name=<container-name> --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'"

5.2. Check startup connectivity report in logs

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker logs <container-name> 2>&1 | grep -A 20 'Connectivity Report'"

Must see: All in the report. If any , the container will crash and restart.

5.3. Deep health check via HTTP

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "curl -s http://localhost:<host-port>/health/ready | python3 -m json.tool 2>/dev/null || curl -s http://localhost:<host-port>/health/ready"

Expected: "status": "Healthy" with all checks passing.

5.4. Verify container-to-container connectivity

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker exec <container-name> sh -c 'getent hosts sso-instratech && getent hosts ins-redis' 2>/dev/null || echo 'DNS resolution FAILED'"

5.5. Test gRPC connectivity from new container to SSO

ssh -o StrictHostKeyChecking=no root@36.50.176.30 "docker exec <container-name> sh -c 'curl -sf http://sso-instratech:8082/health' 2>/dev/null || echo 'gRPC SSO unreachable from container'"

DEPLOYMENT IS COMPLETE only when ALL Phase 5 checks pass.


Module Reference

Module Image Container Port Config
SSO sso-instratech sso-instratech 8080, 8082 appsettings.container.release.json
PRO ins-pro ins-pro 8000 appsettings.container.release.json
CDE ins-cde ins-cde 8090 appsettings.container.release.json
WJC ins-wjc ins-wjc 8070 appsettings.container.release.json

Troubleshooting

Symptom Cause Fix
Container keeps restarting Critical dependency unreachable Check Phase 5.2 logs for
health/ready returns 503 gRPC/Redis/SQL down Fix dependency first, container will self-heal
DNS resolution fails Container not on app-network docker network connect app-network <name>
30s request timeouts gRPC SSO unreachable Check SSO container + network alias