sub2api-fork-deploy

Build and deploy pinned Sub2API fork commits to Docker Compose servers with backup and rollback.

4|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/sukbearai/king-ai --skill sub2api-fork-deploy-sukbearai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sub2api-fork-deploy
Source: https://github.com/sukbearai/king-ai/tree/main/packages/skills/skills/sub2api-fork-deploy
Command: npx skills add https://github.com/sukbearai/king-ai --skill sub2api-fork-deploy-sukbearai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Official Sub2API Docker images sometimes lag behind a fork or main branch, forcing operators to build custom images and deploy them to production Compose stacks without breaking PostgreSQL, Redis, data, or rollback paths. This Skill provides a disciplined runbook for building an exact commit, deploying only the application image, and converging back to an official tagged release once it catches up. ## Core Features & Use Cases - Commit-Pinned Image Builds: Clone the fork into an isolated checkout, lock a full commit SHA, and build a linux/amd64 or linux/arm64 image with explicit VERSION, COMMIT, and DATE build arguments. - Safe Production Deployment: Back up PostgreSQL with pg_dump, pin a rollback image tag, patch only the application image line in the Compose file, and restart with --no-deps --pull never so databases are never recreated. - Official Image Convergence: Verify the official release commit is equal to or a descendant of the deployed fork commit using git merge-base before switching to a registry-backed official tag. - Cloudflare Tunnel Exposure: Run cloudflared as a container and diagnose public 502 errors caused by network-namespace or HTTP/HTTPS protocol mismatches. - Use Case: Your Sub2API server runs on a small ARM64 VPS and you need a fix that exists only in a fork commit. Use this Skill to build the image off-host, transfer it via docker save over SSH, deploy with a verified backup, and later converge back to the official weishaw/sub2api release tag. ## Quick Start Use the sub2api-fork-deploy skill to build commit abc123 from my Sub2API fork and deploy it to my Docker Compose server without touching PostgreSQL or Redis.

Frequently Asked Questions about sub2api-fork-deploy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a Sub2API fork commit to a Docker Compose server?▼

Clone the fork into an isolated checkout, lock the full commit SHA, and build the image with docker buildx for the target platform using VERSION, COMMIT, and DATE build args. Transfer it via registry push or docker save over SSH, then patch only the application image line in the Compose file and restart with --no-deps --pull never.

How do I switch from a custom Sub2API image back to the official release?▼

Treat it as image convergence, not rollback. Verify with git merge-base that the official release commit equals or descends from your deployed fork commit, pull the exact official tag, take a fresh PostgreSQL backup, pin a rollback tag, and patch only the app image in Compose.

Can I update the Sub2API app container without restarting PostgreSQL or Redis?▼

Yes. Run docker compose up -d --no-deps --pull never for only the application service. Verify afterward that the PostgreSQL and Redis container IDs and start times match the pre-deployment evidence.

Why does my Cloudflare Tunnel return 502 Bad Gateway for Sub2API?▼

Two misconfigurations cause identical 502 errors: a network-namespace mismatch where 127.0.0.1 inside the cloudflared container is not the host, fixed with --network host, or a protocol mismatch where the route Service Type is HTTPS but Sub2API serves plain HTTP. Check docker logs cloudflared to distinguish them.

Should I build the Sub2API image directly on a small production VPS?▼

No. A one-core host with roughly 2 GiB of RAM and no swap should receive a prebuilt image instead of compiling Node and Go locally. Build on a separate machine for the target architecture and transfer the image with docker save piped over SSH.

When should I not switch to an official Sub2API image?▼

Stop when the official release commit is an ancestor of or has diverged from your deployed fork commit, since switching would discard fork changes. Also stop if the PostgreSQL backup fails, the Compose diff changes more than the app image, or the rollback tag cannot be resolved.