Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Add governed v6 preview demo targets

rcourtman58ad221d4771
diff --git a/.github/workflows/README.md b/.github/workflows/README.md
index 73f7b91515..153b13144c 100644
--- a/.github/workflows/README.md
+++ b/.github/workflows/README.md
@@ -4,11 +4,21 @@
**File**: `update-demo-server.yml`
-Automatically updates the public demo server when a new stable release is published.
+Automatically updates the governed demo target after a release is published.
+Stable releases update the stable public demo. Prerelease tags update the
+separate v6 preview demo.
### Configuration Required
-Add these secrets to your GitHub repository settings (`Settings` → `Secrets and variables` → `Actions`):
+Create two GitHub Environments:
+
+1. `demo-stable`
+2. `demo-preview-v6`
+
+Each environment must define the same secret names so the workflow can select
+the target by environment instead of hardcoding separate workflows.
+
+Required environment secrets:
1. **DEMO_SERVER_SSH_KEY**
- The private SSH key for accessing the demo server
@@ -21,27 +31,74 @@ Add these secrets to your GitHub repository settings (`Settings` → `Secrets an
3. **DEMO_SERVER_USER**
- The SSH username for the demo server (e.g. `root` or a deploy user with sudo access)
+Required environment variables:
+
+1. **DEMO_LOCAL_BASE_URL**
+ - Local URL used on the target host for version and mock-mode verification
+ - Example stable value: `http://localhost:7655`
+ - Example preview value: `http://localhost:8665`
+
+2. **DEMO_PUBLIC_HEALTH_URL**
+ - Public health endpoint for the selected demo target
+ - Example stable value: `https://demo.pulserelay.pro/api/health`
+ - Example preview value: `https://v6-demo.pulserelay.pro/api/health`
+
+Optional environment variables:
+
+1. **DEMO_SERVICE_NAME**
+ - Stable default: `pulse`
+ - Preview example: `pulse-v6-preview`
+ - When set, the server installer derives the instance-specific install dir,
+ config dir, update helper, and update timer from this service identity.
+
+2. **DEMO_AUTH_USER** / **DEMO_AUTH_PASS**
+ - Demo credentials used for post-update mock verification
+ - Defaults to `demo` / `demo` when omitted
+
### How It Works
1. **Trigger**: Runs automatically when a GitHub release is published
-2. **Filter**: Only runs for stable releases (skips prereleases)
-3. **Update**: SSHs to demo server and runs the install script
-4. **Verify**: Checks that the new version is running and mock mode is active
-5. **Cleanup**: Removes SSH key from runner
+2. **Target selection**: Stable tags deploy to `demo-stable`; prerelease tags deploy to `demo-preview-v6`
+3. **Governance check**: Validates the selected tag is reachable from the governed release branch for that version
+4. **Latest check**: Refuses to update a target unless the published tag is the latest release for that target channel
+5. **Update**: SSHs to the selected demo host and runs the tag-matched root installer from that exact git tag
+6. **Verify**: Checks that the new version is running and mock mode is active
+7. **Cleanup**: Removes SSH key from runner
### Testing
To test without publishing a release:
1. Go to `Actions` tab in GitHub
2. Select `Update Demo Server` workflow
-3. Click `Run workflow` (if manual trigger is enabled)
+3. Provide a tag and choose `stable`, `preview-v6`, or `auto`
### Benefits
-- ✅ Demo server always showcases latest stable release
-- ✅ Validates install script works on real server
-- ✅ Removes manual step from release process
-- ✅ Free to run (public repos get unlimited GitHub Actions minutes)
+- ✅ Stable and preview demos stay on separate governed targets
+- ✅ Prereleases no longer require a stable demo overwrite or a manual skip
+- ✅ Validates the real server installer path on the selected target
+- ✅ Removes release-operator guesswork about which demo should move
+
+### Preview Bootstrap Note
+
+The preview environment must be bootstrapped once on the host before the update
+workflow can keep it current. The supported path is a separate service identity
+such as `pulse-v6-preview` plus a separate public route such as
+`v6-demo.pulserelay.pro`; do not reuse the stable `pulse.service` instance.
+
+## Deploy Demo Server
+
+**File**: `deploy-demo-server.yml`
+
+Manually deploys the current branch build to either the stable or preview demo
+environment without changing the governed release workflow.
+
+- Uses the same `demo-stable` / `demo-preview-v6` environment contract as the
+ release-driven updater
+- Requires `DEMO_PUBLIC_HEALTH_URL`
+- Supports optional `DEMO_SERVICE_NAME`, `DEMO_INSTALL_DIR`, `DEMO_TEST_PORT`,
+ `DEMO_AUTH_USER`, and `DEMO_AUTH_PASS`
+- Assumes the target service and install directory already exist on the host
## Helm CI
diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
index 66f2e19362..71c6054286 100644
--- a/.github/workflows/create-release.yml
+++ b/.github/workflows/create-release.yml
@@ -670,17 +670,18 @@ jobs:
echo "[OK] Docker publish workflow dispatched"
- name: Trigger demo server update
- if: ${{ github.event.inputs.draft_only != 'true' && needs.prepare.outputs.is_prerelease != 'true' }}
+ if: ${{ github.event.inputs.draft_only != 'true' }}
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.WORKFLOW_PAT }}
run: |
- gh workflow run update-demo-server.yml -f tag="${{ needs.prepare.outputs.tag }}"
- echo "[OK] Demo server update dispatched"
-
- - name: Skip demo server update for prerelease
- if: ${{ github.event.inputs.draft_only != 'true' && needs.prepare.outputs.is_prerelease == 'true' }}
- run: echo "Skipping demo server update for prerelease tag ${{ needs.prepare.outputs.tag }}"
+ if [ "${{ needs.prepare.outputs.is_prerelease }}" = "true" ]; then
+ TARGET="preview-v6"
+ else
+ TARGET="stable"
+ fi
+ gh workflow run update-demo-server.yml -f tag="${{ needs.prepare.outputs.tag }}" -f target="${TARGET}"
+ echo "[OK] Demo server update dispatched for ${TARGET}"
- name: Summary
run: |
diff --git a/.github/workflows/deploy-demo-server.yml b/.github/workflows/deploy-demo-server.yml
index b13830b677..e3594e76d9 100644
--- a/.github/workflows/deploy-demo-server.yml
+++ b/.github/workflows/deploy-demo-server.yml
@@ -2,15 +2,74 @@ name: Deploy Demo Server
on:
workflow_dispatch:
+ inputs:
+ target:
+ description: 'Demo target to deploy'
+ required: true
+ default: stable
+ type: choice
+ options:
+ - stable
+ - preview-v6
# schedule:
# - cron: '0 0 * * *' # Nightly at midnight
jobs:
+ resolve:
+ runs-on: ubuntu-latest
+ outputs:
+ target: ${{ steps.target.outputs.target }}
+ environment_name: ${{ steps.target.outputs.environment_name }}
+
+ steps:
+ - name: Resolve demo target environment
+ id: target
+ run: |
+ set -euo pipefail
+ TARGET="${{ inputs.target }}"
+ case "$TARGET" in
+ stable)
+ ENVIRONMENT_NAME="demo-stable"
+ ;;
+ preview-v6)
+ ENVIRONMENT_NAME="demo-preview-v6"
+ ;;
+ *)
+ echo "::error::Unsupported demo target: ${TARGET}"
+ exit 1
+ ;;
+ esac
+
+ echo "target=$TARGET" >> "$GITHUB_OUTPUT"
+ echo "environment_name=$ENVIRONMENT_NAME" >> "$GITHUB_OUTPUT"
+
deploy:
+ needs: resolve
runs-on: ubuntu-latest
+ environment: ${{ needs.resolve.outputs.environment_name }}
+ env:
+ DEMO_SERVICE_NAME: ${{ vars.DEMO_SERVICE_NAME }}
+ DEMO_INSTALL_DIR: ${{ vars.DEMO_INSTALL_DIR }}
+ DEMO_PUBLIC_HEALTH_URL: ${{ vars.DEMO_PUBLIC_HEALTH_URL }}
+ DEMO_TEST_PORT: ${{ vars.DEMO_TEST_PORT }}
+ DEMO_AUTH_USER: ${{ vars.DEMO_AUTH_USER }}
+ DEMO_AUTH_PASS: ${{ vars.DEMO_AUTH_PASS }}
+
steps:
+ - name: Validate demo environment configuration
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
+ DEMO_SERVER_SSH_KEY: ${{ secrets.DEMO_SERVER_SSH_KEY }}
+ run: |
+ set -euo pipefail
+ [ -n "$DEMO_SERVER_HOST" ] || { echo "::error::DEMO_SERVER_HOST is required in the selected demo environment."; exit 1; }
+ [ -n "$DEMO_SERVER_USER" ] || { echo "::error::DEMO_SERVER_USER is required in the selected demo environment."; exit 1; }
+ [ -n "$DEMO_SERVER_SSH_KEY" ] || { echo "::error::DEMO_SERVER_SSH_KEY is required in the selected demo environment."; exit 1; }
+ [ -n "$DEMO_PUBLIC_HEALTH_URL" ] || { echo "::error::DEMO_PUBLIC_HEALTH_URL is required in the selected demo environment."; exit 1; }
+
- uses: actions/checkout@v4
-
+
- name: Set up Go
uses: actions/setup-go@v5
with:
@@ -36,12 +95,11 @@ jobs:
- name: Build frontend
run: |
if [ -d "frontend-modern/dist" ] && [ -f "frontend-modern/dist/index.html" ]; then
- echo "Using cached frontend build";
+ echo "Using cached frontend build"
else
- npm --prefix frontend-modern run build;
+ npm --prefix frontend-modern run build
fi
-
- # Prepare embedding directory
+
rm -rf internal/api/frontend-modern
mkdir -p internal/api/frontend-modern
cp -r frontend-modern/dist internal/api/frontend-modern/
@@ -50,6 +108,7 @@ jobs:
env:
PULSE_LICENSE_PUBLIC_KEY: ${{ secrets.PULSE_LICENSE_PUBLIC_KEY }}
run: |
+ set -euo pipefail
VERSION="v$(cat VERSION | tr -d '\n')"
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
@@ -58,26 +117,54 @@ jobs:
-ldflags="${SERVER_LDFLAGS}" \
-trimpath \
-o pulse ./cmd/pulse/
-
+
- name: Tailscale
uses: tailscale/github-action@v2
with:
authkey: ${{ secrets.TS_AUTHKEY }}
- name: Setup SSH
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_SSH_KEY: ${{ secrets.DEMO_SERVER_SSH_KEY }}
run: |
+ set -euo pipefail
mkdir -p ~/.ssh
chmod 700 ~/.ssh
- echo "${{ secrets.DEMO_SERVER_SSH_KEY }}" > ~/.ssh/id_ed25519
+ echo "$DEMO_SERVER_SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
- ssh-keyscan -H ${{ secrets.DEMO_SERVER_HOST }} >> ~/.ssh/known_hosts
+ ssh-keyscan -H "$DEMO_SERVER_HOST" >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
+ - name: Resolve deploy paths
+ id: config
+ run: |
+ set -euo pipefail
+ SERVICE_NAME="${DEMO_SERVICE_NAME:-pulse}"
+ INSTALL_DIR="${DEMO_INSTALL_DIR:-}"
+ if [ -z "$INSTALL_DIR" ]; then
+ if [ "$SERVICE_NAME" = "pulse" ]; then
+ INSTALL_DIR="/opt/pulse"
+ else
+ INSTALL_DIR="/opt/$SERVICE_NAME"
+ fi
+ fi
+ TEST_PORT="${DEMO_TEST_PORT:-8082}"
+ AUTH_USER="${DEMO_AUTH_USER:-demo}"
+ AUTH_PASS="${DEMO_AUTH_PASS:-demo}"
+
+ echo "service_name=$SERVICE_NAME" >> "$GITHUB_OUTPUT"
+ echo "install_dir=$INSTALL_DIR" >> "$GITHUB_OUTPUT"
+ echo "test_port=$TEST_PORT" >> "$GITHUB_OUTPUT"
+ echo "auth_user=$AUTH_USER" >> "$GITHUB_OUTPUT"
+ echo "auth_pass=$AUTH_PASS" >> "$GITHUB_OUTPUT"
+
- name: Deploy to server
env:
DEPLOY_HOST: ${{ secrets.DEMO_SERVER_HOST }}
DEPLOY_USER: ${{ secrets.DEMO_SERVER_USER }}
run: |
+ set -euo pipefail
SSH_OPTS=(
-i ~/.ssh/id_ed25519
-o IdentitiesOnly=yes
@@ -85,49 +172,51 @@ jobs:
-o UserKnownHostsFile=~/.ssh/known_hosts
)
- # Clean up any stale files from previous runs
+ TARGET_SERVICE="${{ steps.config.outputs.service_name }}"
+ INSTALL_DIR="${{ steps.config.outputs.install_dir }}"
+ TEST_PORT="${{ steps.config.outputs.test_port }}"
+ AUTH_USER="${{ steps.config.outputs.auth_user }}"
+ AUTH_PASS="${{ steps.config.outputs.auth_pass }}"
+
ssh "${SSH_OPTS[@]}" "${DEPLOY_USER}@${DEPLOY_HOST}" "rm -f /tmp/pulse-new; rm -rf /tmp/pulse-demo-test" || true
-
- # Upload new binary
scp "${SSH_OPTS[@]}" pulse "${DEPLOY_USER}@${DEPLOY_HOST}:/tmp/pulse-new"
-
- # Health check: Run on test port 8082 and verify
- # We use a subshell to background the process and then kill it after the check
- ssh "${SSH_OPTS[@]}" "${DEPLOY_USER}@${DEPLOY_HOST}" "
- chmod +x /tmp/pulse-new &&
- PULSE_DATA_DIR=/tmp/pulse-demo-test \
- FRONTEND_PORT=8082 \
- PULSE_MOCK_MODE=true \
- PULSE_AUTH_USER=test \
- PULSE_AUTH_PASS=test \
- nohup /tmp/pulse-new > /tmp/demo-deploy-test.log 2>&1 &
- PID=\$!
- sleep 5
- if curl -f http://127.0.0.1:8082/api/health; then
- echo 'Health check passed!'
- kill \$PID
- rm -rf /tmp/pulse-demo-test
- rm /tmp/demo-deploy-test.log
- else
- echo 'Health check failed! Error log:'
- cat /tmp/demo-deploy-test.log
- kill \$PID
- rm -rf /tmp/pulse-demo-test
- exit 1
- fi
- "
-
- # Swap and restart production service
- ssh "${SSH_OPTS[@]}" "${DEPLOY_USER}@${DEPLOY_HOST}" "
- sudo systemctl stop pulse &&
- sudo mv /tmp/pulse-new /opt/pulse/bin/pulse &&
- sudo systemctl start pulse
- "
-
+
+ ssh "${SSH_OPTS[@]}" "${DEPLOY_USER}@${DEPLOY_HOST}" \
+ "TARGET_SERVICE=$(printf '%q' "$TARGET_SERVICE") INSTALL_DIR=$(printf '%q' "$INSTALL_DIR") TEST_PORT=$(printf '%q' "$TEST_PORT") AUTH_USER=$(printf '%q' "$AUTH_USER") AUTH_PASS=$(printf '%q' "$AUTH_PASS") bash -s" <<'EOF'
+ set -euo pipefail
+ chmod +x /tmp/pulse-new
+ PULSE_DATA_DIR=/tmp/pulse-demo-test \
+ FRONTEND_PORT="$TEST_PORT" \
+ PULSE_MOCK_MODE=true \
+ PULSE_AUTH_USER="$AUTH_USER" \
+ PULSE_AUTH_PASS="$AUTH_PASS" \
+ nohup /tmp/pulse-new > /tmp/demo-deploy-test.log 2>&1 &
+ PID=$!
+ sleep 5
+ if curl -fsS "http://127.0.0.1:${TEST_PORT}/api/health"; then
+ echo 'Health check passed'
+ kill "$PID"
+ rm -rf /tmp/pulse-demo-test
+ rm -f /tmp/demo-deploy-test.log
+ else
+ echo 'Health check failed'
+ cat /tmp/demo-deploy-test.log || true
+ kill "$PID" || true
+ rm -rf /tmp/pulse-demo-test
+ exit 1
+ fi
+
+ sudo test -d "$INSTALL_DIR/bin"
+ sudo systemctl stop "$TARGET_SERVICE"
+ sudo mv /tmp/pulse-new "$INSTALL_DIR/bin/pulse"
+ sudo systemctl start "$TARGET_SERVICE"
+ EOF
+
- name: Verify production
run: |
+ set -euo pipefail
sleep 5
- curl -f https://demo.pulserelay.pro/api/health
+ curl -fsS "$DEMO_PUBLIC_HEALTH_URL"
- name: Cleanup SSH material
if: always()
diff --git a/.github/workflows/update-demo-server.yml b/.github/workflows/update-demo-server.yml
index 0d5e21f12a..9d9e19e671 100644
--- a/.github/workflows/update-demo-server.yml
+++ b/.github/workflows/update-demo-server.yml
@@ -6,26 +6,82 @@ on:
workflow_dispatch:
inputs:
tag:
- description: 'Release tag to deploy (e.g., v4.29.0)'
+ description: 'Release tag to deploy (e.g., v6.0.0-rc.1)'
required: true
type: string
+ target:
+ description: 'Demo target to deploy'
+ required: false
+ default: auto
+ type: choice
+ options:
+ - auto
+ - stable
+ - preview-v6
jobs:
- update-demo:
- # Only run for stable releases (not pre-releases) or manual dispatch
- if: github.event_name == 'workflow_dispatch' || github.event.release.prerelease == false
+ resolve:
runs-on: ubuntu-latest
+ outputs:
+ tag: ${{ steps.target.outputs.tag }}
+ target: ${{ steps.target.outputs.target }}
+ environment_name: ${{ steps.target.outputs.environment_name }}
+ skip: ${{ steps.latest.outputs.skip || 'false' }}
steps:
- - name: Resolve target tag
+ - name: Resolve target tag and demo environment
id: target
run: |
+ set -euo pipefail
+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
+ REQUESTED_TARGET="${{ inputs.target }}"
else
TAG="${{ github.event.release.tag_name }}"
+ REQUESTED_TARGET="auto"
+ fi
+
+ VERSION="${TAG#v}"
+ IS_PRERELEASE=false
+ if [[ "$VERSION" =~ -(rc|alpha|beta)\.[0-9]+$ ]]; then
+ IS_PRERELEASE=true
+ fi
+
+ TARGET="${REQUESTED_TARGET:-auto}"
+ if [ -z "$TARGET" ] || [ "$TARGET" = "auto" ]; then
+ if [ "$IS_PRERELEASE" = "true" ]; then
+ TARGET="preview-v6"
+ else
+ TARGET="stable"
+ fi
fi
+
+ case "$TARGET" in
+ stable)
+ if [ "$IS_PRERELEASE" = "true" ]; then
+ echo "::error::Stable demo target only accepts stable tags. Refusing prerelease tag ${TAG}."
+ exit 1
+ fi
+ ENVIRONMENT_NAME="demo-stable"
+ ;;
+ preview-v6)
+ if [ "$IS_PRERELEASE" != "true" ]; then
+ echo "::error::Preview demo target only accepts prerelease tags. Refusing stable tag ${TAG}."
+ exit 1
+ fi
+ ENVIRONMENT_NAME="demo-preview-v6"
+ ;;
+ *)
+ echo "::error::Unsupported demo target: ${TARGET}"
+ exit 1
+ ;;
+ esac
+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
+ echo "target=$TARGET" >> "$GITHUB_OUTPUT"
+ echo "environment_name=$ENVIRONMENT_NAME" >> "$GITHUB_OUTPUT"
+ echo "Resolved demo deployment: tag=${TAG}, target=${TARGET}, environment=${ENVIRONMENT_NAME}"
- name: Checkout repository
uses: actions/checkout@v4
@@ -33,17 +89,12 @@ jobs:
fetch-depth: 0
fetch-tags: true
- - name: Validate stable release line policy
+ - name: Validate governed release line for selected tag
run: |
set -euo pipefail
TAG="${{ steps.target.outputs.tag }}"
VERSION="${TAG#v}"
- if [[ "$VERSION" =~ -rc\.[0-9]+$ ]] || [[ "$VERSION" =~ -alpha\.[0-9]+$ ]] || [[ "$VERSION" =~ -beta\.[0-9]+$ ]]; then
- echo "::error::Demo server updates only support stable releases. Refusing prerelease tag ${TAG}."
- exit 1
- fi
-
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
git fetch --prune --unshallow origin
fi
@@ -61,40 +112,81 @@ jobs:
exit 1
fi
- echo "[OK] ${TAG} validated for stable demo deployment on ${REQUIRED_BRANCH}"
+ echo "[OK] ${TAG} validated for governed demo deployment on ${REQUIRED_BRANCH}"
- - name: Skip if not latest published release
- id: gate
+ - name: Skip if not latest published release for target
+ id: latest
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ github.token }}
run: |
- TARGET="${{ steps.target.outputs.tag }}"
- LATEST=$(gh api "repos/${{ github.repository }}/releases/latest" --jq '.tag_name')
- echo "Target tag: $TARGET"
- echo "Latest published tag: $LATEST"
- if [ "$TARGET" != "$LATEST" ]; then
+ set -euo pipefail
+ TARGET="${{ steps.target.outputs.target }}"
+ TAG="${{ steps.target.outputs.tag }}"
+
+ if [ "$TARGET" = "stable" ]; then
+ LATEST=$(gh api "repos/${{ github.repository }}/releases/latest" --jq '.tag_name')
+ else
+ LATEST=$(gh api "repos/${{ github.repository }}/releases?per_page=100" --jq '[.[] | select(.draft == false and .prerelease == true)][0].tag_name')
+ fi
+
+ echo "Target tag: $TAG"
+ echo "Latest published tag for $TARGET: $LATEST"
+
+ if [ -z "$LATEST" ] || [ "$LATEST" = "null" ]; then
+ echo "::error::Could not determine the latest published release for demo target $TARGET."
+ exit 1
+ fi
+
+ if [ "$TAG" != "$LATEST" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
- echo "Release is not the latest; skipping demo update."
+ echo "Release is not the latest published tag for ${TARGET}; skipping demo update."
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
+ update-demo:
+ needs: resolve
+ if: needs.resolve.outputs.skip != 'true'
+ runs-on: ubuntu-latest
+ environment: ${{ needs.resolve.outputs.environment_name }}
+ env:
+ DEMO_LOCAL_BASE_URL: ${{ vars.DEMO_LOCAL_BASE_URL }}
+ DEMO_PUBLIC_HEALTH_URL: ${{ vars.DEMO_PUBLIC_HEALTH_URL }}
+ DEMO_SERVICE_NAME: ${{ vars.DEMO_SERVICE_NAME }}
+ DEMO_AUTH_USER: ${{ vars.DEMO_AUTH_USER }}
+ DEMO_AUTH_PASS: ${{ vars.DEMO_AUTH_PASS }}
+
+ steps:
- name: Check release type
- if: steps.gate.outputs.skip != 'true'
run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- echo "Manual deployment triggered for: ${{ inputs.tag }}"
- else
- echo "Release: ${{ github.event.release.tag_name }}"
- echo "Prerelease: ${{ github.event.release.prerelease }}"
- echo "Updating demo server to latest stable release..."
- fi
+ echo "Tag: ${{ needs.resolve.outputs.tag }}"
+ echo "Target: ${{ needs.resolve.outputs.target }}"
+ echo "Environment: ${{ needs.resolve.outputs.environment_name }}"
+
+ - name: Validate demo environment configuration
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
+ DEMO_SERVER_SSH_KEY: ${{ secrets.DEMO_SERVER_SSH_KEY }}
+ run: |
+ set -euo pipefail
+ [ -n "$DEMO_SERVER_HOST" ] || { echo "::error::DEMO_SERVER_HOST is required in the selected demo environment."; exit 1; }
+ [ -n "$DEMO_SERVER_USER" ] || { echo "::error::DEMO_SERVER_USER is required in the selected demo environment."; exit 1; }
+ [ -n "$DEMO_SERVER_SSH_KEY" ] || { echo "::error::DEMO_SERVER_SSH_KEY is required in the selected demo environment."; exit 1; }
+ [ -n "$DEMO_LOCAL_BASE_URL" ] || { echo "::error::DEMO_LOCAL_BASE_URL is required in the selected demo environment."; exit 1; }
+ [ -n "$DEMO_PUBLIC_HEALTH_URL" ] || { echo "::error::DEMO_PUBLIC_HEALTH_URL is required in the selected demo environment."; exit 1; }
+
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ fetch-tags: true
- name: Wait for release assets
- if: steps.gate.outputs.skip != 'true'
run: |
- TAG="${{ steps.target.outputs.tag }}"
+ set -euo pipefail
+ TAG="${{ needs.resolve.outputs.tag }}"
echo "Waiting for release assets to be available..."
MAX_ATTEMPTS=30
@@ -103,7 +195,6 @@ jobs:
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
echo "Checking for assets (attempt $((ATTEMPT + 1))/$MAX_ATTEMPTS)..."
- # Check if checksums.txt and linux-amd64 tarball exist
CHECKSUMS_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" \
"https://github.com/rcourtman/Pulse/releases/download/${TAG}/checksums.txt")
TARBALL_STATUS=$(curl -sL -o /dev/null -w "%{http_code}" \
@@ -112,7 +203,7 @@ jobs:
echo "checksums.txt: $CHECKSUMS_STATUS, tarball: $TARBALL_STATUS"
if [ "$CHECKSUMS_STATUS" = "200" ] && [ "$TARBALL_STATUS" = "200" ]; then
- echo "✅ Release assets are available!"
+ echo "Release assets are available."
exit 0
fi
@@ -123,75 +214,129 @@ jobs:
fi
done
- echo "❌ Timeout waiting for release assets"
+ echo "::error::Timeout waiting for release assets"
exit 1
+ - name: Materialize tagged installer
+ run: |
+ set -euo pipefail
+ TAG="${{ needs.resolve.outputs.tag }}"
+ git show "refs/tags/${TAG}:install.sh" > /tmp/pulse-install.sh
+ chmod +x /tmp/pulse-install.sh
+
- name: Setup SSH
- if: steps.gate.outputs.skip != 'true'
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_SSH_KEY: ${{ secrets.DEMO_SERVER_SSH_KEY }}
run: |
+ set -euo pipefail
mkdir -p ~/.ssh
- echo "${{ secrets.DEMO_SERVER_SSH_KEY }}" > ~/.ssh/id_ed25519
+ chmod 700 ~/.ssh
+ echo "$DEMO_SERVER_SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
- ssh-keyscan -H ${{ secrets.DEMO_SERVER_HOST }} >> ~/.ssh/known_hosts
+ ssh-keyscan -H "$DEMO_SERVER_HOST" >> ~/.ssh/known_hosts
+ chmod 600 ~/.ssh/known_hosts
- name: Check current demo version
- if: steps.gate.outputs.skip != 'true'
id: current
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
run: |
- TARGET="${{ steps.target.outputs.tag }}"
+ set -euo pipefail
+ TARGET="${{ needs.resolve.outputs.tag }}"
TARGET_STRIPPED="${TARGET#v}"
- CURRENT=$(ssh -i ~/.ssh/id_ed25519 ${{ secrets.DEMO_SERVER_USER }}@${{ secrets.DEMO_SERVER_HOST }} \
- "curl -s http://localhost:7655/api/version | jq -r .version")
+ CURRENT=$(ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "curl -fsS ${DEMO_LOCAL_BASE_URL}/api/version | jq -r .version")
echo "Current demo version: ${CURRENT}"
if [ "$CURRENT" = "$TARGET" ] || [ "$CURRENT" = "$TARGET_STRIPPED" ] || [ "v${CURRENT}" = "$TARGET" ]; then
echo "skip_current=true" >> "$GITHUB_OUTPUT"
- echo "Demo server already on target version; skipping update."
+ echo "Demo target already on the requested version; skipping update."
else
echo "skip_current=false" >> "$GITHUB_OUTPUT"
fi
+ - name: Upload tagged installer
+ if: steps.current.outputs.skip_current != 'true'
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
+ run: |
+ set -euo pipefail
+ scp -i ~/.ssh/id_ed25519 /tmp/pulse-install.sh "$DEMO_SERVER_USER@$DEMO_SERVER_HOST:/tmp/pulse-install.sh"
+
- name: Update demo server
- if: steps.gate.outputs.skip != 'true' && steps.current.outputs.skip_current != 'true'
+ if: steps.current.outputs.skip_current != 'true'
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
run: |
- TAG="${{ steps.target.outputs.tag }}"
- # Use set -o pipefail to ensure curl errors aren't masked by bash
- ssh -i ~/.ssh/id_ed25519 ${{ secrets.DEMO_SERVER_USER }}@${{ secrets.DEMO_SERVER_HOST }} \
- "set -o pipefail && curl -fsSL https://raw.githubusercontent.com/rcourtman/Pulse/main/install.sh | sudo bash -s -- --version $TAG"
+ set -euo pipefail
+ TAG="${{ needs.resolve.outputs.tag }}"
+ SERVICE_NAME="${DEMO_SERVICE_NAME:-}"
+ REMOTE_SCRIPT=$(cat <<'EOF'
+ set -euo pipefail
+ TAG="$1"
+ SERVICE_NAME="$2"
+ INSTALLER_ENV=()
+ if [ -n "$SERVICE_NAME" ]; then
+ INSTALLER_ENV+=("PULSE_SERVICE_NAME=$SERVICE_NAME")
+ fi
+ sudo env "${INSTALLER_ENV[@]}" bash /tmp/pulse-install.sh --version "$TAG"
+ rm -f /tmp/pulse-install.sh
+ EOF
+ )
+ ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" "bash -s -- $(printf '%q ' "$TAG" "$SERVICE_NAME")" <<<"$REMOTE_SCRIPT"
- name: Verify update
- if: steps.gate.outputs.skip != 'true' && steps.current.outputs.skip_current != 'true'
+ if: steps.current.outputs.skip_current != 'true'
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
run: |
- # Wait a moment for service to restart
+ set -euo pipefail
sleep 5
- # Check version endpoint
- VERSION=$(ssh -i ~/.ssh/id_ed25519 ${{ secrets.DEMO_SERVER_USER }}@${{ secrets.DEMO_SERVER_HOST }} \
- "curl -s http://localhost:7655/api/version | jq -r .version")
+ VERSION=$(ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "curl -fsS ${DEMO_LOCAL_BASE_URL}/api/version | jq -r .version")
echo "Demo server is now running version: $VERSION"
- # Verify version matches target
- TAG="${{ steps.target.outputs.tag }}"
+ TAG="${{ needs.resolve.outputs.tag }}"
TAG_STRIPPED="${TAG#v}"
if [ "$VERSION" != "$TAG" ] && [ "$VERSION" != "$TAG_STRIPPED" ]; then
echo "::error::Version mismatch! Expected $TAG but got $VERSION"
exit 1
fi
- # Verify mock mode is active by authenticating and checking node count
- # Uses $HOME for cookie file since /tmp may not be writable by all users
- NODES=$(ssh -i ~/.ssh/id_ed25519 ${{ secrets.DEMO_SERVER_USER }}@${{ secrets.DEMO_SERVER_HOST }} \
- 'curl -s -c $HOME/.demo-cookies.txt http://localhost:7655/api/login -X POST -H "Content-Type: application/json" -d "{\"username\":\"demo\",\"password\":\"demo\"}" > /dev/null && curl -s -b $HOME/.demo-cookies.txt http://localhost:7655/api/state | jq -r ".nodes | length" && rm -f $HOME/.demo-cookies.txt')
+ AUTH_USER="${DEMO_AUTH_USER:-demo}"
+ AUTH_PASS="${DEMO_AUTH_PASS:-demo}"
+ NODES=$(ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ 'AUTH_USER='"$(printf '%q' "$AUTH_USER")"' AUTH_PASS='"$(printf '%q' "$AUTH_PASS")"' DEMO_LOCAL_BASE_URL='"$(printf '%q' "$DEMO_LOCAL_BASE_URL")"' bash -s' <<'EOF'
+ set -euo pipefail
+ COOKIE_FILE="$HOME/.demo-cookies.txt"
+ curl -fsS -c "$COOKIE_FILE" "${DEMO_LOCAL_BASE_URL}/api/login" -X POST \
+ -H "Content-Type: application/json" \
+ -d "{\"username\":\"${AUTH_USER}\",\"password\":\"${AUTH_PASS}\"}" > /dev/null
+ curl -fsS -b "$COOKIE_FILE" "${DEMO_LOCAL_BASE_URL}/api/state" | jq -r '.nodes | length'
+ rm -f "$COOKIE_FILE"
+ EOF
+ )
echo "Mock nodes detected: $NODES"
if [ "$NODES" -ge 1 ]; then
- echo "✅ Demo server successfully updated and verified!"
+ echo "Demo server successfully updated and verified."
else
- echo "⚠️ Demo server updated but mock mode may not be active"
+ echo "::error::Demo server updated but mock mode may not be active"
exit 1
fi
- - name: Cleanup SSH key
- if: always() && steps.gate.outputs.skip != 'true'
- run: rm -f ~/.ssh/id_ed25519
+ - name: Verify public health
+ run: |
+ set -euo pipefail
+ curl -fsS "$DEMO_PUBLIC_HEALTH_URL"
+
+ - name: Cleanup SSH material
+ if: always()
+ run: rm -f ~/.ssh/id_ed25519 ~/.ssh/known_hosts /tmp/pulse-install.sh
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 8a19366f2b..099b19621b 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -167,6 +167,12 @@ the manual `trigger-release*.sh` entrypoints must all derive their governed
release line from control-plane metadata before they touch public artifacts or
deployment targets, rather than treating tag names or workflow triggers as
enough proof on their own.
+That same governed demo-deployment boundary now owns target separation between
+the public stable demo and the opt-in v6 preview demo. `.github/workflows/create-release.yml`,
+`.github/workflows/update-demo-server.yml`, and `.github/workflows/deploy-demo-server.yml`
+must route stable tags to the stable demo environment and prerelease tags to a
+separate preview environment instead of skipping prerelease demo updates or
+reusing the stable runtime in place.
Those same governed release workflows also own the operator-facing wording for
that promotion metadata. Human-visible workflow inputs, summaries, and error
messages must describe the path as a prerelease or preview flow rather than
@@ -249,6 +255,12 @@ release artifacts. `scripts/install.sh`, `scripts/install.ps1`,
`scripts/install-container-agent.sh`, and `scripts/pulse-auto-update.sh`
define supported deployment entry points and update behavior, even when the
shell and Windows installers also sit on the shared agent-lifecycle boundary.
+That same installer boundary now owns instance identity for side-by-side server
+installs too: the root `install.sh`, generated update helper, and
+`scripts/pulse-auto-update.sh` must preserve an explicitly selected service
+identity across install, update, reset, uninstall, and timer/service wiring so
+stable and preview Pulse runtimes can coexist on one host without drifting back
+onto the default `pulse.service` paths.
The local dev-runtime launcher and dependency manifest floor now sit on that
same installability boundary.
`scripts/hot-dev.sh` and `scripts/hot-dev-bg.sh` are the canonical owned entry
diff --git a/docs/releases/V6_PRERELEASE_RUNBOOK.md b/docs/releases/V6_PRERELEASE_RUNBOOK.md
index 2ece31c606..aa02b6ddec 100644
--- a/docs/releases/V6_PRERELEASE_RUNBOOK.md
+++ b/docs/releases/V6_PRERELEASE_RUNBOOK.md
@@ -32,8 +32,10 @@ Release workflows now enforce branch/tag lineage rules:
- Validate the release tag commit is reachable from the governed branch for
that version instead of assuming `main`.
- `update-demo-server.yml`
- - Accepts stable tags only.
- - Stable tag must be reachable from the governed stable branch.
+ - Routes stable tags to the stable demo environment and prerelease tags to
+ the separate v6 preview demo environment.
+ - The selected tag must still be reachable from the governed branch for that
+ version.
This prevents accidental cross-line releases from non-governed branches even if
the stable branch changes later.
@@ -96,7 +98,10 @@ git push origin pulse/v6-release
- Re-run `Pulse Release Pipeline` on `pulse/v6-release`
- Same `version` and notes
- `draft_only`: `false`
- - Demo server update is skipped automatically for prereleases.
+ - The release workflow dispatches `update-demo-server.yml` against the
+ `preview-v6` demo target automatically.
+ - Keep the public stable demo on v5/stable; prereleases must land only on
+ the separate preview demo runtime.
6. Canary rollout:
- Upgrade a small user subset first.
diff --git a/install.sh b/install.sh
index ac967569f0..924e73c4f9 100755
--- a/install.sh
+++ b/install.sh
@@ -12,10 +12,78 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
+# Configuration helpers
+default_install_dir_for_service() {
+ local service_name="${1:-pulse}"
+ if [[ "$service_name" == "pulse" ]]; then
+ printf '/opt/pulse\n'
+ else
+ printf '/opt/%s\n' "$service_name"
+ fi
+}
+
+default_config_dir_for_service() {
+ local service_name="${1:-pulse}"
+ if [[ "$service_name" == "pulse" ]]; then
+ printf '/etc/pulse\n'
+ else
+ printf '/etc/%s\n' "$service_name"
+ fi
+}
+
+default_binary_link_path_for_service() {
+ local service_name="${1:-pulse}"
+ if [[ "$service_name" == "pulse" ]]; then
+ printf '/usr/local/bin/pulse\n'
+ else
+ printf '/usr/local/bin/%s\n' "$service_name"
+ fi
+}
+
+default_update_helper_path_for_service() {
+ local service_name="${1:-pulse}"
+ if [[ "$service_name" == "pulse" ]]; then
+ printf '/bin/update\n'
+ else
+ printf '/usr/local/bin/update-%s\n' "$service_name"
+ fi
+}
+
+default_auto_update_dest_for_service() {
+ local service_name="${1:-pulse}"
+ if [[ "$service_name" == "pulse" ]]; then
+ printf '/usr/local/bin/pulse-auto-update.sh\n'
+ else
+ printf '/usr/local/bin/%s-auto-update.sh\n' "$service_name"
+ fi
+}
+
+default_update_service_path_for_service() {
+ local service_name="${1:-pulse}"
+ printf '/etc/systemd/system/%s-update.service\n' "$service_name"
+}
+
+default_update_timer_path_for_service() {
+ local service_name="${1:-pulse}"
+ printf '/etc/systemd/system/%s-update.timer\n' "$service_name"
+}
+
# Configuration
-INSTALL_DIR="/opt/pulse"
-CONFIG_DIR="/etc/pulse" # All config and data goes here for manual installs
-SERVICE_NAME="pulse"
+DEFAULT_SERVICE_NAME="pulse"
+SERVICE_NAME_EXPLICIT="false"
+if [[ -n "${PULSE_SERVICE_NAME:-}" ]]; then
+ SERVICE_NAME_EXPLICIT="true"
+fi
+SERVICE_NAME="${PULSE_SERVICE_NAME:-$DEFAULT_SERVICE_NAME}"
+INSTALL_DIR="${PULSE_INSTALL_DIR:-$(default_install_dir_for_service "$SERVICE_NAME")}"
+CONFIG_DIR="${PULSE_CONFIG_DIR:-$(default_config_dir_for_service "$SERVICE_NAME")}" # All config and data goes here for manual installs
+BINARY_LINK_PATH="${PULSE_BINARY_LINK_PATH:-$(default_binary_link_path_for_service "$SERVICE_NAME")}"
+UPDATE_HELPER_PATH="${PULSE_UPDATE_HELPER_PATH:-$(default_update_helper_path_for_service "$SERVICE_NAME")}"
+AUTO_UPDATE_DEST="${PULSE_AUTO_UPDATE_DEST:-$(default_auto_update_dest_for_service "$SERVICE_NAME")}"
+UPDATE_SERVICE_PATH="${PULSE_UPDATE_SERVICE_PATH:-$(default_update_service_path_for_service "$SERVICE_NAME")}"
+UPDATE_TIMER_PATH="${PULSE_UPDATE_TIMER_PATH:-$(default_update_timer_path_for_service "$SERVICE_NAME")}"
+UPDATE_SERVICE_UNIT="$(basename "$UPDATE_SERVICE_PATH")"
+UPDATE_TIMER_UNIT="$(basename "$UPDATE_TIMER_PATH")"
GITHUB_REPO="rcourtman/Pulse"
DOCKER_IMAGE_REPO="${DOCKER_IMAGE_REPO:-rcourtman/pulse}"
BUILD_FROM_SOURCE=false
@@ -286,8 +354,13 @@ safe_systemctl() {
# Detect existing service name (pulse or pulse-backend)
detect_service_name() {
+ if [[ "$SERVICE_NAME_EXPLICIT" == "true" ]]; then
+ echo "$SERVICE_NAME"
+ return
+ fi
+
if ! command -v systemctl >/dev/null 2>&1; then
- echo "pulse"
+ echo "$DEFAULT_SERVICE_NAME"
return
fi
@@ -300,6 +373,22 @@ detect_service_name() {
fi
}
+update_timer_exists() {
+ command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files --no-legend 2>/dev/null | grep -q "^${UPDATE_TIMER_UNIT}$"
+}
+
+update_timer_enabled() {
+ command -v systemctl >/dev/null 2>&1 && systemctl is-enabled --quiet "$UPDATE_TIMER_UNIT" 2>/dev/null
+}
+
+current_frontend_port() {
+ local port="${FRONTEND_PORT:-7655}"
+ if [[ -z "${FRONTEND_PORT:-}" ]] && [[ -f "/etc/systemd/system/$SERVICE_NAME.service" ]]; then
+ port=$(grep -oP 'FRONTEND_PORT=\K\d+' "/etc/systemd/system/$SERVICE_NAME.service" 2>/dev/null || echo "7655")
+ fi
+ printf '%s\n' "${port:-7655}"
+}
+
# Functions
print_header() {
echo -e "${BLUE}=================================================${NC}"
@@ -475,14 +564,14 @@ restore_selinux_contexts() {
if command -v restorecon >/dev/null 2>&1; then
print_info "Restoring SELinux contexts for installed binaries..."
restorecon -Rv "$INSTALL_DIR/bin/" >/dev/null 2>&1 || true
- restorecon -v /usr/local/bin/pulse* >/dev/null 2>&1 || true
+ restorecon -v "$BINARY_LINK_PATH" >/dev/null 2>&1 || true
print_success "SELinux contexts restored"
else
# Fallback to chcon if restorecon isn't available
if command -v chcon >/dev/null 2>&1; then
print_info "Setting SELinux contexts for installed binaries..."
find "$INSTALL_DIR/bin/" -type f -executable -exec chcon -t bin_t {} \; 2>/dev/null || true
- find /usr/local/bin/ -name 'pulse*' -exec chcon -h -t bin_t {} \; 2>/dev/null || true
+ chcon -h -t bin_t "$BINARY_LINK_PATH" 2>/dev/null || true
fi
fi
}
@@ -1695,11 +1784,11 @@ create_lxc_container() {
fi
echo
echo " First-time setup:"
- echo " pct exec $CTID -- cat /etc/pulse/.bootstrap_token # Get bootstrap token"
+ echo " pct exec $CTID -- cat $CONFIG_DIR/.bootstrap_token # Get bootstrap token"
echo
echo " Common commands:"
echo " pct enter $CTID # Enter container"
- echo " pct exec $CTID -- update # Update Pulse"
+ echo " pct exec $CTID -- $(basename "$UPDATE_HELPER_PATH") # Update Pulse"
echo
CONTAINER_CREATED_FOR_CLEANUP=false
@@ -2159,8 +2248,10 @@ check_existing_installation() {
# Detect actual service name if systemd is available
if command -v systemctl >/dev/null 2>&1; then
- detected_service=$(detect_service_name)
- SERVICE_NAME="$detected_service"
+ if [[ "$SERVICE_NAME_EXPLICIT" != "true" ]]; then
+ detected_service=$(detect_service_name)
+ SERVICE_NAME="$detected_service"
+ fi
service_available=true
fi
@@ -2591,9 +2682,10 @@ install_pulse_archive() {
chown -R pulse:pulse "$INSTALL_DIR"
rm -f "$INSTALL_DIR/bin/pulse.old"
- ln -sf "$INSTALL_DIR/bin/pulse" /usr/local/bin/pulse
+ mkdir -p "$(dirname "$BINARY_LINK_PATH")"
+ ln -sf "$INSTALL_DIR/bin/pulse" "$BINARY_LINK_PATH"
print_success "Pulse binary installed to $INSTALL_DIR/bin/pulse"
- print_success "Symlink created at /usr/local/bin/pulse"
+ print_success "Symlink created at $BINARY_LINK_PATH"
if [[ -f "$temp_extract/VERSION" ]]; then
cp "$temp_extract/VERSION" "$INSTALL_DIR/VERSION"
@@ -3066,7 +3158,8 @@ build_from_source() {
fi
done
- ln -sf "$INSTALL_DIR/bin/pulse" /usr/local/bin/pulse
+ mkdir -p "$(dirname "$BINARY_LINK_PATH")"
+ ln -sf "$INSTALL_DIR/bin/pulse" "$BINARY_LINK_PATH"
echo "$branch-$(git rev-parse --short HEAD)" > "$INSTALL_DIR/VERSION"
echo "$branch" > "$BUILD_FROM_SOURCE_MARKER"
@@ -3141,7 +3234,14 @@ EOF
setup_update_command() {
# Create update command at /bin/update for ProxmoxVE LXC detection
# This allows the backend to detect ProxmoxVE installations
- local update_helper_path="${PULSE_UPDATE_HELPER_PATH:-/bin/update}"
+ local service_name="${SERVICE_NAME:-${PULSE_SERVICE_NAME:-pulse}}"
+ local install_dir="${INSTALL_DIR:-${PULSE_INSTALL_DIR:-/opt/pulse}}"
+ local config_dir="${CONFIG_DIR:-${PULSE_CONFIG_DIR:-/etc/pulse}}"
+ local binary_link_path="${BINARY_LINK_PATH:-${PULSE_BINARY_LINK_PATH:-/usr/local/bin/pulse}}"
+ local update_helper_path="${UPDATE_HELPER_PATH:-${PULSE_UPDATE_HELPER_PATH:-/bin/update}}"
+ local auto_update_dest="${AUTO_UPDATE_DEST:-${PULSE_AUTO_UPDATE_DEST:-/usr/local/bin/pulse-auto-update.sh}}"
+ local update_service_path="${UPDATE_SERVICE_PATH:-${PULSE_UPDATE_SERVICE_PATH:-/etc/systemd/system/${service_name}-update.service}}"
+ local update_timer_path="${UPDATE_TIMER_PATH:-${PULSE_UPDATE_TIMER_PATH:-/etc/systemd/system/${service_name}-update.timer}}"
local profile_path="${PULSE_PROFILE_PATH:-/etc/profile}"
local bashrc_path="${PULSE_BASHRC_PATH:-/etc/bash.bashrc}"
cat > "$update_helper_path" <<EOF
@@ -3151,12 +3251,30 @@ setup_update_command() {
set -euo pipefail
-INSTALL_ROOT="/opt/pulse"
+INSTALL_ROOT=$(printf '%q' "$install_dir")
MARKER_FILE="\${INSTALL_ROOT}/BUILD_FROM_SOURCE"
-CONFIG_DIR="/etc/pulse"
+CONFIG_DIR=$(printf '%q' "$config_dir")
INSTALLER_URL="https://github.com/${GITHUB_REPO}/releases/latest/download/install.sh"
+PULSE_SERVICE_NAME=$(printf '%q' "$service_name")
+PULSE_INSTALL_DIR=$(printf '%q' "$install_dir")
+PULSE_CONFIG_DIR=$(printf '%q' "$config_dir")
+PULSE_BINARY_LINK_PATH=$(printf '%q' "$binary_link_path")
+PULSE_UPDATE_HELPER_PATH=$(printf '%q' "$update_helper_path")
+PULSE_AUTO_UPDATE_DEST=$(printf '%q' "$auto_update_dest")
+PULSE_UPDATE_SERVICE_PATH=$(printf '%q' "$update_service_path")
+PULSE_UPDATE_TIMER_PATH=$(printf '%q' "$update_timer_path")
extra_args=()
+installer_env=(
+ "PULSE_SERVICE_NAME=\$PULSE_SERVICE_NAME"
+ "PULSE_INSTALL_DIR=\$PULSE_INSTALL_DIR"
+ "PULSE_CONFIG_DIR=\$PULSE_CONFIG_DIR"
+ "PULSE_BINARY_LINK_PATH=\$PULSE_BINARY_LINK_PATH"
+ "PULSE_UPDATE_HELPER_PATH=\$PULSE_UPDATE_HELPER_PATH"
+ "PULSE_AUTO_UPDATE_DEST=\$PULSE_AUTO_UPDATE_DEST"
+ "PULSE_UPDATE_SERVICE_PATH=\$PULSE_UPDATE_SERVICE_PATH"
+ "PULSE_UPDATE_TIMER_PATH=\$PULSE_UPDATE_TIMER_PATH"
+)
if [[ -f "\$MARKER_FILE" ]]; then
branch=\$(tr -d '\r\n' <"\$MARKER_FILE" 2>/dev/null || true)
if [[ -n "\$branch" ]]; then
@@ -3171,9 +3289,9 @@ fi
echo "Updating Pulse..."
if [[ \${#extra_args[@]} -gt 0 ]]; then
- curl -fsSL "\$INSTALLER_URL" | bash -s -- "\${extra_args[@]}"
+ curl -fsSL "\$INSTALLER_URL" | env "\${installer_env[@]}" bash -s -- "\${extra_args[@]}"
else
- curl -fsSL "\$INSTALLER_URL" | bash
+ curl -fsSL "\$INSTALLER_URL" | env "\${installer_env[@]}" bash
fi
echo ""
@@ -3199,7 +3317,7 @@ download_auto_update_script() {
local url="${asset_base_url}/pulse-auto-update.sh"
local checksums_url="${asset_base_url}/checksums.txt"
local legacy_checksum_url="${url}.sha256"
- local dest="${PULSE_AUTO_UPDATE_DEST:-/usr/local/bin/pulse-auto-update.sh}"
+ local dest="${AUTO_UPDATE_DEST:-${PULSE_AUTO_UPDATE_DEST:-/usr/local/bin/pulse-auto-update.sh}}"
local attempts=0
local max_attempts=3
local connect_timeout=15
@@ -3287,7 +3405,7 @@ download_auto_update_script() {
}
configure_auto_update_script_repo() {
- local dest="${1:-${PULSE_AUTO_UPDATE_DEST:-/usr/local/bin/pulse-auto-update.sh}}"
+ local dest="${1:-${AUTO_UPDATE_DEST:-${PULSE_AUTO_UPDATE_DEST:-/usr/local/bin/pulse-auto-update.sh}}}"
if [[ ! -f "$dest" ]]; then
return 1
fi
@@ -3330,13 +3448,18 @@ setup_auto_updates() {
print_info "Setting up automatic updates..."
local desired_channel
desired_channel=$(selected_update_channel)
- local auto_update_dest="${PULSE_AUTO_UPDATE_DEST:-/usr/local/bin/pulse-auto-update.sh}"
- local update_service_path="${PULSE_UPDATE_SERVICE_PATH:-/etc/systemd/system/pulse-update.service}"
- local update_timer_path="${PULSE_UPDATE_TIMER_PATH:-/etc/systemd/system/pulse-update.timer}"
+ local service_name="${SERVICE_NAME:-${PULSE_SERVICE_NAME:-pulse}}"
+ local install_dir="${INSTALL_DIR:-${PULSE_INSTALL_DIR:-/opt/pulse}}"
+ local config_dir="${CONFIG_DIR:-${PULSE_CONFIG_DIR:-/etc/pulse}}"
+ local auto_update_dest="${AUTO_UPDATE_DEST:-${PULSE_AUTO_UPDATE_DEST:-/usr/local/bin/pulse-auto-update.sh}}"
+ local update_service_path="${UPDATE_SERVICE_PATH:-${PULSE_UPDATE_SERVICE_PATH:-/etc/systemd/system/${service_name}-update.service}}"
+ local update_timer_path="${UPDATE_TIMER_PATH:-${PULSE_UPDATE_TIMER_PATH:-/etc/systemd/system/${service_name}-update.timer}}"
+ local update_timer_unit
+ update_timer_unit="$(basename "$update_timer_path")"
# Copy auto-update script if it exists in the release
- if [[ -f "$INSTALL_DIR/scripts/pulse-auto-update.sh" ]]; then
- cp "$INSTALL_DIR/scripts/pulse-auto-update.sh" "$auto_update_dest"
+ if [[ -f "$install_dir/scripts/pulse-auto-update.sh" ]]; then
+ cp "$install_dir/scripts/pulse-auto-update.sh" "$auto_update_dest"
chmod +x "$auto_update_dest"
else
print_info "Downloading auto-update script..."
@@ -3369,17 +3492,21 @@ Type=oneshot
User=root
Group=root
# Skip auto-update run unless a supported Pulse service is active
-ExecCondition=/bin/sh -c 'systemctl is-active --quiet pulse || systemctl is-active --quiet pulse-backend'
+ExecCondition=/bin/sh -c 'systemctl is-active --quiet "$${PULSE_SERVICE_NAME}"'
ExecStart=${auto_update_dest}
Restart=no
TimeoutStartSec=600
StandardOutput=journal
StandardError=journal
-SyslogIdentifier=pulse-update
+SyslogIdentifier=${service_name}-update
+Environment="PULSE_SERVICE_NAME=$service_name"
+Environment="PULSE_INSTALL_DIR=$install_dir"
+Environment="PULSE_CONFIG_DIR=$config_dir"
+Environment="PULSE_UPDATE_TIMER_UNIT=$update_timer_unit"
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=strict
-ReadWritePaths=/opt/pulse /etc/pulse /tmp
+ReadWritePaths=$install_dir $config_dir /tmp
PrivateNetwork=no
Nice=10
@@ -3409,39 +3536,39 @@ EOF
safe_systemctl daemon-reload
# Enable timer but don't start it yet
- safe_systemctl enable pulse-update.timer || true
+ safe_systemctl enable "$update_timer_unit" || true
# Update system.json to enable auto-updates
- if [[ -f "$CONFIG_DIR/system.json" ]]; then
+ if [[ -f "$config_dir/system.json" ]]; then
# Update existing file
local temp_file="/tmp/system_$$.json"
if command -v jq &> /dev/null; then
- jq --arg channel "$desired_channel" '.autoUpdateEnabled = true | .updateChannel = $channel' "$CONFIG_DIR/system.json" > "$temp_file" && mv "$temp_file" "$CONFIG_DIR/system.json"
+ jq --arg channel "$desired_channel" '.autoUpdateEnabled = true | .updateChannel = $channel' "$config_dir/system.json" > "$temp_file" && mv "$temp_file" "$config_dir/system.json"
else
# Fallback to sed if jq not available
# First check if autoUpdateEnabled already exists in the file
- if grep -q '"autoUpdateEnabled"' "$CONFIG_DIR/system.json"; then
+ if grep -q '"autoUpdateEnabled"' "$config_dir/system.json"; then
# Field exists, update its value
- sed -i 's/"autoUpdateEnabled":[^,}]*/"autoUpdateEnabled":true/' "$CONFIG_DIR/system.json"
+ sed -i 's/"autoUpdateEnabled":[^,}]*/"autoUpdateEnabled":true/' "$config_dir/system.json"
else
# Field doesn't exist, add it after the opening brace
- sed -i 's/^{/{\"autoUpdateEnabled\":true,/' "$CONFIG_DIR/system.json"
+ sed -i 's/^{/{\"autoUpdateEnabled\":true,/' "$config_dir/system.json"
fi
- if grep -q '"updateChannel"' "$CONFIG_DIR/system.json"; then
- sed -i "s/\"updateChannel\":[^,}]*/\"updateChannel\":\"$desired_channel\"/" "$CONFIG_DIR/system.json"
+ if grep -q '"updateChannel"' "$config_dir/system.json"; then
+ sed -i "s/\"updateChannel\":[^,}]*/\"updateChannel\":\"$desired_channel\"/" "$config_dir/system.json"
else
- sed -i "s/^{/{\"updateChannel\":\"$desired_channel\",/" "$CONFIG_DIR/system.json"
+ sed -i "s/^{/{\"updateChannel\":\"$desired_channel\",/" "$config_dir/system.json"
fi
fi
else
# Create new file with auto-updates enabled
- printf '{"autoUpdateEnabled":true,"updateChannel":"%s","pollingInterval":5}\n' "$desired_channel" > "$CONFIG_DIR/system.json"
+ printf '{"autoUpdateEnabled":true,"updateChannel":"%s","pollingInterval":5}\n' "$desired_channel" > "$config_dir/system.json"
fi
- chown pulse:pulse "$CONFIG_DIR/system.json" 2>/dev/null || true
+ chown pulse:pulse "$config_dir/system.json" 2>/dev/null || true
# Start the timer
- safe_systemctl start pulse-update.timer || true
+ safe_systemctl start "$update_timer_unit" || true
print_success "Automatic updates enabled (daily check with 2-6 hour random delay)"
}
@@ -3450,8 +3577,11 @@ install_systemd_service() {
print_info "Installing systemd service..."
# Use existing service name if found, otherwise use default
- EXISTING_SERVICE=$(detect_service_name)
- if [[ "$EXISTING_SERVICE" == "pulse-backend" ]] && [[ -f "/etc/systemd/system/pulse-backend.service" ]]; then
+ local existing_service="$SERVICE_NAME"
+ if [[ "$SERVICE_NAME_EXPLICIT" != "true" ]]; then
+ existing_service=$(detect_service_name)
+ fi
+ if [[ "$existing_service" == "pulse-backend" ]] && [[ -f "/etc/systemd/system/pulse-backend.service" ]]; then
# Keep using pulse-backend for compatibility (ProxmoxVE)
SERVICE_NAME="pulse-backend"
print_info "Using existing service name: pulse-backend"
@@ -3537,11 +3667,8 @@ print_completion() {
local IP=$(hostname -I | awk '{print $1}')
# Get the port from the service file or use default
- local PORT="${FRONTEND_PORT:-7655}"
- if [[ -z "${FRONTEND_PORT:-}" ]] && [[ -f "/etc/systemd/system/$SERVICE_NAME.service" ]]; then
- # Try to extract port from service file
- PORT=$(grep -oP 'FRONTEND_PORT=\K\d+' "/etc/systemd/system/$SERVICE_NAME.service" 2>/dev/null || echo "7655")
- fi
+ local PORT
+ PORT=$(current_frontend_port)
echo
print_header
@@ -3562,15 +3689,15 @@ print_completion() {
echo " Uninstall: $(build_printed_management_command uninstall)"
# Show auto-update status if timer exists
- if systemctl list-unit-files --no-legend | grep -q "^pulse-update.timer"; then
+ if update_timer_exists; then
echo
echo -e "${YELLOW}Auto-updates:${NC}"
- if systemctl is-enabled --quiet pulse-update.timer 2>/dev/null; then
+ if update_timer_enabled; then
echo -e " Status: ${GREEN}Enabled${NC} (daily check between 2-6 AM)"
- echo " Disable: systemctl disable --now pulse-update.timer"
+ echo " Disable: systemctl disable --now $UPDATE_TIMER_UNIT"
else
echo -e " Status: ${YELLOW}Disabled${NC}"
- echo " Enable: systemctl enable --now pulse-update.timer"
+ echo " Enable: systemctl enable --now $UPDATE_TIMER_UNIT"
fi
fi
@@ -3598,8 +3725,9 @@ print_completion() {
build_printed_management_command() {
local action=$1
- local base="curl -sSL https://github.com/$GITHUB_REPO/releases/latest/download/install.sh | bash"
+ local download_cmd="curl -sSL https://github.com/$GITHUB_REPO/releases/latest/download/install.sh |"
local -a args=()
+ local -a env_vars=()
case "$action" in
update)
@@ -3621,12 +3749,28 @@ build_printed_management_command() {
args=(--rc "${args[@]}")
fi
+ if [[ "$SERVICE_NAME_EXPLICIT" == "true" ]]; then
+ env_vars+=("PULSE_SERVICE_NAME=$SERVICE_NAME")
+ fi
+
+ printf '%s' "$download_cmd"
+ local env_var
+ if [[ ${#env_vars[@]} -gt 0 ]]; then
+ printf ' env'
+ for env_var in "${env_vars[@]}"; do
+ printf ' %q' "$env_var"
+ done
+ printf ' bash'
+ else
+ printf ' bash'
+ fi
+
if [[ ${#args[@]} -eq 0 ]]; then
- printf '%s\n' "$base"
+ printf '\n'
return 0
fi
- printf '%s -s --' "$base"
+ printf ' -s --'
local arg
for arg in "${args[@]}"; do
printf ' %q' "$arg"
@@ -3692,7 +3836,7 @@ main() {
local should_ask_about_updates=false
local prompt_reason=""
- if ! systemctl list-unit-files --no-legend 2>/dev/null | grep -q "^pulse-update.timer"; then
+ if ! update_timer_exists; then
# Timer doesn't exist - new feature
should_ask_about_updates=true
prompt_reason="new"
@@ -3905,7 +4049,7 @@ main() {
local should_ask_about_updates=false
local prompt_reason=""
- if ! systemctl list-unit-files --no-legend 2>/dev/null | grep -q "^pulse-update.timer"; then
+ if ! update_timer_exists; then
# Timer doesn't exist - new feature
should_ask_about_updates=true
prompt_reason="new"
@@ -3960,7 +4104,7 @@ main() {
local should_ask_about_updates=false
local prompt_reason=""
- if ! systemctl list-unit-files --no-legend 2>/dev/null | grep -q "^pulse-update.timer"; then
+ if ! update_timer_exists; then
# Timer doesn't exist - new feature
should_ask_about_updates=true
prompt_reason="new"
@@ -4010,21 +4154,29 @@ main() {
;;
remove)
# Stop and disable service
- systemctl stop $SERVICE_NAME 2>/dev/null || true
- systemctl disable $SERVICE_NAME 2>/dev/null || true
+ systemctl stop "$SERVICE_NAME" 2>/dev/null || true
+ systemctl disable "$SERVICE_NAME" 2>/dev/null || true
# Remove service files
- rm -f /etc/systemd/system/$SERVICE_NAME.service
- rm -f /etc/systemd/system/pulse.service
- rm -f /etc/systemd/system/pulse-backend.service
+ rm -f "/etc/systemd/system/$SERVICE_NAME.service"
+ if [[ "$SERVICE_NAME_EXPLICIT" != "true" ]]; then
+ rm -f /etc/systemd/system/pulse.service
+ rm -f /etc/systemd/system/pulse-backend.service
+ fi
+ rm -f "$UPDATE_SERVICE_PATH"
+ rm -f "$UPDATE_TIMER_PATH"
# Reload systemd daemon
- safe_systemctl daemon-reload
+ safe_systemctl daemon-reload
# Remove installation directory
rm -rf "$INSTALL_DIR"
# Remove symlink
- rm -f /usr/local/bin/pulse
+ rm -f "$BINARY_LINK_PATH"
+ rm -f "$AUTO_UPDATE_DEST"
+ if [[ "$UPDATE_HELPER_PATH" != "/bin/update" ]]; then
+ rm -f "$UPDATE_HELPER_PATH"
+ fi
# Ask about config/data removal
echo
@@ -4050,7 +4202,9 @@ main() {
# Remove any log files
rm -f /var/log/pulse*.log 2>/dev/null || true
- rm -f /opt/pulse.log 2>/dev/null || true
+ if [[ "$SERVICE_NAME_EXPLICIT" != "true" ]]; then
+ rm -f /opt/pulse.log 2>/dev/null || true
+ fi
print_success "Pulse removed successfully"
;;
@@ -4126,37 +4280,42 @@ uninstall_pulse() {
echo
# Detect service name
- local SERVICE_NAME=$(detect_service_name)
+ local service_name
+ service_name=$(detect_service_name)
# Stop and disable service
- if systemctl is-active --quiet $SERVICE_NAME 2>/dev/null; then
- echo "Stopping $SERVICE_NAME..."
- systemctl stop $SERVICE_NAME
+ if systemctl is-active --quiet "$service_name" 2>/dev/null; then
+ echo "Stopping $service_name..."
+ systemctl stop "$service_name"
fi
- if systemctl is-enabled --quiet $SERVICE_NAME 2>/dev/null; then
- echo "Disabling $SERVICE_NAME..."
- systemctl disable $SERVICE_NAME
+ if systemctl is-enabled --quiet "$service_name" 2>/dev/null; then
+ echo "Disabling $service_name..."
+ systemctl disable "$service_name"
fi
# Stop and disable auto-update timer if it exists
- if systemctl is-enabled --quiet pulse-update.timer 2>/dev/null; then
+ if update_timer_enabled; then
echo "Disabling auto-update timer..."
- systemctl disable --now pulse-update.timer
+ systemctl disable --now "$UPDATE_TIMER_UNIT"
fi
# Remove files
echo "Removing Pulse files..."
- rm -rf /opt/pulse
- rm -rf /etc/pulse
- rm -f /etc/systemd/system/pulse.service
- rm -f /etc/systemd/system/pulse-backend.service
- rm -f /etc/systemd/system/pulse-update.service
- rm -f /etc/systemd/system/pulse-update.timer
- rm -f /usr/local/bin/pulse
- rm -f /usr/local/bin/pulse-auto-update.sh
- # Don't remove update commands - might be from community scripts
- # rm -f /usr/local/bin/update
+ rm -rf "$INSTALL_DIR"
+ rm -rf "$CONFIG_DIR"
+ rm -f "/etc/systemd/system/$service_name.service"
+ if [[ "$SERVICE_NAME_EXPLICIT" != "true" ]]; then
+ rm -f /etc/systemd/system/pulse.service
+ rm -f /etc/systemd/system/pulse-backend.service
+ fi
+ rm -f "$UPDATE_SERVICE_PATH"
+ rm -f "$UPDATE_TIMER_PATH"
+ rm -f "$BINARY_LINK_PATH"
+ rm -f "$AUTO_UPDATE_DEST"
+ if [[ "$UPDATE_HELPER_PATH" != "/bin/update" ]]; then
+ rm -f "$UPDATE_HELPER_PATH"
+ fi
# Remove user (if it exists and isn't being used by other services)
if id "pulse" &>/dev/null; then
@@ -4180,25 +4339,26 @@ reset_pulse() {
echo
# Detect service name
- local SERVICE_NAME=$(detect_service_name)
+ local service_name
+ service_name=$(detect_service_name)
# Stop service
- if systemctl is-active --quiet $SERVICE_NAME 2>/dev/null; then
- echo "Stopping $SERVICE_NAME..."
- systemctl stop $SERVICE_NAME
+ if systemctl is-active --quiet "$service_name" 2>/dev/null; then
+ echo "Stopping $service_name..."
+ systemctl stop "$service_name"
fi
# Remove config but keep binary
echo "Removing configuration and data..."
- rm -rf /etc/pulse/*
+ rm -rf "$CONFIG_DIR"/*
# Restart service
- echo "Starting $SERVICE_NAME with fresh configuration..."
- systemctl start $SERVICE_NAME
+ echo "Starting $service_name with fresh configuration..."
+ systemctl start "$service_name"
echo
echo -e "\033[0;32m✓ Pulse has been reset to fresh configuration\033[0m"
- echo "Access Pulse at: http://$(hostname -I | awk '{print $1}'):7655"
+ echo "Access Pulse at: http://$(hostname -I | awk '{print $1}'):$(current_frontend_port)"
exit 0
}
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 91052689e6..176d0c7100 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -97,6 +97,10 @@ func TestDockerAndDemoBuildsUseCanonicalReleaseLdflags(t *testing.T) {
workflow := string(workflowBytes)
workflowRequired := []string{
`./scripts/release_ldflags.sh server --version "${VERSION}" --build-time "${BUILD_TIME}" --git-commit "${GIT_COMMIT}"`,
+ `demo-preview-v6`,
+ `demo-stable`,
+ `workflow_dispatch:`,
+ `target:`,
}
for _, needle := range workflowRequired {
if !strings.Contains(workflow, needle) {
diff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.go
index 770e3500e4..4d2789a0e1 100644
--- a/scripts/installtests/install_sh_test.go
+++ b/scripts/installtests/install_sh_test.go
@@ -1052,7 +1052,7 @@ func TestSetupUpdateCommandHonorsRCChannelAndCustomPaths(t *testing.T) {
t.Fatalf("read update helper: %v", err)
}
got := string(content)
- if !strings.Contains(got, `CONFIG_DIR="/etc/pulse"`) {
+ if !strings.Contains(got, `CONFIG_DIR=/etc/pulse`) {
t.Fatalf("update helper missing config dir logic:\n%s", got)
}
if !strings.Contains(got, `extra_args+=(--rc)`) {
diff --git a/scripts/installtests/root_install_sh_test.go b/scripts/installtests/root_install_sh_test.go
index af3bdb26c5..d13f26cfdb 100644
--- a/scripts/installtests/root_install_sh_test.go
+++ b/scripts/installtests/root_install_sh_test.go
@@ -214,3 +214,64 @@ func TestPrereleaseUpdateCopyUsesPreviewFraming(t *testing.T) {
t.Fatalf("pulse-auto-update.sh preserved stale release-candidate channel log message")
}
}
+
+func TestRootInstallScriptSupportsInstanceScopedServerInstalls(t *testing.T) {
+ content, err := os.ReadFile(filepath.Join("..", "..", "install.sh"))
+ if err != nil {
+ t.Fatalf("read root install.sh: %v", err)
+ }
+
+ script := string(content)
+ required := []string{
+ `SERVICE_NAME_EXPLICIT="false"`,
+ `SERVICE_NAME="${PULSE_SERVICE_NAME:-$DEFAULT_SERVICE_NAME}"`,
+ `INSTALL_DIR="${PULSE_INSTALL_DIR:-$(default_install_dir_for_service "$SERVICE_NAME")}"`,
+ `CONFIG_DIR="${PULSE_CONFIG_DIR:-$(default_config_dir_for_service "$SERVICE_NAME")}"`,
+ `BINARY_LINK_PATH="${PULSE_BINARY_LINK_PATH:-$(default_binary_link_path_for_service "$SERVICE_NAME")}"`,
+ `UPDATE_HELPER_PATH="${PULSE_UPDATE_HELPER_PATH:-$(default_update_helper_path_for_service "$SERVICE_NAME")}"`,
+ `AUTO_UPDATE_DEST="${PULSE_AUTO_UPDATE_DEST:-$(default_auto_update_dest_for_service "$SERVICE_NAME")}"`,
+ `UPDATE_SERVICE_PATH="${PULSE_UPDATE_SERVICE_PATH:-$(default_update_service_path_for_service "$SERVICE_NAME")}"`,
+ `UPDATE_TIMER_PATH="${PULSE_UPDATE_TIMER_PATH:-$(default_update_timer_path_for_service "$SERVICE_NAME")}"`,
+ `if [[ "$SERVICE_NAME_EXPLICIT" == "true" ]]; then`,
+ `mkdir -p "$(dirname "$BINARY_LINK_PATH")"`,
+ `ln -sf "$INSTALL_DIR/bin/pulse" "$BINARY_LINK_PATH"`,
+ `safe_systemctl enable "$update_timer_unit" || true`,
+ `safe_systemctl start "$update_timer_unit" || true`,
+ `Environment="PULSE_SERVICE_NAME=$service_name"`,
+ `Environment="PULSE_INSTALL_DIR=$install_dir"`,
+ `Environment="PULSE_CONFIG_DIR=$config_dir"`,
+ `Environment="PULSE_UPDATE_TIMER_UNIT=$update_timer_unit"`,
+ `printf ' env'`,
+ `env_vars+=("PULSE_SERVICE_NAME=$SERVICE_NAME")`,
+ }
+ for _, needle := range required {
+ if !strings.Contains(script, needle) {
+ t.Fatalf("root install.sh missing instance-scoped install contract fragment: %s", needle)
+ }
+ }
+}
+
+func TestPulseAutoUpdateScriptSupportsInstanceScopedServerInstalls(t *testing.T) {
+ content, err := os.ReadFile(filepath.Join("..", "..", "scripts", "pulse-auto-update.sh"))
+ if err != nil {
+ t.Fatalf("read pulse-auto-update.sh: %v", err)
+ }
+
+ script := string(content)
+ required := []string{
+ `SERVICE_NAME="${PULSE_SERVICE_NAME:-pulse}"`,
+ `INSTALL_DIR="${PULSE_INSTALL_DIR:-/opt/pulse}"`,
+ `CONFIG_DIR="${PULSE_CONFIG_DIR:-/etc/pulse}"`,
+ `UPDATE_TIMER_UNIT="${PULSE_UPDATE_TIMER_UNIT:-${SERVICE_NAME}-update.timer}"`,
+ `if [[ -n "${PULSE_SERVICE_NAME:-}" ]]; then`,
+ `"PULSE_SERVICE_NAME=$service_name"`,
+ `"PULSE_INSTALL_DIR=$INSTALL_DIR"`,
+ `"PULSE_CONFIG_DIR=$CONFIG_DIR"`,
+ `systemctl is-enabled --quiet "$UPDATE_TIMER_UNIT"`,
+ }
+ for _, needle := range required {
+ if !strings.Contains(script, needle) {
+ t.Fatalf("pulse-auto-update.sh missing instance-scoped install contract fragment: %s", needle)
+ }
+ }
+}
diff --git a/scripts/pulse-auto-update.sh b/scripts/pulse-auto-update.sh
index 7fdf7980c9..2267c8f5f9 100755
--- a/scripts/pulse-auto-update.sh
+++ b/scripts/pulse-auto-update.sh
@@ -8,9 +8,11 @@ set -euo pipefail
# Configuration
GITHUB_REPO="${GITHUB_REPO:-rcourtman/Pulse}"
-INSTALL_DIR="/opt/pulse"
-CONFIG_DIR="/etc/pulse"
-LOG_TAG="pulse-auto-update"
+SERVICE_NAME="${PULSE_SERVICE_NAME:-pulse}"
+INSTALL_DIR="${PULSE_INSTALL_DIR:-/opt/pulse}"
+CONFIG_DIR="${PULSE_CONFIG_DIR:-/etc/pulse}"
+UPDATE_TIMER_UNIT="${PULSE_UPDATE_TIMER_UNIT:-${SERVICE_NAME}-update.timer}"
+LOG_TAG="${PULSE_AUTO_UPDATE_LOG_TAG:-${SERVICE_NAME}-auto-update}"
MAX_LOG_SIZE=10485760 # 10MB
# Logging function
@@ -38,7 +40,7 @@ check_auto_updates_enabled() {
fi
# Also check if timer is enabled (belt and suspenders)
- if ! systemctl is-enabled --quiet pulse-update.timer 2>/dev/null; then
+ if ! systemctl is-enabled --quiet "$UPDATE_TIMER_UNIT" 2>/dev/null; then
log info "Auto-update timer is disabled"
exit 0
fi
@@ -136,7 +138,9 @@ version_greater_than() {
# Detect service name (could be pulse or pulse-backend)
detect_service_name() {
- if systemctl list-unit-files --no-legend | grep -q "^pulse-backend.service"; then
+ if [[ -n "${PULSE_SERVICE_NAME:-}" ]]; then
+ echo "$SERVICE_NAME"
+ elif systemctl list-unit-files --no-legend | grep -q "^pulse-backend.service"; then
echo "pulse-backend"
elif systemctl list-unit-files --no-legend | grep -q "^pulse.service"; then
echo "pulse"
@@ -191,7 +195,11 @@ perform_update() {
fi
if curl -sSL "$install_script_url" | \
- bash -s -- "${installer_args[@]}" 2>&1 | \
+ env \
+ "PULSE_SERVICE_NAME=$service_name" \
+ "PULSE_INSTALL_DIR=$INSTALL_DIR" \
+ "PULSE_CONFIG_DIR=$CONFIG_DIR" \
+ bash -s -- "${installer_args[@]}" 2>&1 | \
while IFS= read -r line; do
log info "installer: $line"
done; then
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index 7300b259bf..af316df793 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -116,8 +116,8 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
re.compile(r"existing v5 users until `(?:\[v5-eos-date\]|\d{4}-\d{2}-\d{2})`\.")
)
else:
- self.assertIn("Pre-Release Notes", release_notes)
- self.assertIn("final GA release", release_notes)
+ self.assertRegex(release_notes, re.compile(r"(Pre-Release Notes|Release Candidate Notes)"))
+ self.assertRegex(release_notes, re.compile(r"(final GA release|stable `v6\.0\.0` release)"))
self.assertNotIn("Pulse v5 Support Transition", release_notes)
def test_rehearsal_template_and_workflow_capture_ga_rehearsal_record(self) -> None:
@@ -213,6 +213,7 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
publish = read(".github/workflows/publish-docker.yml")
promote = read(".github/workflows/promote-floating-tags.yml")
demo = read(".github/workflows/update-demo-server.yml")
+ release_workflow = read(".github/workflows/create-release.yml")
helm = read(".github/workflows/publish-helm-chart.yml")
helm_pages = read(".github/workflows/helm-pages.yml")
chart = read("deploy/helm/pulse/Chart.yaml")
@@ -221,11 +222,20 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("control_plane.py --branch-for-version", publish)
self.assertIn("control_plane.py --branch-for-version", promote)
self.assertIn("control_plane.py --branch-for-version", demo)
+ self.assertIn("preview-v6", demo)
+ self.assertIn("demo-preview-v6", demo)
+ self.assertIn("demo-stable", demo)
+ self.assertIn("Refusing prerelease tag", demo)
+ self.assertIn("Refusing stable tag", demo)
+ self.assertIn("latest published release for target", demo)
self.assertIn("control_plane.py --branch-for-version", helm)
self.assertIn("control_plane.py --branch-for-version", helm_pages)
self.assertIn("does not descend from any matching prerelease tag", publish)
self.assertIn("does not descend from any matching prerelease tag", promote)
self.assertIn("Refusing cross-line Helm pages release", helm_pages)
+ self.assertIn('TARGET="preview-v6"', release_workflow)
+ self.assertIn('TARGET="stable"', release_workflow)
+ self.assertIn('gh workflow run update-demo-server.yml -f tag="${{ needs.prepare.outputs.tag }}" -f target="${TARGET}"', release_workflow)
self.assertIn("sync_chart_release_metadata.py", helm)
self.assertIn("sync_chart_release_metadata.py", helm_pages)
self.assertIn("--chart deploy/helm/pulse/Chart.yaml", helm)
@@ -236,6 +246,8 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("raw.githubusercontent.com/{repo}/{tag}/docs/images/pulse-logo.svg", chart_sync)
self.assertIn("both stable and prerelease releases dispatch", runbook)
self.assertIn("Release `6.0.0` from `pulse/v6-release`", runbook)
+ self.assertIn("separate v6 preview demo environment", runbook)
+ self.assertIn("preview-v6", runbook)
self.assertIn(promotion_metadata_envelope(), normalize_ws(runbook))
def test_blocked_record_tracks_current_target_and_candidate_version(self) -> None: