Deploying Multica on K3
Multica is a source-available multi-user, multi-agent collaboration platform that turns coding agents into real teammates.
This guide is for K3 hosts running Linux riscv64. Here, K3 refers to a RISC-V host.
Understand the limitations first
The currently published multica-backend and multica-web images are available only for linux/amd64 and linux/arm64. Running the following command directly on K3 will fail:
docker pull ghcr.io/multica-ai/multica-web:<tag>
no matching manifest for linux/riscv64
Therefore, do not run make selfhost directly on K3 or add linux/riscv64 directly to the release matrix. QEMU can emulate amd64 images, but Next.js server-side rendering will be noticeably slower, and this is not native RISC-V support.
This guide uses the following topology:
Build machine with a supported architecture (amd64/arm64)
├─ Build riscv64 binaries for the Go backend
└─ Build Next.js standalone frontend artifacts
│ rsync / scp
▼
K3 (riscv64)
├─ Native PostgreSQL 17+
├─ Native Go backend
└─ Native Node.js running the built Next.js JavaScript
│
▼
LAN browsers and Multica daemon
K3 runs the already-built frontend JavaScript; it does not run next build. The current Next.js build tries to load the linux/riscv64 native SWC package, so rebuilding on K3 will usually fail with Failed to load SWC binary for linux/riscv64.
1. Prepare K3
Check the architecture and runtimes on K3:
uname -m # Should be riscv64
node --version # Node.js 22.x recommended
go version # Used to run or build the CLI/daemon
psql --version # PostgreSQL 17 or later
PostgreSQL needs the pgcrypto and pg_trgm extensions enabled. Multica does not require pgvector; the official container uses the pgvector/pgvector image mainly for historical reasons. See SELF_HOSTING_ADVANCED.md for database requirements and extension details.
Create the database and user (adjust the service management commands for your distribution):
sudo -u postgres psql <<'SQL'
CREATE USER multica WITH PASSWORD 'replace-with-a-long-password';
CREATE DATABASE multica OWNER multica;
SQL
sudo -u postgres psql -d multica <<'SQL'
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
SQL
Do not use the example password in an actual deployment. In production, PostgreSQL should bind only to the local machine or a restricted internal network address.
2. Build artifacts on a machine with a supported architecture
On an amd64 or arm64 build machine, check out the release tag that matches the version you want to deploy. The build machine needs Git, Go 1.26+, Node.js 22.x, Corepack, and pnpm.
git clone https://github.com/multica-ai/multica.git
cd multica
git fetch --tags --depth 1
git checkout <release-tag>
corepack enable
pnpm install --frozen-lockfile
Build the riscv64 backend. CGO_ENABLED=0 minimizes the artifacts’ dependence on C runtime libraries on K3:
cd server
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 \
go build -ldflags "-s -w" -o bin/server ./cmd/server
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 \
go build -ldflags "-s -w" -o bin/multica ./cmd/multica
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 \
go build -ldflags "-s -w" -o bin/migrate ./cmd/migrate
cd ..
Build the Next.js standalone frontend. This step must be completed on an amd64 or arm64 build machine:
STANDALONE=true pnpm --filter @multica/web build
Prepare the directory to copy to K3. All three components—standalone, .next/static, and public—must be retained:
mkdir -p dist/web/apps/web/.next
cp -a apps/web/.next/standalone/. dist/web/
cp -a apps/web/.next/static dist/web/apps/web/.next/
cp -a apps/web/public dist/web/apps/web/
mkdir -p dist/server
cp server/bin/{server,multica,migrate} dist/server/
cp -a server/migrations dist/server/
cp LICENSE NOTICE dist/server/
If the build artifacts include a platform-specific native addon (such as an image-processing module), it may still contain amd64 binaries. First verify it on K3 as described in section 5; if you encounter ELFCLASS, Exec format error, or native binding errors, that addon also needs a separate RISC-V build. Replacing Node.js alone is not enough.
3. Upload to K3
rsync -a dist/server/ k3:/opt/multica/server/
rsync -a dist/web/ k3:/opt/multica/web/
ssh k3 'chmod +x /opt/multica/server/{server,multica,migrate}'
The final directory should contain at least:
/opt/multica/server/server
/opt/multica/server/multica
/opt/multica/server/migrate
/opt/multica/server/migrations/...
/opt/multica/web/apps/web/server.js
/opt/multica/web/apps/web/.next/static/...
/opt/multica/web/apps/web/public/...
4. Migrate the database and configure the backend
On K3, create a configuration directory and a runtime user, then create /etc/multica/backend.env:
sudo install -d -m 750 /etc/multica
sudo useradd --system --home /var/lib/multica --create-home multica || true
DATABASE_URL=postgres://multica:replace-with-a-long-password@127.0.0.1:5432/multica?sslmode=disable
JWT_SECRET=replace-with-output-of-openssl-rand-hex-32
PORT=8080
APP_ENV=production
FRONTEND_ORIGIN=http://<k3-lan-ip>:3000
MULTICA_APP_URL=http://<k3-lan-ip>:3000
MULTICA_PUBLIC_URL=http://<k3-lan-ip>:3000
ALLOW_SIGNUP=true
RESEND_FROM_EMAIL=noreply@multica.ai
LOCAL_UPLOAD_DIR=/var/lib/multica/uploads
# Leave empty if no email service is available; verification codes will be written to the backend log
RESEND_API_KEY=
Generate a secret and restrict permissions:
openssl rand -hex 32
sudo chown root:multica /etc/multica/backend.env
sudo chmod 640 /etc/multica/backend.env
Run the migration once:
cd /opt/multica/server
set -a
. /etc/multica/backend.env
set +a
sudo -u multica env DATABASE_URL="$DATABASE_URL" ./migrate up
The migration must use exactly the same database as the backend.
Create /etc/systemd/system/multica-backend.service:
[Unit]
Description=Multica backend
After=network-online.target postgresql.service
Wants=network-online.target
[Service]
Type=simple
User=multica
Group=multica
WorkingDirectory=/opt/multica/server
EnvironmentFile=/etc/multica/backend.env
ExecStart=/opt/multica/server/server
Restart=on-failure
RestartSec=3
NoNewPrivileges=true
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Create the upload directory, then start the service:
sudo mkdir -p /var/lib/multica/uploads
sudo chown -R multica:multica /var/lib/multica /opt/multica
sudo systemctl daemon-reload
sudo systemctl enable --now multica-backend
curl -fsS http://127.0.0.1:8080/readyz
If the backend uses local attachment storage, you also need to map the upload directory to the path actually configured in the application. If you need to retain attachments long-term, configuring S3 is recommended; otherwise, check the upload directory configuration for your current version before mounting /var/lib/multica/uploads at the corresponding path.
5. Start the native Node frontend
The frontend uses a standalone server. Do not run next build or next start on K3. Create /etc/multica/frontend.env:
NODE_ENV=production
HOSTNAME=127.0.0.1
PORT=3001
REMOTE_API_URL=http://127.0.0.1:8080
NEXT_TELEMETRY_DISABLED=1
Create /etc/systemd/system/multica-frontend.service:
[Unit]
Description=Multica frontend
After=network-online.target multica-backend.service
Wants=network-online.target
[Service]
Type=simple
User=multica
Group=multica
WorkingDirectory=/opt/multica/web/apps/web
EnvironmentFile=/etc/multica/frontend.env
ExecStart=/usr/bin/node /opt/multica/web/apps/web/server.js
Restart=on-failure
RestartSec=3
NoNewPrivileges=true
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Start the frontend and confirm that it listens only on the local loopback address:
sudo systemctl daemon-reload
sudo systemctl enable --now multica-frontend
curl -fsS http://127.0.0.1:3001/ >/dev/null
6. Use Caddy for LAN access
It is recommended that the backend and Node frontend listen only on 127.0.0.1, with Caddy serving as the single listener on K3’s LAN port. This ensures that /health, browser WebSocket connections, and daemon WebSocket connections are explicitly forwarded to the backend.
After installing Caddy, create /etc/caddy/Caddyfile:
:3000 {
# CLI reachability check
handle /health {
reverse_proxy 127.0.0.1:8080
}
handle /readyz {
reverse_proxy 127.0.0.1:8080
}
# Browser real-time connections
handle /ws* {
reverse_proxy 127.0.0.1:8080
}
# Persistent daemon connections
handle /api/daemon/ws* {
reverse_proxy 127.0.0.1:8080
}
# The frontend handles all other pages and API proxying
handle {
reverse_proxy 127.0.0.1:3001
}
}
sudo systemctl enable --now caddy
curl -i -H 'Host: <k3-lan-ip>:3000' http://127.0.0.1:3000/health
Access http://<k3-lan-ip>:3000 in a browser and from the computer running the daemon. Expose this port only on a trusted LAN; public deployments must use HTTPS and update FRONTEND_ORIGIN, MULTICA_APP_URL, and MULTICA_PUBLIC_URL accordingly.
7. Connect a local runtime
Install the Multica CLI on the computer running your AI coding tools, then point it to Caddy’s same-origin address:
multica setup self-host \
--server-url http://<k3-lan-ip>:3000 \
--app-url http://<k3-lan-ip>:3000
multica daemon status --output json
If the daemon runs on K3 itself, you need a RISC-V build of the multica CLI:
cd /path/to/multica/server
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 \
go build -ldflags "-s -w" -o bin/multica ./cmd/multica
./bin/multica setup self-host \
--server-url http://<k3-lan-ip>:3000 \
--app-url http://<k3-lan-ip>:3000
The user running the daemon must be able to execute the configured AI coding tools directly, and the working directory must be writable. Do not use localhost interchangeably across the frontend, backend, and daemon addresses: in a browser or on another computer running the tools, localhost refers to that computer itself.
8. Verification and common issues
systemctl --no-pager --full status multica-backend multica-frontend caddy
curl -fsS http://<k3-lan-ip>:3000/health
curl -fsS http://<k3-lan-ip>:3000/readyz
ss -ltnp | grep -E ':3000|:3001|:8080|:5432'
| Symptom | Cause and resolution |
|---|---|
no matching manifest for linux/riscv64 |
The official images have no RISC-V variant; copy artifacts from a build machine with a supported architecture as described in this guide. |
Failed to load SWC binary for linux/riscv64 |
The Next.js build was run on K3; move next build to an amd64/arm64 build machine. |
| Page returns 200, but real-time status does not update | Check that Caddy forwards /ws* and /api/daemon/ws* directly to the backend. |
multica setup reports that the server is unreachable |
Run curl <server-url>/health from the computer running the daemon; do not test only on K3. |
exec format error or native binding error |
The standalone artifacts contain a native addon for another architecture; prepare that dependency for RISC-V or temporarily disable the corresponding feature. |
| Login verification code does not arrive | If email is not configured, check journalctl -u multica-backend -f; for production, configuring Resend or SMTP is recommended. |
Backups should include at least the PostgreSQL database and the attachments directory. When upgrading, first build backend/web artifacts for the same version on a machine with a supported architecture, stop the corresponding systemd services, replace the files, run the migration, and then start the backend and frontend in that order.