From 7f19db14f5c513559dbe4b69bbe6a4e468838258 Mon Sep 17 00:00:00 2001 From: Thieu Nguyen <79964592+thieung@users.noreply.github.com> Date: Wed, 18 Mar 2026 07:32:53 +0700 Subject: [PATCH] fix(install): bundle migrations in release tarball and install script (#249) The install script only copied the binary, so `goclaw migrate up` and `goclaw onboard` failed when run from the installed location because the migrations directory was missing. - Include migrations/ in the release tarball - Install migrations to /usr/local/share/goclaw/migrations - Guide users to export GOCLAW_MIGRATIONS_DIR before onboard - Align next-steps output with onboard's own instructions --- .github/workflows/release.yaml | 2 +- scripts/install.sh | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 31c47ac3..82b7edee 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -57,7 +57,7 @@ jobs: CGO_ENABLED=0 go build \ -ldflags="-s -w -X github.com/nextlevelbuilder/goclaw/cmd.Version=${VERSION}" \ -o goclaw . - tar -czf "goclaw-${{ needs.release.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" goclaw + tar -czf "goclaw-${{ needs.release.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" goclaw migrations/ - name: Upload to release env: diff --git a/scripts/install.sh b/scripts/install.sh index 58bb2e80..26532def 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -12,6 +12,7 @@ set -euo pipefail REPO="nextlevelbuilder/goclaw" INSTALL_DIR="${GOCLAW_INSTALL_DIR:-/usr/local/bin}" +MIGRATIONS_DIR="/usr/local/share/goclaw/migrations" VERSION="" # ── Parse args ── @@ -64,25 +65,30 @@ tar -xzf "${TMP}/${ASSET}" -C "$TMP" if [ -w "$INSTALL_DIR" ]; then cp "${TMP}/goclaw" "${INSTALL_DIR}/goclaw" chmod +x "${INSTALL_DIR}/goclaw" + mkdir -p "${MIGRATIONS_DIR}" + cp -r "${TMP}/migrations/"* "${MIGRATIONS_DIR}/" else echo "Installing to ${INSTALL_DIR} (requires sudo)..." sudo cp "${TMP}/goclaw" "${INSTALL_DIR}/goclaw" sudo chmod +x "${INSTALL_DIR}/goclaw" + sudo mkdir -p "${MIGRATIONS_DIR}" + sudo cp -r "${TMP}/migrations/"* "${MIGRATIONS_DIR}/" fi echo "" echo "GoClaw ${VERSION} installed to ${INSTALL_DIR}/goclaw" +echo "Migrations installed to ${MIGRATIONS_DIR}" echo "" echo "Next steps:" echo " 1. Set up PostgreSQL (pgvector):" echo " docker run -d --name goclaw-pg -p 5432:5432 -e POSTGRES_PASSWORD=goclaw pgvector/pgvector:pg18" echo "" -echo " 2. Run database migrations:" +echo " 2. Set environment variables:" echo " export GOCLAW_POSTGRES_DSN='postgres://postgres:goclaw@localhost:5432/postgres?sslmode=disable'" -echo " goclaw migrate up" +echo " export GOCLAW_MIGRATIONS_DIR='${MIGRATIONS_DIR}'" echo "" -echo " 3. Start the onboard wizard:" +echo " 3. Start the onboard wizard (runs migrations automatically):" echo " goclaw onboard" echo "" echo " 4. Start the gateway:" -echo " goclaw" +echo " source .env.local && goclaw"