Clarify that the OpenCode CT script already sources build.func so the published one-liner works without hitting argument length issues.
3.1 KiB
Personal Proxmox LXC Scripts
This repo is a small personal version of the community-scripts pattern:
ct/contains host-side Proxmox creation scriptsinstall/contains the in-container install logic
OpenCode LXC
ct/opencode.sh creates a Debian LXC and installs the opencode CLI for a normal user.
It now follows the upstream community-scripts host-side flow more closely, including the standard Default Install, Advanced Install, and User Defaults entry points.
What it does
- picks a Debian 12 template from your configured Proxmox storages
- creates an unprivileged LXC with sensible defaults for a coding box
- installs common CLI tooling (
git,ripgrep,fd,curl,build-essential) - installs OpenCode via the official installer
- creates a writable
/workspacedirectory owned by theopencodeuser - enables a systemd-managed OpenCode web interface on boot
Usage
Run on the Proxmox host as root:
bash ct/opencode.sh
Community-scripts style one-liner:
bash -c "$(curl -fsSL https://forgejo.welvaert.org/caoimhinr/pve_community/raw/branch/main/ct/opencode.sh)"
The previous two-step build.func wrapper is not needed here because ct/opencode.sh already downloads and sources build.func itself.
Example with overrides:
CTID=220 \
HOSTNAME=opencode-dev \
BRIDGE=vmbr1 \
CONTAINER_STORAGE=local-lvm \
TEMPLATE_STORAGE=local \
MEMORY=8192 \
CORES=4 \
DISK_GB=24 \
OPENCODE_USER=dev \
OPENCODE_WEB_PORT=4096 \
bash ct/opencode.sh
One-liner with overrides:
CTID=220 MEMORY=8192 CORES=4 DISK_GB=24 OPENCODE_USER=dev bash -c "$(curl -fsSL https://forgejo.welvaert.org/caoimhinr/pve_community/raw/branch/main/ct/opencode.sh)"
You can also use the upstream-style var_* overrides, for example var_cpu, var_ram, var_disk, var_brg, var_net, var_ctid, and var_hostname.
Common Variables
CTIDdefault120HOSTNAMEdefaultopencodeCORESdefault2MEMORYdefault4096DISK_GBdefault12BRIDGEdefaultvmbr0IP_CONFIGdefaultdhcpTEMPLATE_STORAGEauto-selects first storage withvztmplCONTAINER_STORAGEauto-selects first storage withrootdirOPENCODE_USERdefaultopencodeOPENCODE_VERSIONempty means latest releaseOPENCODE_WEB_HOSTNAMEdefault0.0.0.0OPENCODE_WEB_PORTdefault4096OPENCODE_SERVER_USERNAMEdefaultopencodeOPENCODE_SERVER_PASSWORDoptional basic-auth password for the web UISSH_PUBLIC_KEY_FILEoptional path to a host public key file to inject into the CT
Community-Scripts Behavior
- supports the standard
community-scriptssettings flow on the Proxmox host - supports
default.varsand app-default handling from the sharedbuild.funcbase - still accepts the legacy environment variable names documented above for quick one-shot runs
After Creation
pct enter 120
su - opencode
opencode
The web interface is started automatically at boot and listens on http://<ct-ip>:4096 by default.
Then configure a provider inside OpenCode with /connect, or set your provider credentials manually.