Docker newapi

Docker newapi

docker-compose.yaml

yml 复制代码
services:

  new-api:
    networks:
      - zhaoxin
    image: calciumion/new-api:latest
    container_name: new-api
    restart: always
    command: --log-dir /app/logs
    ports:
      - '3000:3000'
    volumes:
      - /app/newapi/data:/data
      - /app/newapi/logs:/app/logs
    environment:
      - SQL_DSN=postgresql://root:123456@postgres:5432/new-api # ⚠️ IMPORTANT: Change the password in production!
      #     - SQL_DSN=root:123456@tcp(mysql:3306)/new-api  # Point to the mysql service, uncomment if using MySQL
      - REDIS_CONN_STRING=redis://:fsdfgssds@redis:6379
      - TZ=Asia/Shanghai
      - ERROR_LOG_ENABLED=true # 是否启用错误日志记录
      - BATCH_UPDATE_ENABLED=true # 是否启用批量更新 batch update enabled
    #      - STREAMING_TIMEOUT=300  # 流模式无响应超时时间,单位秒,默认120秒,如果出现空补全可以尝试改为更大值 Streaming timeout in seconds, default is 120s. Increase if experiencing empty completions
    #      - SESSION_SECRET=random_string  # 多机部署时设置,必须修改这个随机字符串!! multi-node deployment, set this to a random string!!!!!!!
    #      - SYNC_FREQUENCY=60  # Uncomment if regular database syncing is needed
    depends_on:
    #   - redis
      - postgres
    #      - mysql  # Uncomment if using MySQL
    healthcheck:
      test:
        [
          'CMD-SHELL',
          "wget -q -O - http://localhost:3000/api/status | grep -o '\"success\":\\s*true' || exit 1",
        ]
      interval: 30s
      timeout: 10s
      retries: 3

networks:
  zhaoxin:
    external: true
yml 复制代码
services:

  postgres:
    networks:
      - zhaoxin
    image: postgres:15
    container_name: postgres
    restart: always
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: 123456
      POSTGRES_DB: sub2api
    volumes:
      - /app/postgres/data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  redis:
    image: redis:latest
    container_name: redis
    restart: unless-stopped
    networks:
      - zhaoxin
    ports:
      - "6379:6379"
    volumes:
      - /app/redis/data:/data
    command: redis-server --requirepass 123456

networks:
  zhaoxin:
    external: true
相关推荐
张文君5 小时前
ubuntu26.04从ext4改成mdadm的raid1+lvm启动
linux·运维·网络
DevHub6 小时前
QEMU + Busybox 搭建嵌入式 Linux 开发环境:内核编译到启动,30 秒一个迭代
linux·运维·服务器
ouynagda6 小时前
Linux 进程管理详解:从概念到实践
linux·运维·网络
2401_890603406 小时前
Linux 基础文件IO
linux·运维·服务器
tx11208763586 小时前
K8S-pod管理与控制器管理
linux·运维·kubernetes·pod
Awh-6 小时前
Linux软件应用编程 第一章中:Linux文件操作
linux·运维·服务器
adinnet20267 小时前
财务报销自动化:用智能体辅助处理繁琐报销任务
运维·自动化
μθημα7 小时前
Kubernetes 集群部署实操:从 Harbor 私有仓库到三节点集群搭建
云原生·容器·kubernetes
zhendianluli8 小时前
VS Code Remote-SSH 连接故障排查手册(精详版)
运维·ssh