sub2api

shaywong/sub2api Docker Image

Sub2API是一款AI API网关平台,专注于分发和管理AI产品订阅的API配额。

下载次数: 0状态:社区镜像维护者:shaywong仓库类型:镜像最近更新:
下载命令
点击查看

Sub2API Docker Image

Sub2API is an AI API Gateway Platform for distributing and managing AI product subscription API quotas.

Quick Start

bash
docker run -d \
  --name sub2api \
  -p 8080:8080 \
  -e DATABASE_URL="postgres://user:pass@host:5432/sub2api" \
  -e REDIS_URL="redis://host:6379" \
  weishaw/sub2api:latest

Docker Compose

yaml
version: '3.8'

services:
  sub2api:
    image: weishaw/sub2api:latest
    ports:
      - "8080:8080"
    environment:
      - DATABASE_URL=postgres://postgres:postgres@db:5432/sub2api?sslmode=disable
      - REDIS_URL=redis://redis:6379
    depends_on:
      - db
      - redis

  db:
    image: postgres:15-alpine
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=sub2api
    volumes:
      - postgres_data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    volumes:
      - redis_data:/data

volumes:
  postgres_data:
  redis_data:

Startup and Database Recovery

Sub2API runs database migrations while starting. PostgreSQL may still be recovering briefly after a host or Docker daemon restart. The application retries transient PostgreSQL startup and connection errors with bounded exponential backoff, then continues startup when the database is ready. Permanent errors such as invalid credentials, migration checksum mismatches, SQL errors, and incompatible data fail immediately.

The Compose deployment also checks PostgreSQL readiness with both pg_isready and a simple SQL query. depends_on: condition: service_healthy helps order a fresh Compose start, but application-level retries are still required when Docker restores existing containers after a host restart.

Environment Variables

VariableDescriptionRequiredDefault
DATABASE_URLPostgreSQL connection stringYes-
REDIS_URLRedis connection stringYes-
PORTServer portNo8080
GIN_MODEGin framework mode (debug/release)Norelease

Supported Architectures

  • linux/amd64
  • linux/arm64

Tags

  • latest - Latest stable release
  • x.y.z - Specific version
  • x.y - Latest patch of minor version
  • x - Latest minor of major version

Links

  • https://github.com/***/sub2api
  • https://github.com/***/sub2api#readme

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 sub2api 镜像标签

docker pull docker.xuanyuan.run/shaywong/sub2api:<标签>

DockerHub 原生拉取命令

docker pull shaywong/sub2api:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告