mirror of
https://github.com/anand34577/ferrum.git
synced 2026-09-12 05:48:58 +00:00
7d3a1fa134
- .gitignore/.dockerignore: cover Go build artifacts, env files, logs, editor/OS cruft, and local runtime data (sqlite db/secret, config.yaml). - README: add a Screenshots section (captured against a mock Proxmox cluster) and a Deploying a release build section. - LICENSE: MIT. Deployable binaries: - cmd/ferrum: -version flag with build-time version/commit/date via -ldflags; -log-file flag (Windows services don't capture stdout/stderr the way systemd does); native Windows Service Control Manager support (service_windows.go) so ferrum.exe manages its own start/stop lifecycle under a Windows service, same graceful-shutdown path SIGTERM already used on Linux. - packaging/systemd/ferrum.service: hardened systemd unit. - scripts/build.sh, build.ps1: cross-compile linux/windows/darwin x amd64/arm64, package as .tar.gz/.zip with an install script and checksums.txt. - scripts/linux/install.sh, uninstall.sh: create a dedicated system user, install the binary, seed /etc/ferrum/config.yaml, enable + start the systemd service. - scripts/get.sh: one-line curl-pipeable installer (get.docker.com style) that resolves the latest release, verifies its checksum, and hands off to install.sh. - scripts/windows/install-service.ps1, uninstall-service.ps1: register/ remove the self-managing Windows service. - .github/workflows/release.yml: publish all platform archives + checksums as GitHub Release assets on a vX.Y.Z tag push. - .github/workflows/ci.yml: go vet/build/test, frontend lint/test/build, and shell-script syntax checks on push/PR.
59 lines
1.7 KiB
PowerShell
59 lines
1.7 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Builds the frontend and the ferrum.exe binary for local development on
|
|
Windows (host GOOS/GOARCH only). For cross-platform release builds, use
|
|
scripts/build.sh (bash — works under Git Bash/WSL, and is what
|
|
.github/workflows/release.yml runs).
|
|
|
|
.EXAMPLE
|
|
.\scripts\build.ps1
|
|
.EXAMPLE
|
|
.\scripts\build.ps1 -SkipFrontend # reuse the existing web/dist
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[switch]$SkipFrontend,
|
|
[string]$Version,
|
|
[string]$OutDir = "dist"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
Set-Location (Join-Path $PSScriptRoot "..")
|
|
|
|
if (-not $Version) {
|
|
try {
|
|
$Version = (git describe --tags --always --dirty 2>$null)
|
|
if (-not $Version) { $Version = "dev" }
|
|
} catch {
|
|
$Version = "dev"
|
|
}
|
|
}
|
|
$Commit = try { (git rev-parse --short HEAD 2>$null) } catch { "none" }
|
|
if (-not $Commit) { $Commit = "none" }
|
|
$Date = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
|
$ldflags = "-s -w -X main.version=$Version -X main.commit=$Commit -X main.date=$Date"
|
|
|
|
if (-not $SkipFrontend) {
|
|
Write-Host "==> Building frontend (web/dist)"
|
|
Push-Location web
|
|
try {
|
|
npm ci
|
|
npm run build
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
|
|
$bin = Join-Path $OutDir "ferrum.exe"
|
|
|
|
Write-Host "==> Building ferrum.exe ($Version, $Commit, $Date)"
|
|
$env:CGO_ENABLED = "0"
|
|
go build -trimpath -ldflags $ldflags -o $bin ./cmd/ferrum
|
|
Remove-Item Env:\CGO_ENABLED
|
|
|
|
Copy-Item README.md, LICENSE, config.example.yaml -Destination $OutDir -Force
|
|
Copy-Item scripts\windows\install-service.ps1, scripts\windows\uninstall-service.ps1 -Destination $OutDir -Force
|
|
|
|
Write-Host "==> Done: $bin"
|