mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-19 02:28:59 +00:00
feat: add auto-update support for unified agent
Implement self-update capability for the unified pulse-agent binary: - Add internal/agentupdate package with cross-platform update logic - Hourly version checks against /api/agent/version endpoint - SHA256 checksum verification for downloaded binaries - Atomic binary replacement with backup/rollback on failure - Support for Linux, macOS, and Windows (10 platform/arch combinations) Build and release changes: - Dockerfile builds unified agent for all platforms - build-release.sh includes unified agent in release artifacts - validate-release.sh validates unified agent binaries - Install scripts (install.sh, install.ps1) use correct URL format Related to #727, #737
This commit is contained in:
parent
5e3f1db5b3
commit
0436101ee5
12 changed files with 860 additions and 91 deletions
65
Dockerfile
65
Dockerfile
|
|
@ -136,6 +136,51 @@ RUN --mount=type=cache,id=pulse-go-mod,target=/go/pkg/mod \
|
|||
-trimpath \
|
||||
-o pulse-host-agent-windows-386.exe ./cmd/pulse-host-agent
|
||||
|
||||
# Build unified agent binaries for all platforms (for download endpoint)
|
||||
RUN --mount=type=cache,id=pulse-go-mod,target=/go/pkg/mod \
|
||||
--mount=type=cache,id=pulse-go-build,target=/root/.cache/go-build \
|
||||
VERSION="v$(cat VERSION | tr -d '\n')" && \
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-linux-amd64 ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-linux-arm64 ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-linux-armv7 ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-linux-armv6 ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-linux-386 ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-darwin-amd64 ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-darwin-arm64 ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-windows-amd64.exe ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-windows-arm64.exe ./cmd/pulse-agent && \
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build \
|
||||
-ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-trimpath \
|
||||
-o pulse-agent-windows-386.exe ./cmd/pulse-agent
|
||||
|
||||
# Build pulse-sensor-proxy for all Linux architectures (for download endpoint)
|
||||
RUN --mount=type=cache,id=pulse-go-mod,target=/go/pkg/mod \
|
||||
--mount=type=cache,id=pulse-go-build,target=/root/.cache/go-build \
|
||||
|
|
@ -224,7 +269,9 @@ COPY scripts/uninstall-host-agent.sh /opt/pulse/scripts/uninstall-host-agent.sh
|
|||
COPY scripts/uninstall-host-agent.ps1 /opt/pulse/scripts/uninstall-host-agent.ps1
|
||||
COPY scripts/install-sensor-proxy.sh /opt/pulse/scripts/install-sensor-proxy.sh
|
||||
COPY scripts/install-docker.sh /opt/pulse/scripts/install-docker.sh
|
||||
RUN chmod 755 /opt/pulse/scripts/install-docker-agent.sh /opt/pulse/scripts/install-container-agent.sh /opt/pulse/scripts/install-host-agent.sh /opt/pulse/scripts/install-host-agent.ps1 /opt/pulse/scripts/uninstall-host-agent.sh /opt/pulse/scripts/uninstall-host-agent.ps1 /opt/pulse/scripts/install-sensor-proxy.sh /opt/pulse/scripts/install-docker.sh
|
||||
COPY scripts/install.sh /opt/pulse/scripts/install.sh
|
||||
COPY scripts/install.ps1 /opt/pulse/scripts/install.ps1
|
||||
RUN chmod 755 /opt/pulse/scripts/*.sh /opt/pulse/scripts/*.ps1
|
||||
|
||||
# Copy all binaries for download endpoint
|
||||
RUN mkdir -p /opt/pulse/bin
|
||||
|
|
@ -256,6 +303,22 @@ RUN ln -s pulse-host-agent-windows-amd64.exe /opt/pulse/bin/pulse-host-agent-win
|
|||
ln -s pulse-host-agent-windows-arm64.exe /opt/pulse/bin/pulse-host-agent-windows-arm64 && \
|
||||
ln -s pulse-host-agent-windows-386.exe /opt/pulse/bin/pulse-host-agent-windows-386
|
||||
|
||||
# Unified agent binaries (all platforms and architectures)
|
||||
COPY --from=backend-builder /app/pulse-agent-linux-amd64 /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-linux-arm64 /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-linux-armv7 /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-linux-armv6 /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-linux-386 /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-darwin-amd64 /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-darwin-arm64 /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-windows-amd64.exe /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-windows-arm64.exe /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-agent-windows-386.exe /opt/pulse/bin/
|
||||
# Create symlinks for Windows without .exe extension
|
||||
RUN ln -s pulse-agent-windows-amd64.exe /opt/pulse/bin/pulse-agent-windows-amd64 && \
|
||||
ln -s pulse-agent-windows-arm64.exe /opt/pulse/bin/pulse-agent-windows-arm64 && \
|
||||
ln -s pulse-agent-windows-386.exe /opt/pulse/bin/pulse-agent-windows-386
|
||||
|
||||
# Sensor proxy binaries (all Linux architectures)
|
||||
COPY --from=backend-builder /app/pulse-sensor-proxy-linux-amd64 /opt/pulse/bin/
|
||||
COPY --from=backend-builder /app/pulse-sensor-proxy-linux-arm64 /opt/pulse/bin/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue