Run opencode with a GPU-backed local model on Digital Research Alliance of
Canada (Alliance Canada) Slurm clusters. Ollama serves the model on a compute
node; a script on your laptop opens an encrypted SSH tunnel to it and points
opencode at the endpoint.
- Once per cluster:
laptop/setup.shsyncs the repo to the cluster and builds an Apptainer image (ollama.sif) fromcontainer/ollama.def. - Each session:
laptop/connect.shstarts a persistent tmux session on the login node, which runssrunto grab a GPU node and launchesollama serveinside the container (model stored on$SCRATCH). The laptop then adds adrac-ollamaprovider to opencode and opens a single ssh tunnel to the login node (ssh -N -L $PORT:<node-ip>:$PORT <login>), which forwards to the Ollama port on the compute node over the cluster network — one key+Duo login prompt, then runopencodein a second terminal. The port is chosen at random for each session, so the endpoint moves every time. - When done:
laptop/disconnect.shkills the tunnel;ssh <login> 'cd <remote> && bash cluster/teardown.sh'frees the GPU. For both at once, uselaptop/down.sh.
# Configure once: edit config.sh (LOGIN_NODE, MODEL)
# Every session, in one shot: sync repo + provision + tunnel (one terminal)
./laptop/up.sh
opencode # select the drac-ollama model (second terminal)
# When done:
./laptop/down.sh # kill tunnel + free the GPUThe granular steps are still available: laptop/setup.sh (sync repo, build the
image), laptop/connect.sh (provision + open the tunnel, run in one terminal),
laptop/disconnect.sh (kill just the tunnel), and
ssh <login> 'cd <remote> && bash cluster/teardown.sh' (free just the GPU).
- An Alliance Canada account with an allocation (RAC/RAS) that includes GPU nodes.
ssh,rsync,jqon your laptop.apptaineron the cluster login node (trymodule load apptainerif needed).
See docs/usage.md for details, per-cluster notes, troubleshooting, and the
manual test checklist.