Skip to main content

Manual Deployment

Suitable for scenarios where Docker is not supported or deep customization is required.

Build Backend

cd server

# Download dependencies (recommended to set GOPROXY for domestic environments)
export GOPROXY=https://goproxy.cn,direct
go mod download

# Compile
go build -o iforge ./cmd/server

# Run
export IFORGE_HOME=/var/lib/iforge
./iforge

Build Frontend

cd web

# Install dependencies
npm install

# Build (leave NEXT_PUBLIC_API_BASE empty for dynamic hostname adaptation)
NEXT_PUBLIC_API_BASE= npm run build

# Start (requires Node.js runtime)
npm start

Systemd Service

Create /etc/systemd/system/iforge-server.service:

[Unit]
Description=iForge Server
After=network.target

[Service]
Type=simple
User=iforge
WorkingDirectory=/opt/iforge
Environment=IFORGE_HOME=/var/lib/iforge
Environment=IFORGE_HTTP_PORT=8081
Environment=IFORGE_SSH_PORT=2022
Environment=IFORGE_CI_ENABLED=true
Environment=IFORGE_CI_ALLOW_SHELL_EXECUTOR=false
ExecStart=/opt/iforge/iforge
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable iforge-server
sudo systemctl start iforge-server
Security Configuration

In production environments, you must keep IFORGE_CI_ALLOW_SHELL_EXECUTOR=false to prevent direct execution of user code on the host.

Nginx Reverse Proxy

server {
listen 80;
server_name iforge.example.com;

# Frontend
location / {
proxy_pass http://127.0.0.1:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

# Backend API
location /api/ {
proxy_pass http://127.0.0.1:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

# Git HTTP
location ~ ^/.+\.git(/.*)?$ {
proxy_pass http://127.0.0.1:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
SSH Protocol

The SSH Git protocol (port 2022) does not go through Nginx; you need to open the port directly or use SSH port forwarding.