依旧懒得写,先上yml
因为我服务器安装了1panel,虽然是本地docker-compose.yml部署,但是走的是1p的网络,直接用1p商店的postgresql、redis数据库。
YAML
version: '3.4'
services:
new-api:
image: calciumion/new-api:latest
container_name: new-api
restart: always
command: --log-dir /app/logs
ports:
- '5188:3000' # 外部访问端口:docker容器监听端口
volumes:
- ./data:/data
- ./logs:/app/logs
environment:
- SQL_DSN=postgresql://<数据库用户名>:<数据库密码>@<pg容器host>:<pg容器端口>/<数据库名>
#- SQL_DSN=root:123456@tcp(mysql:3306)/new-api # Point to the mysql service, uncomment if using MySQL
- REDIS_CONN_STRING=redis://:<redis容器密码>@<redis容器host>:<redis端口>
- 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 # 缓存同步频率;独立 Redis 部署下也是 Session 最大陈旧窗口
networks:
- 1panel-network
networks:
1panel-network:
external: true



我的更加简单
对于一般用户来说 pg 和 redis 完全用不上吧?
除非你要卖 token(s)