fix(oglvoice): checksum-verified Go 1.26.10 bootstrap for vServer (#286)
* fix(oglvoice): install checksum-verified Go toolchain for dedicated vServer * docs(oglvoice): allow pinned dependency checksum regeneration on first build
This commit is contained in:
1 parent
08f95e73d4
commit
ccfc644d37
3 files changed
+80
-7
No files matched your search
@@ -41,6 +41,10 @@ jobs:
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y --no-install-recommends pkg-config libopus-dev
|
||||
|
||||
- name: Validate dedicated-host Go bootstrap syntax
|
||||
shell: bash
|
||||
run: bash -n deploy/install-go-toolchain.sh
|
||||
|
||||
- name: Resolve pinned dependencies
|
||||
shell: bash
|
||||
run: go mod tidy
|
||||
|
||||
@@ -30,18 +30,31 @@ For the media bridge, prefer direct host deployment rather than bridged Docker N
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ca-certificates git golang-go pkg-config libopus-dev libopus0 caddy docker.io docker-compose-plugin
|
||||
sudo useradd --system --no-create-home --shell /usr/sbin/nologin oglvoice
|
||||
sudo apt-get install -y ca-certificates curl git pkg-config libopus-dev libopus0 caddy docker.io docker-compose-plugin
|
||||
getent group oglvoice >/dev/null || sudo groupadd --system oglvoice
|
||||
id -u oglvoice >/dev/null 2>&1 || sudo useradd --system --gid oglvoice --no-create-home --shell /usr/sbin/nologin oglvoice
|
||||
sudo install -d -m 0750 -o oglvoice -g oglvoice /opt/oglvoice /etc/oglvoice
|
||||
git clone https://github.com/opengenesislink/opengenesislinkserver.git /opt/oglvoice/source
|
||||
if [ -d /opt/oglvoice/source/.git ]; then
|
||||
git -C /opt/oglvoice/source pull --ff-only origin main
|
||||
else
|
||||
git clone https://github.com/opengenesislink/opengenesislinkserver.git /opt/oglvoice/source
|
||||
fi
|
||||
cd /opt/oglvoice/source/services/oglvoice-media
|
||||
go build -tags nolibopusfile -trimpath -o /tmp/oglvoice-media .
|
||||
sudo bash deploy/install-go-toolchain.sh
|
||||
/opt/oglvoice/toolchains/go1.26.10/bin/go version
|
||||
/opt/oglvoice/toolchains/go1.26.10/bin/go build -tags nolibopusfile -mod=mod -trimpath -o /tmp/oglvoice-media .
|
||||
sudo install -m 0755 -o root -g root /tmp/oglvoice-media /opt/oglvoice/oglvoice-media
|
||||
```
|
||||
|
||||
**Go version:** Debian's `golang-go` may be older than the `go` directive in
|
||||
`services/oglvoice-media/go.mod`. Verify `go version` and install the supported upstream
|
||||
toolchain as required, rather than changing dependency versions arbitrarily.
|
||||
**Go version / v39227 build failure:** `go 1.26.8` in `go.mod` is valid for
|
||||
modern Go and is the module's *minimum* version. Older Debian-packaged `go` binaries
|
||||
can reject patch versions with `invalid go version ... must match format 1.23`.
|
||||
Do **not** downgrade `go.mod` or dependencies. The script installs the official
|
||||
Go **1.26.10** Linux x86-64/ARM64 release to
|
||||
`/opt/oglvoice/toolchains/go1.26.10` and verifies its Go-published SHA-256
|
||||
before extracting it. It does **not** replace `/usr/bin/go` or `/usr/local/go`;
|
||||
the explicit binary path ensures the correct toolchain is used. Unsupported
|
||||
architectures and checksum mismatches abort without changing an existing Go install.
|
||||
|
||||
Copy `deploy/livekit.yaml.example` to `/etc/oglvoice/livekit.yaml`; choose a strong
|
||||
LiveKit API key and random API secret (at least 32 bytes). Put **exactly the same**
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
# Install an isolated, pinned Go toolchain for the OGLVoice media bridge.
|
||||
# Official checksums: https://go.dev/dl/
|
||||
set -euo pipefail
|
||||
|
||||
VERSION=1.26.10
|
||||
INSTALL_ROOT="${OGLVOICE_GO_INSTALL_ROOT:-/opt/oglvoice/toolchains}"
|
||||
TARGET="${INSTALL_ROOT}/go${VERSION}"
|
||||
|
||||
case "$(uname -m)" in
|
||||
x86_64|amd64)
|
||||
GOARCH=amd64
|
||||
SHA256=ccfe7ae822d2c2f41f4fe7c956199967a4dac22d0ee0d2b2bfdb440aab3b20c5
|
||||
;;
|
||||
aarch64|arm64)
|
||||
GOARCH=arm64
|
||||
SHA256=3f4227ce7b206a513e794f1393adb473a07b46e94d18bd15d1c684bbb7319797
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $(uname -m) (expected x86_64 or aarch64)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -e "$TARGET" || -L "$TARGET" ]]; then
|
||||
if [[ -x "$TARGET/bin/go" ]] && "$TARGET/bin/go" version | grep -Fq "go${VERSION} "; then
|
||||
echo "Already installed: $("$TARGET/bin/go" version)"
|
||||
exit 0
|
||||
fi
|
||||
echo "Refusing to overwrite existing $TARGET" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for command in curl sha256sum tar mktemp; do
|
||||
if ! command -v "$command" >/dev/null 2>&1; then
|
||||
echo "Missing prerequisite: $command" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
ARCHIVE="go${VERSION}.linux-${GOARCH}.tar.gz"
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
curl --fail --location --retry 3 --output "$WORK/$ARCHIVE" "https://go.dev/dl/$ARCHIVE"
|
||||
printf '%s %s\n' "$SHA256" "$WORK/$ARCHIVE" | sha256sum --check --status || {
|
||||
echo "Checksum mismatch: $ARCHIVE — refusing to install." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
tar -xzf "$WORK/$ARCHIVE" -C "$WORK"
|
||||
mkdir -p "$INSTALL_ROOT"
|
||||
mv "$WORK/go" "$TARGET"
|
||||
"$TARGET/bin/go" version
|
||||
echo "Use $TARGET/bin/go build -tags nolibopusfile -mod=mod -trimpath -o /tmp/oglvoice-media ."
|
||||
Reference in new issue
Block a user