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
相关推荐
派小心.4 分钟前
多端数据分析平台的漏斗可以跨端搭建吗?5 步搭出跨端转化漏斗
大数据·运维·服务器·前端·数据分析
芷栀夏8 分钟前
极空间部署Photopea:Docker运行、网页修图与多设备使用
运维·docker·容器
见闻小天地13 分钟前
数据中心柴发出口保护怎么选?Emax 与 Tmax XT 的定位与分工
大数据·运维·人工智能·业界资讯
迈威通信27 分钟前
迈威 MISCOM8212GP-4XGF-8GTPoE90-DC48 接入层实践:高密度 PoE++ 与万兆上行的整合方案
运维·网络·信息与通信
小小的木头人28 分钟前
CentOS 7.9 离线安装 NVIDIA Container Toolkit:1.14.0 与 1.20.1 两种版本方案
linux·运维·centos
哭哭啼32 分钟前
Linux 资源紧缺模拟:CPU、内存、磁盘与文件描述符压力测试
linux·运维·压力测试
酒神dnspup43 分钟前
多地区网站可用性监控怎么做?DNSPup 从基线到告警的完整实战
运维·ios·云计算·iphone·dns·网络监控
在角落发呆9 小时前
工具配置备份步骤:从手动备份到自动化方案
运维·windows·自动化
百度一下吧10 小时前
Nginx 使用手册:从安装配置到实战部署
运维·nginx
JeJe同学10 小时前
Docker镜像导入、容器启动
linux·运维·docker