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
相关推荐
Inhand陈工4 小时前
数据中心UPS无功补偿与智能化监控方案:基于IG502的Modbus RTU转IEC61850实战
运维·人工智能·物联网·信息与通信
qetfw4 小时前
CentOS 7 搭建 LDAP 目录服务
linux·运维·centos
IT方大同5 小时前
linux简介
linux·运维·服务器
Dear~yxy6 小时前
时间同步服务器搭建
运维·服务器
Gem_S_6086 小时前
产品任务流转工具实践:构建需求到交付的全流程协作体系
运维
项目管理与代码6 小时前
基于Webhook+消息队列的自动化项目进度跟踪方案设计
运维·自动化
wbs_scy7 小时前
仿 muduo 高并发服务器项目:实现 LoopThread 与 LoopThreadPool 多线程事件循环
运维·服务器
微道道7 小时前
Linux盒子局域网内使用 .local 域名访问,告别IP变化烦恼
linux·运维·服务器·hermes
copyer_xyf7 小时前
Docker 入门与实战:容器化 React + NestJS 项目
docker
霸道流氓气质7 小时前
CodeBuddy中配置Playwright MCP 浏览器自动化完全指南
运维·自动化