Skip to main content

Configuration

Environment Variables​

Backend (mpi-master / mpi-worker)​

VariableDefaultDescription
NODE_ROLEmasterSet to "master" or "worker" to control startup behavior
ROCKET_ADDRESS0.0.0.0Bind address for the HTTP server
ROCKET_PORT8000HTTP server port
RUST_LOGinfoLog level (trace, debug, info, warn, error)

Frontend Build Arguments​

ArgumentDefaultDescription
VITE_API_BASEhttp://localhost:8000Backend API base URL — baked into the JS bundle at build time
Build-time variable

VITE_API_BASE is baked into the JavaScript bundle during pnpm build. To change the API URL, you must rebuild the frontend image. It cannot be changed at runtime.

MPI Hostfile​

The MPI hostfile (/etc/mpi/hostfile) tells the master which hosts to include in the MPI world:

172.28.1.2 slots=1    # mpi-master
172.28.1.3 slots=1 # mpi-worker

Each slots=N entry controls how many MPI ranks run on that host. With the default hostfile, the world size is 2 (1 master + 1 worker).

Rocket Configuration (Rocket.toml)​

[release]
address = "0.0.0.0"
port = 8000
workers = 4
keep_alive = 5
log_level = "normal"

[release.limits]
file = "500MiB"
forms = "512MiB"

The file and forms limits control the maximum upload size. Default 500MiB handles most graph files. Adjust if you need larger uploads.

Vite Configuration​

Key settings in vite.config.ts:

export default defineConfig({
plugins: [
react(),
wasm(), // vite-plugin-wasm for main bundle
topLevelAwait(), // required for WASM top-level await
],
worker: {
format: 'es', // ES module format required for WASM in workers
plugins: () => [wasm()],
},
server: {
proxy: {
'/api': {
target: process.env.VITE_API_BASE || 'http://localhost:8000',
changeOrigin: true,
},
},
},
});

Docker Network​

The mpi-network bridge uses the 172.28.1.0/24 subnet with static IPs:

ContainerIP
mpi-master172.28.1.2
mpi-worker172.28.1.3

Static IPs are required for MPI — the master must know the worker's address at launch time to build the MPI world.

Deploying with a Different Backend URL​

If deploying the frontend to a CDN or separate host:

docker build ./frontend \
--build-arg VITE_API_BASE=https://api.yourdomain.com \
-t distributed-graph-frontend:latest

Ensure the backend has CORS configured to allow the frontend origin. The backend's CORS handler allows all origins by default via the OPTIONS /* handler.