最近公司在推vibe coding,同时需要对key的用量进行一个精细化统计,而Qwen,GLM官方又支持很差,最后经过调研,采用了开源社区的方案new api, 这个方案其实就是二道贩子,支持将多种大模型转为统一格式调用,支持OpenAI、Claude、Gemini等格式,可供个人或者企业内部管理与分发渠道使用。
我想在树莓派装一个,但是new api的官方镜像不支持arm架构的树莓派,于是经过我的多方研究,最后选用了qemu的转译方案,可以在树莓派跑x86的镜像。
new api这个compose私有化部署方案,还附带了redis和postgress,能运行的顺利的话,说明qemu是很通用的,经得起考验。
以下为实操的命令和方案
首先,我们需要安装qemu-user-static
# 更新索引
sudo apt update
# 安装用户态 QEMU(关键包)
sudo apt install -y qemu-user-static
# 注册 binfmt(用 Docker 完成,最省心,二选一即可):
# 方式 A(推荐):
sudo docker run --rm --privileged tonistiigi/binfmt --install all
# 方式 B(传统镜像):
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# 看到 x86_64 就 OK
docker run --rm --platform=linux/amd64 alpine uname -m
随便再拉一个 amd64 容器试试:
docker run -it --platform=linux/amd64 ubuntu bash
树莓派测试log
➜ ~ sudo apt install -y qemu-user-static
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libasound2:armhf libatk-bridge2.0-0:armhf libatk1.0-0:armhf libatomic1:armhf libatspi2.0-0:armhf
libavahi-client3:armhf libavahi-common-data:armhf libavahi-common3:armhf libblkid1:armhf libbrotli1:armhf
libcaca0:armhf libcairo-gobject2:armhf libcairo2:armhf libcal3d12v5:armhf libcolord2:armhf libcom-err2:armhf
libcups2:armhf libcurl4:armhf libdatrie1:armhf libdb5.3:armhf libdecor-0-0:armhf libdeflate0:armhf
libdrm-amdgpu1:armhf libdrm-nouveau2:armhf libdrm-radeon1:armhf libdrm2:armhf libedit2:armhf libegl-mesa0:armhf
libegl1:armhf libelf1:armhf libepoxy0:armhf libexpat1:armhf libffi8:armhf libfluidsynth3:armhf libfontconfig1:armhf
libfreetype6:armhf libfribidi0:armhf libgbm1:armhf libgdk-pixbuf-2.0-0:armhf libgdk-pixbuf-xlib-2.0-0:armhf
libgdk-pixbuf2.0-0:armhf libgl1:armhf libgl1-mesa-dri:armhf libglapi-mesa:armhf libgles2:armhf libglib2.0-0:armhf
libglvnd0:armhf libglx-mesa0:armhf libglx0:armhf libgmp10:armhf libgnutls30:armhf libgomp1:armhf
libgraphite2-3:armhf libgssapi-krb5-2:armhf libgtk-3-0:armhf libgtk2.0-0:armhf libharfbuzz0b:armhf libhogweed6:armhf
libicu72:armhf libinstpatch-1.0-2:armhf libjack0:armhf libjbig0:armhf libjpeg62-turbo:armhf libk5crypto3:armhf
libkeyutils1:armhf libkrb5-3:armhf libkrb5support0:armhf liblcms2-2:armhf libldap-2.5-0:armhf liblerc4:armhf
libllvm15:armhf libmad0:armhf libmikmod3:armhf libmount1:armhf libncursesw6:armhf libnettle8:armhf
libnghttp2-14:armhf libopenal1:armhf libp11-kit0:armhf libpango-1.0-0:armhf libpangocairo-1.0-0:armhf
libpangoft2-1.0-0:armhf libpcre2-8-0:armhf libpixman-1-0:armhf libpng16-16:armhf libpsl5:armhf libreadline8:armhf
librtmp1:armhf libsamplerate0:armhf libsasl2-2:armhf libsasl2-modules-db:armhf libsdl-image1.2:armhf
libsdl-mixer1.2:armhf libsdl-net1.2:armhf libsdl-sound1.2:armhf libsdl-ttf2.0-0:armhf libsdl1.2debian:armhf
libsdl2-2.0-0:armhf libsdl2-image-2.0-0:armhf libsdl2-net-2.0-0:armhf libsdl2-ttf-2.0-0:armhf libselinux1:armhf
libsensors5:armhf libslang2:armhf libsmpeg0:armhf libsndio7.0:armhf libspeex1:armhf libssh-gcrypt-4:armhf
libssh2-1:armhf libssl3:armhf libstdc++6:armhf libtasn1-6:armhf libthai0:armhf libtiff6:armhf libtinfo6:armhf
libudev1:armhf libvorbisfile3:armhf libwayland-client0:armhf libwayland-cursor0:armhf libwayland-egl1:armhf
libwayland-server0:armhf libwebp7:armhf libxcb-dri2-0:armhf libxcb-dri3-0:armhf libxcb-glx0:armhf
libxcb-present0:armhf libxcb-randr0:armhf libxcb-render0:armhf libxcb-shm0:armhf libxcb-sync1:armhf
libxcb-xfixes0:armhf libxcomposite1:armhf libxcursor1:armhf libxdamage1:armhf libxext6:armhf libxfixes3:armhf
libxi6:armhf libxinerama1:armhf libxkbcommon0:armhf libxml2:armhf libxrandr2:armhf libxrender1:armhf
libxshmfence1:armhf libxss1:armhf libxxf86vm1:armhf libz3-4:armhf
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
box64-generic-arm box86-generic-arm:armhf pi-apps-5f3374a7 pi-apps-b87a649a
The following NEW packages will be installed:
qemu-user-static
0 upgraded, 1 newly installed, 4 to remove and 424 not upgraded.
Need to get 56.4 MB of archives.
After this operation, 267 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main arm64 qemu-user-static arm64 1:7.2+dfsg-7+deb12u16 [56.4 MB]
Fetched 56.4 MB in 1min 5s (866 kB/s)
(Reading database ... 173430 files and directories currently installed.)
Removing pi-apps-b87a649a (1.0) ...
Progress: [ 0%] [..................................................................................................]
Progress: [ 8%] [#######...........................................................................................]
Removing box64-generic-arm (0.3.3+20250120T062614.e6eac39-1) .......................................................]
Progress: [ 23%] [######################............................................................................]
Removing pi-apps-5f3374a7 (1.0) ...#############....................................................................]
Progress: [ 38%] [#####################################.............................................................]
Removing box86-generic-arm:armhf (0.3.9+20250109T063502.eaf2e84-1) .................................................]
Progress: [ 54%] [####################################################..............................................]
Selecting previously unselected package qemu-user-static.#####################......................................]
(Reading database ... 173394 files and directories currently installed.)
Preparing to unpack .../qemu-user-static_1%3a7.2+dfsg-7+deb12u16_arm64.deb ...
Unpacking qemu-user-static (1:7.2+dfsg-7+deb12u16) ...###############################...............................]
Setting up qemu-user-static (1:7.2+dfsg-7+deb12u16) ...######################################.......................]
Progress: [ 85%] [##################################################################################................]
Processing triggers for man-db (2.11.2-2) ...###############################################################........]
Processing triggers for systemd (252.33-1~deb12u1) ...
➜ ~ sudo docker run --rm --privileged tonistiigi/binfmt --install all
Unable to find image 'tonistiigi/binfmt:latest' locally
latest: Pulling from tonistiigi/binfmt
307625515e5a: Pull complete
3cd29f309f4f: Pull complete
Digest: sha256:30cc9a4d03765acac9be2ed0afc23af1ad018aed2c28ea4be8c2eb9afe03fbd1
Status: Downloaded newer image for tonistiigi/binfmt:latest
installing: mips64 qemu-mips64 already registered
installing: mips64le qemu-mips64el already registered
{
"supported": [
"linux/arm64",
"linux/amd64",
"linux/amd64/v2",
"linux/riscv64",
"linux/ppc64",
"linux/ppc64le",
"linux/s390x",
"linux/386",
"linux/loong64",
"linux/arm/v7",
"linux/arm/v6"
],
"emulators": [
"box64",
"python3.11",
"qemu-alpha",
"qemu-armeb",
"qemu-cris",
"qemu-hexagon",
"qemu-hppa",
"qemu-i386",
"qemu-loongarch64",
"qemu-m68k",
"qemu-microblaze",
"qemu-mips",
"qemu-mips64",
"qemu-mips64el",
"qemu-mipsel",
"qemu-mipsn32",
"qemu-mipsn32el",
"qemu-ppc",
"qemu-ppc64",
"qemu-ppc64le",
"qemu-riscv32",
"qemu-riscv64",
"qemu-s390x",
"qemu-sh4",
"qemu-sh4eb",
"qemu-sparc",
"qemu-sparc32plus",
"qemu-sparc64",
"qemu-x86_64",
"qemu-xtensa",
"qemu-xtensaeb",
"x86"
]
}
➜ ~ sudo docker run --rm --platform=linux/amd64 alpine uname -m
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
2d35ebdb57d9: Pull complete
Digest: sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412
Status: Downloaded newer image for alpine:latest
x86_64
➜ ~ sudo docker run -it --platform=linux/amd64 ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
4b3ffd8ccb52: Pull complete
Digest: sha256:66460d557b25769b102175144d538d88219c077c678a49af4afca6fbfc1b5252
Status: Downloaded newer image for ubuntu:latest
root@34c8d3e94f1e:/#
安装模型聚合服务
cd ~/github
# 克隆仓库
git clone https://github.com/QuantumNous/new-api
cd new-api
# 如果你的3000端口已经被占用,可以修改docker-compose.yml 的 3000 端口映射,比如我就改成了53000
# 启动服务
sudo docker compose up
日志显示顺利启动成功
➜ new-api git:(main) ✗ sudo docker compose up
WARN[0000] /home/zhaoolee/github/new-api/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Running 28/28
✔ new-api Pulled 663.7s
✔ redis Pulled 333.7s
✔ postgres Pulled 976.6s
[+] Running 5/5
✔ Network new-api_default Created 0.1s
✔ Volume "new-api_pg_data" Created 0.0s
✔ Container postgres Created 0.7s
✔ Container redis Created 0.7s
✔ Container new-api Created 0.0s
Attaching to new-api, postgres, redis
redis | Starting Redis Server
redis | 1:C 16 Oct 2025 14:50:07.671 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis | 1:C 16 Oct 2025 14:50:07.673 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis | 1:C 16 Oct 2025 14:50:07.673 * Redis version=8.2.2, bits=64, commit=00000000, modified=1, pid=1, just started
redis | 1:C 16 Oct 2025 14:50:07.673 * Configuration loaded
redis | 1:M 16 Oct 2025 14:50:07.676 * monotonic clock: POSIX clock_gettime
redis | 1:M 16 Oct 2025 14:50:07.678 * Running mode=standalone, port=6379.
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> RedisBloom version 8.2.3 (Git=unknown)
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> Registering configuration options: [
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> { bf-error-rate : 0.01 }
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> { bf-initial-size : 100 }
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> { bf-expansion-factor : 2 }
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> { cf-bucket-size : 2 }
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> { cf-initial-size : 1024 }
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> { cf-max-iterations : 20 }
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> { cf-expansion-factor : 1 }
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> { cf-max-expansions : 32 }
redis | 1:M 16 Oct 2025 14:50:07.679 * <bf> ]
redis | 1:M 16 Oct 2025 14:50:07.679 * Module 'bf' loaded from /usr/local/lib/redis/modules//redisbloom.so
redis | 1:M 16 Oct 2025 14:50:07.683 * <search> Redis version found by RedisSearch : 8.2.2 - oss
redis | 1:M 16 Oct 2025 14:50:07.683 * <search> RediSearch version 8.2.5 (Git=222ad3b)
redis | 1:M 16 Oct 2025 14:50:07.684 * <search> Low level api version 1 initialized successfully
redis | 1:M 16 Oct 2025 14:50:07.684 * <search> gc: ON, prefix min length: 2, min word length to stem: 4, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results: 1000000,
redis | 1:M 16 Oct 2025 14:50:07.684 * <search> Initialized thread pools!
redis | 1:M 16 Oct 2025 14:50:07.684 * <search> Disabled workers threadpool of size 0
postgres | The files belonging to this database system will be owned by user "postgres".
redis | 1:M 16 Oct 2025 14:50:07.684 * <search> Subscribe to config changes
postgres | This user must also own the server process.
redis | 1:M 16 Oct 2025 14:50:07.684 * <search> Enabled role change notification
postgres |
redis | 1:M 16 Oct 2025 14:50:07.684 * <search> Cluster configuration: AUTO partitions, type: 0, coordinator timeout: 0ms
postgres | The database cluster will be initialized with locale "en_US.utf8".
redis | 1:M 16 Oct 2025 14:50:07.684 * <search> Register write commands
postgres | The default database encoding has accordingly been set to "UTF8".
redis | 1:M 16 Oct 2025 14:50:07.684 * Module 'search' loaded from /usr/local/lib/redis/modules//redisearch.so
postgres | The default text search configuration will be set to "english".
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> RedisTimeSeries version 80200, git_sha=1439d4a439ca9c063e6ef124a510abff09a5d493
postgres |
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> Redis version found by RedisTimeSeries : 8.2.2 - oss
postgres | Data page checksums are disabled.
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> Registering configuration options: [
postgres |
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> { ts-compaction-policy : }
postgres | fixing permissions on existing directory /var/lib/postgresql/data ... ok
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> { ts-num-threads : 3 }
postgres | creating subdirectories ... ok
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> { ts-retention-policy : 0 }
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> { ts-duplicate-policy : block }
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> { ts-chunk-size-bytes : 4096 }
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> { ts-encoding : compressed }
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> { ts-ignore-max-time-diff: 0 }
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> { ts-ignore-max-val-diff : 0.000000 }
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> ]
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> Detected redis oss
redis | 1:M 16 Oct 2025 14:50:07.685 * <timeseries> Enabled diskless replication
postgres | selecting dynamic shared memory implementation ... posix
redis | 1:M 16 Oct 2025 14:50:07.685 * Module 'timeseries' loaded from /usr/local/lib/redis/modules//redistimeseries.so
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> Created new data type 'ReJSON-RL'
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> version: 80201 git sha: unknown branch: unknown
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> Exported RedisJSON_V1 API
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> Exported RedisJSON_V2 API
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> Exported RedisJSON_V3 API
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> Exported RedisJSON_V4 API
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> Exported RedisJSON_V5 API
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> Enabled diskless replication
redis | 1:M 16 Oct 2025 14:50:07.686 * <ReJSON> Initialized shared string cache, thread safe: false.
redis | 1:M 16 Oct 2025 14:50:07.686 * Module 'ReJSON' loaded from /usr/local/lib/redis/modules//rejson.so
redis | 1:M 16 Oct 2025 14:50:07.686 * <search> Acquired RedisJSON_V5 API
redis | 1:M 16 Oct 2025 14:50:07.689 * Server initialized
redis | 1:M 16 Oct 2025 14:50:07.689 * Ready to accept connections tcp
postgres | selecting default max_connections ... 100
postgres | selecting default shared_buffers ... 128MB
postgres | selecting default time zone ... Etc/UTC
postgres | creating configuration files ... ok
postgres | running bootstrap script ... ok
new-api | [SYS] 2025/10/16 - 22:50:08 | initializing token encoders
new-api | [SYS] 2025/10/16 - 22:50:08 | token encoders initialized
new-api | [SYS] 2025/10/16 - 22:50:08 | using PostgreSQL as database
new-api | [SYS] 2025/10/16 - 22:50:08 | database migration started
new-api |
new-api | 2025/10/16 22:50:08 /build/model/main.go:251 failed to connect to `user=root database=new-api`:
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | [4.595ms] [rows:-] SELECT count(*) FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_name = 'channels' AND table_type = 'BASE TABLE'
new-api |
new-api | 2025/10/16 22:50:08 /build/model/main.go:251 failed to connect to `user=root database=new-api`:
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | [3.706ms] [rows:0] CREATE TABLE "channels" ("id" bigserial,"type" bigint DEFAULT 0,"key" text NOT NULL,"open_ai_organization" text,"test_model" text,"status" bigint DEFAULT 1,"name" text,"weight" bigint DEFAULT 0,"created_time" bigint,"test_time" bigint,"response_time" bigint,"base_url" text DEFAULT '',"other" text,"balance" decimal,"balance_updated_time" bigint,"models" text,"group" varchar(64) DEFAULT 'default',"used_quota" bigint DEFAULT 0,"model_mapping" text,"status_code_mapping" varchar(1024) DEFAULT '',"priority" bigint DEFAULT 0,"auto_ban" bigint DEFAULT 1,"other_info" text,"tag" text,"setting" text,"param_override" text,"header_override" text,"remark" varchar(255),"channel_info" json,"settings" text,PRIMARY KEY ("id"))
new-api | [FATAL] 2025/10/16 - 22:50:08 | [failed to initialize database: failed to connect to `user=root database=new-api`:
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused]
postgres | performing post-bootstrap initialization ... ok
new-api exited with code 0
new-api | [SYS] 2025/10/16 - 22:50:08 | initializing token encoders
postgres | initdb: warning: enabling "trust" authentication for local connections
postgres | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
postgres | syncing data to disk ... ok
postgres |
postgres |
postgres | Success. You can now start the database server using:
postgres |
postgres | pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres |
new-api | [SYS] 2025/10/16 - 22:50:08 | token encoders initialized
new-api | [SYS] 2025/10/16 - 22:50:08 | using PostgreSQL as database
new-api | [SYS] 2025/10/16 - 22:50:08 | database migration started
new-api |
new-api | 2025/10/16 22:50:08 /build/model/main.go:251 failed to connect to `user=root database=new-api`:
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | [1.849ms] [rows:-] SELECT count(*) FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_name = 'channels' AND table_type = 'BASE TABLE'
new-api | [FATAL] 2025/10/16 - 22:50:08 | [failed to initialize database: failed to connect to `user=root database=new-api`:
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused]
new-api |
new-api | 2025/10/16 22:50:08 /build/model/main.go:251 failed to connect to `user=root database=new-api`:
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | 172.19.0.3:5432 (postgres): dial error: dial tcp 172.19.0.3:5432: connect: connection refused
new-api | [2.495ms] [rows:0] CREATE TABLE "channels" ("id" bigserial,"type" bigint DEFAULT 0,"key" text NOT NULL,"open_ai_organization" text,"test_model" text,"status" bigint DEFAULT 1,"name" text,"weight" bigint DEFAULT 0,"created_time" bigint,"test_time" bigint,"response_time" bigint,"base_url" text DEFAULT '',"other" text,"balance" decimal,"balance_updated_time" bigint,"models" text,"group" varchar(64) DEFAULT 'default',"used_quota" bigint DEFAULT 0,"model_mapping" text,"status_code_mapping" varchar(1024) DEFAULT '',"priority" bigint DEFAULT 0,"auto_ban" bigint DEFAULT 1,"other_info" text,"tag" text,"setting" text,"param_override" text,"header_override" text,"remark" varchar(255),"channel_info" json,"settings" text,PRIMARY KEY ("id"))
postgres | waiting for server to start....2025-10-16 14:50:08.775 UTC [48] LOG: starting PostgreSQL 15.14 (Debian 15.14-1.pgdg13+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
postgres | 2025-10-16 14:50:08.777 UTC [48] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres | 2025-10-16 14:50:08.784 UTC [51] LOG: database system was shut down at 2025-10-16 14:50:08 UTC
postgres | 2025-10-16 14:50:08.795 UTC [48] LOG: database system is ready to accept connections
postgres | done
postgres | server started
postgres | CREATE DATABASE
postgres |
postgres |
postgres | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres |
postgres | 2025-10-16 14:50:09.016 UTC [48] LOG: received fast shutdown request
postgres | waiting for server to shut down....2025-10-16 14:50:09.017 UTC [48] LOG: aborting any active transactions
postgres | 2025-10-16 14:50:09.029 UTC [48] LOG: background worker "logical replication launcher" (PID 54) exited with exit code 1
postgres | 2025-10-16 14:50:09.031 UTC [49] LOG: shutting down
postgres | 2025-10-16 14:50:09.035 UTC [49] LOG: checkpoint starting: shutdown immediate
postgres | 2025-10-16 14:50:09.119 UTC [49] LOG: checkpoint complete: wrote 922 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.043 s, sync=0.034 s, total=0.088 s; sync files=301, longest=0.003 s, average=0.001 s; distance=4239 kB, estimate=4239 kB
postgres | 2025-10-16 14:50:09.128 UTC [48] LOG: database system is shut down
postgres | done
postgres | server stopped
postgres |
postgres | PostgreSQL init process complete; ready for start up.
postgres |
postgres | 2025-10-16 14:50:09.246 UTC [1] LOG: starting PostgreSQL 15.14 (Debian 15.14-1.pgdg13+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
postgres | 2025-10-16 14:50:09.258 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres | 2025-10-16 14:50:09.258 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres | 2025-10-16 14:50:09.259 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres | 2025-10-16 14:50:09.263 UTC [64] LOG: database system was shut down at 2025-10-16 14:50:09 UTC
postgres | 2025-10-16 14:50:09.268 UTC [1] LOG: database system is ready to accept connections
new-api exited with code 0
new-api | [SYS] 2025/10/16 - 22:50:09 | initializing token encoders
new-api | [SYS] 2025/10/16 - 22:50:09 | token encoders initialized
new-api | [SYS] 2025/10/16 - 22:50:09 | using PostgreSQL as database
new-api | [SYS] 2025/10/16 - 22:50:09 | database migration started
new-api |
new-api | 2025/10/16 22:50:09 /build/model/setup.go:11 record not found
new-api | [0.514ms] [rows:0] SELECT * FROM "setups" ORDER BY "setups"."id" LIMIT 1
new-api |
new-api | 2025/10/16 22:50:09 /build/model/user.go:913 record not found
new-api | [2.082ms] [rows:0] SELECT * FROM "users" WHERE role = 100 AND "users"."deleted_at" IS NULL ORDER BY "users"."id" LIMIT 1
new-api | [SYS] 2025/10/16 - 22:50:09 | system is not initialized and no root user exists
new-api | [SYS] 2025/10/16 - 22:50:09 | SYNC_FREQUENCY not set, use default value 60
new-api | [SYS] 2025/10/16 - 22:50:09 | Redis is enabled
new-api | [SYS] 2025/10/16 - 22:50:09 | New API v0.9.9-patch.3 started
new-api | [SYS] 2025/10/16 - 22:50:09 | memory cache enabled
new-api | [SYS] 2025/10/16 - 22:50:09 | sync frequency: 60 seconds
new-api | [SYS] 2025/10/16 - 22:50:09 | channels synced from database
new-api | [SYS] 2025/10/16 - 22:50:09 | 正在更新数据看板数据...
new-api | [SYS] 2025/10/16 - 22:50:09 | 保存数据看板数据成功,共保存0条数据
new-api | [SYS] 2025/10/16 - 22:50:09 | batch update enabled with interval 5s
new-api |
new-api | New API v0.9.9-patch.3 ready in 300 ms
new-api |
new-api | ➜ Network: http://172.19.0.4:3000/
new-api |
new-api | [SYS] 2025/10/16 - 22:50:24 | 任务进度轮询开始
new-api | [SYS] 2025/10/16 - 22:50:24 | 任务进度轮询完成
后续我们可以改为后台运行
➜ new-api git:(main) ✗ sudo docker compose up -d
WARN[0000] /home/zhaoolee/github/new-api/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Running 3/3
✔ Container postgres Started 0.4s
✔ Container redis Started 0.4s
✔ Container new-api Started 0.7s
➜ new-api git:(main) ✗
打开树莓派IP对应的53000端口,发现服务运行成功
小结
树莓派作为家庭服务器,得益于arm架构的省电特性,可以常年开机,稳定运行;树莓派最大的痛点其实还是无法跑x86架构的docker镜像,而使用qemu,虽然有一些性能损失,但可以让树莓派有更大的可玩性!
更多树莓派不吃灰教程:github.com/zhaoolee/pi