跳转到主要内容
☁️ 选项 0:云版本(零配置) 不想自托管?立即在 cloud.fim.ai 尝试 FIM One — 无需 Docker、无需 API 密钥、无需配置。登录即可开始使用。早期访问。
No local Python or Node.js required — everything is built inside the container.
Open http://localhost:3000 — on first launch you’ll be guided through creating an admin account. That’s it. After the initial build, subsequent starts only need:
Data is persisted in the bind-mounted ./data and ./uploads directories and in the postgres_data / redis_data named volumes, and survives container restarts. Note: Docker mode does not support hot reload. Code changes require rebuilding the image (docker compose up --build -d). For active development with live reload, use Option B below.

Option B: Local Development

Prerequisites: Python 3.11+, uv, Node.js 18+, pnpm.

配置

FIM One 与任何 OpenAI 兼容的 LLM 提供商配合使用 — OpenAI、DeepSeek、Anthropic、Qwen、Ollama、vLLM 等。 Jina AI 解锁网络搜索/获取、嵌入和完整的 RAG 管道(提供免费层)。 最小化 .env:
有关所有配置选项的完整列表,请参阅环境变量参考。

生产部署

docker compose up -d brings up everything you need — no manual service configuration required:

ARM64 Hosts

The images build for both linux/amd64 and linux/arm64 (e.g. Kunpeng servers) from the same Dockerfile and Dockerfile.sandbox. Every base image is multi-arch and every Python dependency in uv.lock ships a Linux ARM64 wheel, so nothing is compiled from source. On an ARM64 host, docker compose up --build -d or ./deploy.sh builds ARM64 images with no extra steps. To build on one machine and run on another, for example ARM64 images for an offline server, use scripts/build-images.sh (requires docker buildx):
A non-native architecture is built under QEMU emulation and takes several times longer. Docker Desktop includes QEMU; on Linux, register it once with docker run --privileged --rm tonistiigi/binfmt --install arm64 (or amd64). The container is privileged because it registers the emulator in the host kernel. On the target host, load the archive and give the images the names Docker Compose uses, then start without rebuilding. docker compose config --images prints those names; the app image is <project>-fim-one, where <project> is the Compose project name (the checkout directory name, lowercased and without characters such as dots).
On a host without internet access:
  • postgres:16-alpine and redis:7-alpine are not in the archive. Pull them for the target architecture on a connected machine and transfer them with docker save / docker load.
  • With CODE_EXEC_BACKEND=docker, JavaScript execution uses node:20-slim, which is not in the archive either. Transfer it the same way, or the first JavaScript run fails on the image pull.
  • Do not use ./deploy.sh there: it always rebuilds (up -d --build), which needs the network. Use docker compose up -d --no-build.

Scaling with Workers

By default, the API runs with a single worker process. To handle more concurrent users, increase workers via .env:
Multi-worker requirements:
  • PostgreSQL — SQLite is single-writer and does not support concurrent writes. Docker Compose already runs PostgreSQL and points DATABASE_URL at it; on bare metal, set DATABASE_URL to a PostgreSQL connection string.
  • Redis — already included in Docker Compose (auto-configured). Handles cross-worker interrupt/inject relay.
With WORKERS=1 (default) outside Docker Compose, no Redis or PostgreSQL is needed — SQLite works fine.

Nginx Reverse Proxy

For HTTPS and custom domain, put an Nginx reverse proxy in front:
The API runs internally on port 8000 — Next.js proxies /api/* requests automatically. Only port 3000 needs to be exposed. Behind a reverse proxy, set FORWARDED_ALLOW_IPS to the proxy’s address or network so FIM One sees the real client address. Without it every request appears to come from the proxy, which is what IP rules (admin Security → IP Rules) and login history would then record.

Code Execution Sandbox

With the bundled docker-compose.yml, code execution runs in throw-away sandbox containers without a network (CODE_EXEC_BACKEND=docker, the compose default). The application container does not get the Docker socket. A small docker-socket-proxy service holds it and only starts sandbox containers:
Do not add the socket to the fim-one service: access to it is equivalent to root on the host. The application runs as an unprivileged user (fim, uid 10001); on first start the entrypoint hands ./data and ./uploads over to that user. See Security → Code execution and the Docker socket, which also has the upgrade steps for an existing deployment.

Cloudflare Tunnel

对于零开放端口的设置,使用 Cloudflare Tunnel 代替 Nginx。所有流量都通过 Cloudflare 的边缘节点流动 — 无需暴露 80/443 端口、管理 SSL 证书或配置防火墙规则。
中国大陆用户:Cloudflare Free/Pro/Business 计划在中国大陆没有 PoP(存在点)。来自中国大陆的流量被路由到海外边缘节点(通常是美国西部),导致频繁的 502 错误和高延迟。如果您的主要用户在中国大陆,不要使用 Cloudflare Tunnel。需要 Cloudflare Enterprise with China Network(JD Cloud 合作)才能可靠地访问中国大陆。
设置:
1

创建隧道

前往 Cloudflare Zero Trust → Networks → Tunnels → Create a tunnel。 选择 Cloudflared 作为连接器类型。
2

配置公共主机名

在隧道配置中,添加一个公共主机名:将所有其他设置(HTTP Host Header、Chunked Encoding、Timeouts、Access)保留为默认值。
URL 使用 Docker 服务名称 fim-one,而不是 localhost,因为 cloudflared 作为同一 Docker 网络中的单独容器运行。
3

复制隧道令牌

在隧道的 Configure 页面中,找到安装命令 — 它包含一个以 eyJ... 开头的令牌。复制它。
4

将令牌添加到 .env

5

使用隧道覆盖层部署

docker-compose.tunnel.yml 覆盖层添加了一个 cloudflared sidecar 容器。基础 docker-compose.yml 保持不变 — 没有 Cloudflare 的社区用户可以继续使用 docker compose up -d。
6

删除旧的 DNS 记录

如果您的域名之前有一条 A 记录指向您的服务器 IP,在 Cloudflare DNS 中删除它。隧道会自动创建一条 CNAME 记录指向其边缘端点。
7

关闭服务器端口

从服务器上的 docker-compose.yml 中删除(或注释掉)ports 部分。流量现在完全通过隧道流动 — 无需入站端口。
Cloudflare Tunnel 在所有计划(包括 Free)上都是免费的。没有带宽或流量限制。

脚本部署(裸机)

对于裸机服务器或自定义进程管理器,直接使用 ./start.sh:
在此模式下,Redis 不会自动包含。系统默认以单工作进程、进程内模式运行——适合低流量部署。 要在本地启用带 Redis 的多工作进程: