mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
feat(docker): one-line installer and release Compose file
Add scripts/install.sh, a one-line installer that checks Docker and Compose v2, installs into ~/opencode-manager (override with OCM_DIR), prompts for an optional OpenCode config import, a repos folder mount and LAN sign-in, then pulls and starts the published image. - Add docker-compose.release.yml, which runs the published image under the Compose project name ocm; a checkout's docker-compose.yml keeps building from source - Generate AUTH_SECRET on first container start and persist it to the data volume when unset, so Compose installs need no .env - Refuse to install over a source checkout or beside an existing install, so volumes and the auth secret are not silently replaced - Test the installer, entrypoint secret handling, and the two Compose files staying in step
This commit is contained in:
1 parent
87636bf1ff
commit
27996ed12d
10 files changed
+734
-31
No files matched your search
@@ -43,6 +43,23 @@ grant_kvm_access() {
|
||||
echo "Granted node access to $dev (group '$group_name', gid $dev_gid)"
|
||||
}
|
||||
|
||||
ensure_auth_secret() {
|
||||
local secret_file="$1"
|
||||
[ -n "${AUTH_SECRET:-}" ] && return 0
|
||||
|
||||
if [ ! -s "$secret_file" ]; then
|
||||
mkdir -p "$(dirname "$secret_file")" || return 1
|
||||
(umask 077 && head -c 32 /dev/urandom | base64 > "$secret_file") || {
|
||||
echo "ERROR: could not write a generated AUTH_SECRET to $secret_file" >&2
|
||||
return 1
|
||||
}
|
||||
echo "Generated AUTH_SECRET and saved it to $secret_file"
|
||||
fi
|
||||
|
||||
AUTH_SECRET="$(cat "$secret_file")" || return 1
|
||||
export AUTH_SECRET
|
||||
}
|
||||
|
||||
OPENCODE_SUPPORTED_FLOOR="${OPENCODE_BUNDLED_VERSION:-}"
|
||||
|
||||
read_opencode_version() {
|
||||
@@ -135,19 +152,7 @@ fi
|
||||
|
||||
echo "Starting OpenCode Manager Backend..."
|
||||
|
||||
if [ -z "$AUTH_SECRET" ]; then
|
||||
echo "AUTH_SECRET is required but not set"
|
||||
echo ""
|
||||
echo "Please set AUTH_SECRET environment variable with a secure random string."
|
||||
echo "Generate one with: openssl rand -base64 32"
|
||||
echo ""
|
||||
echo "Example in docker-compose.yml:"
|
||||
echo " environment:"
|
||||
echo " - AUTH_SECRET=your-secure-random-secret-here"
|
||||
echo ""
|
||||
echo "Example with Docker run:"
|
||||
echo " docker run -e AUTH_SECRET=\$(openssl rand -base64 32) ..."
|
||||
echo ""
|
||||
if ! ensure_auth_secret /app/data/.auth-secret; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user