@yibi/newapi-sub2api-stack
v0.1.0
Published
One-command Docker Compose installer for upstream New API and Sub2API
Readme
New API + Sub2API Stack Installer
An npm CLI that installs the upstream New API and Sub2API Docker stacks on a Linux host. It generates credentials locally, creates two isolated Compose networks, pulls upstream images, starts the services, and verifies their HTTP health endpoints.
Requirements
- Linux with Node.js 20 or newer and
npx - Docker Engine with a running daemon
- Docker Compose plugin (
docker compose) - The current user must be able to run
docker infowithoutsudo - Network access to the npm registry and Docker Hub
Node.js is only needed to run this installer. The applications themselves run entirely in Docker.
Run Locally
From this package directory:
npx --yes . installUntil the package is published, it can also be run by absolute directory:
npx --yes /home/ubuntu/newapi-sub2api-installer installAfter publication to npm:
npx --yes @yibi/[email protected] installProduction automation should specify an exact npm package version instead of
@latest.
Commands
api-stack install
api-stack status
api-stack logs
api-stack logs --service new-api
api-stack update
api-stack uninstall
api-stack uninstall --purge --confirm-purgeThe default installation directory is ~/.local/share/api-stack. Override it
for every command with --install-dir, or set API_STACK_INSTALL_DIR.
Example unattended installation:
npx --yes @yibi/[email protected] install \
--new-api-host 0.0.0.0 \
--new-api-port 3000 \
--sub2api-host 127.0.0.1 \
--sub2api-port 8081 \
--timezone Asia/ShanghaiInstalled Services
The generated Compose project contains two isolated networks:
new-api-network sub2api-network
new-api sub2api
new-api-postgres sub2api-postgres
new-api-redis sub2api-redisDefaults follow the upstream deployment layouts:
calciumion/new-api:latest, PostgreSQL 15, and Redisweishaw/sub2api:latest, PostgreSQL 18 Alpine, and Redis 8 Alpine- New API listens on
0.0.0.0:3000 - Sub2API listens on
127.0.0.1:8081 - Databases and Redis are not exposed on host ports
Use --new-api-image and --sub2api-image to pin application tags or digests.
Credentials and Data
Credentials are generated with Node's cryptographic random generator and
stored in .env with mode 0600. They are never embedded in
docker-compose.yml or printed by the installer. The generated Sub2API admin
password is stored as SUB2API_ADMIN_PASSWORD in that file. New API completes
its initial administrator setup in the web interface.
uninstall preserves all volumes and configuration. Permanent removal requires
both --purge and --confirm-purge.
Publishing
Verify the package before publishing:
npm test
npm pack --dry-run
npm publishThe package is published publicly under the @yibi npm organization scope.
