Archived
Replace SLF4J with BarnLogger and update documentation
- Replace SLF4J/logback with custom BarnLogger across all source files - BarnLogger is disabled by default for CLI commands, enabled for service - Fixes #30: debug logs no longer break JSON/XML CLI output - Add SpotBugs exclusions for BarnLogger false positives - Update docs: remove .deb and AUR references (no longer applicable) - Update docs: add Windows setup.exe installation instructions - Update docs: clarify auto-update only works with Homebrew Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
41126eeed4
commit
d95ac32739
44 files changed
+466
-1227
No files matched your search
+69
-386
@@ -1,137 +1,100 @@
|
||||
# Auto-Update
|
||||
# Updating Barn
|
||||
|
||||
This document describes Barn's built-in self-update mechanism.
|
||||
This document describes how to keep Barn updated on different platforms.
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Barn includes a `barn update` command that can check for and install new versions directly from GitHub Releases without requiring a package manager.
|
||||
| Platform | Update Method | Automatic |
|
||||
|----------|---------------|-----------|
|
||||
| macOS (Homebrew) | `brew upgrade barn` | Yes |
|
||||
| macOS (manual) | Download from GitHub Releases | No |
|
||||
| Windows | Download setup installer from GitHub Releases | No |
|
||||
| Linux | Download binary from GitHub Releases | No |
|
||||
|
||||
---
|
||||
|
||||
## Commands
|
||||
## macOS (Homebrew)
|
||||
|
||||
### Check for Updates
|
||||
If you installed Barn via Homebrew, updates are handled automatically:
|
||||
|
||||
```bash
|
||||
barn update --check
|
||||
# Check for updates
|
||||
brew outdated barn
|
||||
|
||||
# Update Barn
|
||||
brew upgrade barn
|
||||
|
||||
# Restart the service after updating
|
||||
brew services restart barn
|
||||
```
|
||||
|
||||
Output:
|
||||
Homebrew will automatically fetch the latest version from the Homebrew tap when you run `brew upgrade`.
|
||||
|
||||
```
|
||||
Current version: 1.2.3
|
||||
Latest version: 1.3.0
|
||||
Update available: yes
|
||||
---
|
||||
|
||||
Run 'barn update' to install the latest version.
|
||||
```
|
||||
## macOS (Manual Installation)
|
||||
|
||||
### Install Latest Version
|
||||
If you installed Barn manually (not via Homebrew):
|
||||
|
||||
```bash
|
||||
barn update
|
||||
```
|
||||
1. Download the latest binary from [GitHub Releases](https://github.com/samson-media/barn/releases/latest)
|
||||
2. Stop the service: `barn service stop`
|
||||
3. Replace the binary:
|
||||
```bash
|
||||
chmod +x barn-macos-arm64
|
||||
sudo mv barn-macos-arm64 /usr/local/bin/barn
|
||||
```
|
||||
4. Verify: `barn --version`
|
||||
5. Start the service: `barn service start`
|
||||
|
||||
Output:
|
||||
---
|
||||
|
||||
```
|
||||
Current version: 1.2.3
|
||||
Latest version: 1.3.0
|
||||
## Windows
|
||||
|
||||
Downloading barn-macos-arm64...
|
||||
Verifying checksum...
|
||||
Installing...
|
||||
Restarting service...
|
||||
To update Barn on Windows:
|
||||
|
||||
Successfully updated to version 1.3.0
|
||||
```
|
||||
1. Download the latest `setup-barn-vX.X.X-windows-x64.exe` from [GitHub Releases](https://github.com/samson-media/barn/releases/latest)
|
||||
2. Run the installer - it will automatically:
|
||||
- Stop the Barn service
|
||||
- Update the binary
|
||||
- Restart the service
|
||||
|
||||
### Install Specific Version
|
||||
Alternatively, for silent updates:
|
||||
|
||||
```bash
|
||||
barn update --version=1.2.0
|
||||
```
|
||||
```powershell
|
||||
# Download the installer
|
||||
Invoke-WebRequest -Uri "https://github.com/samson-media/barn/releases/latest/download/setup-barn-vX.X.X-windows-x64.exe" -OutFile "setup-barn.exe"
|
||||
|
||||
### Force Update (Reinstall Current Version)
|
||||
|
||||
```bash
|
||||
barn update --force
|
||||
```
|
||||
|
||||
### JSON Output
|
||||
|
||||
```bash
|
||||
barn update --check --output=json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"current_version": "1.2.3",
|
||||
"latest_version": "1.3.0",
|
||||
"update_available": true,
|
||||
"release_url": "https://github.com/samson-media/barn/releases/tag/v1.3.0"
|
||||
}
|
||||
# Run silent installation
|
||||
.\setup-barn.exe /S
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Update Flow
|
||||
## Linux
|
||||
|
||||
### 1. Query GitHub Releases API
|
||||
To update Barn on Linux:
|
||||
|
||||
Barn queries the GitHub Releases API to find the latest version:
|
||||
1. Download the latest binary from [GitHub Releases](https://github.com/samson-media/barn/releases/latest)
|
||||
2. Stop the service:
|
||||
```bash
|
||||
sudo systemctl stop barn
|
||||
```
|
||||
3. Replace the binary:
|
||||
```bash
|
||||
chmod +x barn-linux-x64
|
||||
sudo mv barn-linux-x64 /usr/local/bin/barn
|
||||
```
|
||||
4. Verify: `barn --version`
|
||||
5. Start the service:
|
||||
```bash
|
||||
sudo systemctl start barn
|
||||
```
|
||||
|
||||
```
|
||||
GET https://api.github.com/repos/samson-media/barn/releases/latest
|
||||
```
|
||||
---
|
||||
|
||||
Response includes:
|
||||
- Version tag
|
||||
- Asset download URLs
|
||||
- Checksums
|
||||
|
||||
### 2. Compare Versions
|
||||
|
||||
Versions are compared using semantic versioning:
|
||||
|
||||
```
|
||||
1.3.0 > 1.2.3 → Update available
|
||||
1.2.3 = 1.2.3 → Up to date
|
||||
1.2.0 < 1.2.3 → Downgrade (requires --force)
|
||||
```
|
||||
|
||||
### 3. Download Binary
|
||||
|
||||
The appropriate binary is downloaded based on OS and architecture:
|
||||
|
||||
| OS | Architecture | Asset |
|
||||
|----|--------------|-------|
|
||||
| Linux | x86_64 | `barn-linux-x64` |
|
||||
| Linux | ARM64 | `barn-linux-arm64` |
|
||||
| macOS | x86_64 | `barn-macos-x64` |
|
||||
| macOS | ARM64 | `barn-macos-arm64` |
|
||||
| Windows | x86_64 | `barn-windows-x64.exe` |
|
||||
|
||||
### 4. Verify Checksum
|
||||
|
||||
The SHA256 checksum is verified against `SHA256SUMS`:
|
||||
|
||||
```bash
|
||||
# Downloaded automatically and verified
|
||||
sha256sum -c SHA256SUMS
|
||||
```
|
||||
|
||||
If verification fails, the update is aborted.
|
||||
|
||||
### 5. Replace Binary
|
||||
|
||||
The old binary is replaced with the new one.
|
||||
|
||||
### 6. Verify Installation
|
||||
|
||||
After replacement, Barn verifies the new binary works:
|
||||
## Checking Your Current Version
|
||||
|
||||
```bash
|
||||
barn --version
|
||||
@@ -139,296 +102,16 @@ barn --version
|
||||
|
||||
---
|
||||
|
||||
## Platform-Specific Behavior
|
||||
## Release Notifications
|
||||
|
||||
### Windows
|
||||
To be notified of new releases, watch the [GitHub repository](https://github.com/samson-media/barn):
|
||||
|
||||
Windows cannot replace a running executable. The update process:
|
||||
|
||||
1. Download new binary to temp location
|
||||
2. Stop the Barn service
|
||||
3. Rename current `barn.exe` to `barn.exe.old`
|
||||
4. Move new binary to `barn.exe`
|
||||
5. Start the Barn service
|
||||
6. Delete `barn.exe.old` on next run
|
||||
|
||||
```
|
||||
C:\Program Files\Barn\
|
||||
barn.exe ← New version
|
||||
barn.exe.old ← Previous version (deleted on next run)
|
||||
```
|
||||
|
||||
### Linux / macOS
|
||||
|
||||
Direct replacement if permissions allow:
|
||||
|
||||
```bash
|
||||
# Requires write permission to binary location
|
||||
sudo barn update
|
||||
```
|
||||
|
||||
If running without sudo and binary is in a protected location:
|
||||
|
||||
```
|
||||
Error: Cannot update binary at /usr/local/bin/barn
|
||||
Permission denied. Run with sudo or use your package manager.
|
||||
```
|
||||
|
||||
### Package Manager Installations
|
||||
|
||||
If Barn detects it was installed via a package manager, it warns the user:
|
||||
|
||||
```
|
||||
Warning: Barn appears to be installed via Homebrew.
|
||||
Using 'barn update' may conflict with your package manager.
|
||||
|
||||
Recommended: Run 'brew upgrade barn' instead.
|
||||
|
||||
Continue anyway? [y/N]
|
||||
```
|
||||
|
||||
Detection methods:
|
||||
|
||||
| Package Manager | Detection |
|
||||
|-----------------|-----------|
|
||||
| Homebrew | Binary in `/opt/homebrew/` or `/usr/local/Cellar/` |
|
||||
| apt/dpkg | Binary in `/usr/bin/` with dpkg ownership |
|
||||
| pacman | Binary in `/usr/bin/` with pacman ownership |
|
||||
| WinGet | Registry entries present |
|
||||
|
||||
---
|
||||
|
||||
## Security
|
||||
|
||||
### HTTPS Only
|
||||
|
||||
All downloads use HTTPS. HTTP is never used.
|
||||
|
||||
### Checksum Verification
|
||||
|
||||
Every download is verified against the published SHA256 checksum:
|
||||
|
||||
```
|
||||
SHA256SUMS content:
|
||||
a1b2c3d4... barn-linux-x64
|
||||
e5f6g7h8... barn-linux-arm64
|
||||
...
|
||||
```
|
||||
|
||||
If the checksum doesn't match, the update fails:
|
||||
|
||||
```
|
||||
Error: Checksum verification failed
|
||||
Expected: a1b2c3d4...
|
||||
Got: xxxxxxxx...
|
||||
|
||||
The download may be corrupted or tampered with.
|
||||
Update aborted.
|
||||
```
|
||||
|
||||
### Signature Verification (Optional)
|
||||
|
||||
If GPG signatures are published, Barn can verify them:
|
||||
|
||||
```bash
|
||||
barn update --verify-signature
|
||||
```
|
||||
|
||||
This requires the Samson Media public key to be imported.
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
Update behavior can be configured in `barn.conf`:
|
||||
|
||||
```toml
|
||||
[update]
|
||||
# Disable update checks
|
||||
enabled = true
|
||||
|
||||
# Check for updates automatically on service start
|
||||
check_on_start = true
|
||||
|
||||
# Notify about updates without auto-installing
|
||||
auto_install = false
|
||||
|
||||
# GitHub API endpoint (for enterprise GitHub)
|
||||
github_api = "https://api.github.com"
|
||||
|
||||
# Proxy settings
|
||||
proxy = ""
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
```bash
|
||||
# Disable update functionality
|
||||
BARN_UPDATE_ENABLED=false
|
||||
|
||||
# Use proxy for downloads
|
||||
BARN_UPDATE_PROXY=http://proxy.example.com:8080
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Rollback
|
||||
|
||||
Barn keeps the previous version as a backup.
|
||||
|
||||
### Automatic Backup
|
||||
|
||||
During update, the previous binary is preserved:
|
||||
|
||||
| Platform | Backup Location |
|
||||
|----------|-----------------|
|
||||
| Linux/macOS | `/usr/local/bin/barn.backup` or alongside binary |
|
||||
| Windows | `barn.exe.backup` |
|
||||
|
||||
### Manual Rollback
|
||||
|
||||
```bash
|
||||
barn update --rollback
|
||||
```
|
||||
|
||||
Or manually:
|
||||
|
||||
```bash
|
||||
# Linux/macOS
|
||||
sudo mv /usr/local/bin/barn.backup /usr/local/bin/barn
|
||||
|
||||
# Windows
|
||||
move "C:\Program Files\Barn\barn.exe.backup" "C:\Program Files\Barn\barn.exe"
|
||||
```
|
||||
|
||||
### Rollback Retention
|
||||
|
||||
Only the most recent previous version is kept. Older backups are deleted.
|
||||
|
||||
---
|
||||
|
||||
## Offline Mode
|
||||
|
||||
If network is unavailable:
|
||||
|
||||
```bash
|
||||
barn update --check
|
||||
```
|
||||
|
||||
```
|
||||
Error: Cannot reach GitHub API
|
||||
Check your network connection or proxy settings.
|
||||
|
||||
For offline installation, download the binary manually from:
|
||||
https://github.com/samson-media/barn/releases
|
||||
```
|
||||
|
||||
### Manual Offline Update
|
||||
|
||||
1. Download binary on another machine
|
||||
2. Transfer to target machine
|
||||
3. Replace binary manually:
|
||||
|
||||
```bash
|
||||
chmod +x barn-linux-x64
|
||||
sudo mv barn-linux-x64 /usr/local/bin/barn
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Update Notifications
|
||||
|
||||
When `check_on_start = true`, Barn checks for updates when the service starts and logs:
|
||||
|
||||
```
|
||||
[INFO] Update available: 1.3.0 (current: 1.2.3)
|
||||
[INFO] Run 'barn update' to install
|
||||
```
|
||||
|
||||
This check is non-blocking and doesn't affect service startup.
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Update Check Fails
|
||||
|
||||
```
|
||||
Error: Failed to check for updates
|
||||
GitHub API rate limit exceeded.
|
||||
```
|
||||
|
||||
Solution: Wait an hour or authenticate with a GitHub token:
|
||||
|
||||
```bash
|
||||
GITHUB_TOKEN=xxx barn update --check
|
||||
```
|
||||
|
||||
### Permission Denied
|
||||
|
||||
```
|
||||
Error: Cannot write to /usr/local/bin/barn
|
||||
```
|
||||
|
||||
Solution: Run with elevated privileges:
|
||||
|
||||
```bash
|
||||
sudo barn update
|
||||
```
|
||||
|
||||
### Binary Corrupted After Update
|
||||
|
||||
```
|
||||
Error: barn: cannot execute binary file
|
||||
```
|
||||
|
||||
Solution: Roll back and report the issue:
|
||||
|
||||
```bash
|
||||
sudo mv /usr/local/bin/barn.backup /usr/local/bin/barn
|
||||
barn --version # Verify rollback worked
|
||||
```
|
||||
|
||||
### Service Won't Start After Update
|
||||
|
||||
1. Check logs: `barn service logs`
|
||||
2. Roll back: `barn update --rollback`
|
||||
3. Start service: `barn service start`
|
||||
|
||||
---
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### Version Detection
|
||||
|
||||
Barn determines its own version at compile time:
|
||||
|
||||
```kotlin
|
||||
object Version {
|
||||
const val CURRENT = "1.2.3" // Injected at build
|
||||
val commit = System.getenv("BARN_COMMIT") ?: "unknown"
|
||||
}
|
||||
```
|
||||
|
||||
### API Endpoint
|
||||
|
||||
```
|
||||
GET https://api.github.com/repos/samson-media/barn/releases/latest
|
||||
Accept: application/vnd.github.v3+json
|
||||
```
|
||||
|
||||
### Download with Progress
|
||||
|
||||
Downloads show progress for large binaries:
|
||||
|
||||
```
|
||||
Downloading barn-linux-x64...
|
||||
[████████████████████░░░░░░░░░░] 67% (12.3 MB / 18.4 MB)
|
||||
```
|
||||
1. Go to https://github.com/samson-media/barn
|
||||
2. Click "Watch" → "Custom" → Select "Releases"
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Releasing](releasing.md) - How versions are published
|
||||
- [Distribution](distribution.md) - Package manager alternatives
|
||||
- [Distribution](distribution.md) - Installation methods by platform
|
||||
+67
-484
@@ -8,524 +8,109 @@ This document describes package manager setup and installer creation for all sup
|
||||
|
||||
| Platform | Package Format | Distribution Channel |
|
||||
|----------|---------------|---------------------|
|
||||
| Windows | MSI installer | WinGet |
|
||||
| Linux (Debian/Ubuntu) | .deb | GitHub Releases, optional PPA |
|
||||
| Linux (Arch) | PKGBUILD | AUR |
|
||||
| Windows | Setup installer (.exe) | GitHub Releases |
|
||||
| Linux | Native binary | GitHub Releases |
|
||||
| macOS | Formula | Homebrew tap |
|
||||
|
||||
---
|
||||
|
||||
## Windows MSI
|
||||
## Windows Setup Installer
|
||||
|
||||
### WiX Toolset Setup
|
||||
### Download
|
||||
|
||||
Barn uses [WiX Toolset v4](https://wixtoolset.org/) to create MSI installers.
|
||||
|
||||
Install WiX:
|
||||
|
||||
```powershell
|
||||
dotnet tool install --global wix
|
||||
```
|
||||
|
||||
### Package Structure
|
||||
Download the latest setup installer from GitHub Releases:
|
||||
|
||||
```
|
||||
packaging/wix/
|
||||
barn.wxs # WiX source file
|
||||
license.rtf # License for installer
|
||||
banner.png # Installer banner (optional)
|
||||
dialog.png # Installer dialog background (optional)
|
||||
```
|
||||
|
||||
### WiX Source File
|
||||
|
||||
File: `packaging/wix/barn.wxs`
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Package Name="Barn"
|
||||
Version="!(bind.FileVersion.BarnExe)"
|
||||
Manufacturer="Samson Media"
|
||||
UpgradeCode="PUT-GUID-HERE"
|
||||
Scope="perMachine">
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of Barn is already installed." />
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
||||
<Feature Id="ProductFeature" Title="Barn" Level="1">
|
||||
<ComponentGroupRef Id="ProductComponents" />
|
||||
<ComponentGroupRef Id="ServiceComponents" />
|
||||
</Feature>
|
||||
|
||||
<StandardDirectory Id="ProgramFiles64Folder">
|
||||
<Directory Id="INSTALLFOLDER" Name="Barn">
|
||||
<Component Id="BarnExe" Guid="PUT-GUID-HERE">
|
||||
<File Id="BarnExe" Source="barn-windows-x64.exe" Name="barn.exe" KeyPath="yes" />
|
||||
</Component>
|
||||
|
||||
<Component Id="PathEntry" Guid="PUT-GUID-HERE">
|
||||
<Environment Id="PATH" Name="PATH" Value="[INSTALLFOLDER]"
|
||||
Permanent="no" Part="last" Action="set" System="yes" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</StandardDirectory>
|
||||
|
||||
<ComponentGroup Id="ProductComponents">
|
||||
<ComponentRef Id="BarnExe" />
|
||||
<ComponentRef Id="PathEntry" />
|
||||
</ComponentGroup>
|
||||
|
||||
<ComponentGroup Id="ServiceComponents">
|
||||
<Component Id="BarnService" Directory="INSTALLFOLDER" Guid="PUT-GUID-HERE">
|
||||
<ServiceInstall Id="BarnServiceInstall"
|
||||
Type="ownProcess"
|
||||
Name="BarnService"
|
||||
DisplayName="Barn Job Daemon"
|
||||
Description="Background service for managing media processing jobs"
|
||||
Start="auto"
|
||||
Account="LocalSystem"
|
||||
ErrorControl="normal" />
|
||||
<ServiceControl Id="StartBarnService"
|
||||
Start="install"
|
||||
Stop="both"
|
||||
Remove="uninstall"
|
||||
Name="BarnService"
|
||||
Wait="yes" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Package>
|
||||
</Wix>
|
||||
```
|
||||
|
||||
### Building the MSI
|
||||
|
||||
```powershell
|
||||
cd packaging/wix
|
||||
wix build -o barn-windows-x64.msi barn.wxs
|
||||
```
|
||||
|
||||
### WinGet Submission
|
||||
|
||||
#### Manifest Structure
|
||||
|
||||
Create a manifest directory:
|
||||
|
||||
```
|
||||
manifests/s/SamsonMedia/Barn/1.2.3/
|
||||
SamsonMedia.Barn.yaml
|
||||
SamsonMedia.Barn.installer.yaml
|
||||
SamsonMedia.Barn.locale.en-US.yaml
|
||||
```
|
||||
|
||||
#### Version Manifest
|
||||
|
||||
File: `SamsonMedia.Barn.yaml`
|
||||
|
||||
```yaml
|
||||
PackageIdentifier: SamsonMedia.Barn
|
||||
PackageVersion: 1.2.3
|
||||
DefaultLocale: en-US
|
||||
ManifestType: version
|
||||
ManifestVersion: 1.6.0
|
||||
```
|
||||
|
||||
#### Installer Manifest
|
||||
|
||||
File: `SamsonMedia.Barn.installer.yaml`
|
||||
|
||||
```yaml
|
||||
PackageIdentifier: SamsonMedia.Barn
|
||||
PackageVersion: 1.2.3
|
||||
Platform:
|
||||
- Windows.Desktop
|
||||
MinimumOSVersion: 10.0.0.0
|
||||
InstallerType: msi
|
||||
Scope: machine
|
||||
InstallModes:
|
||||
- silent
|
||||
- silentWithProgress
|
||||
Installers:
|
||||
- Architecture: x64
|
||||
InstallerUrl: https://github.com/samson-media/barn/releases/download/v1.2.3/barn-windows-x64.msi
|
||||
InstallerSha256: <SHA256_HASH>
|
||||
ManifestType: installer
|
||||
ManifestVersion: 1.6.0
|
||||
```
|
||||
|
||||
#### Locale Manifest
|
||||
|
||||
File: `SamsonMedia.Barn.locale.en-US.yaml`
|
||||
|
||||
```yaml
|
||||
PackageIdentifier: SamsonMedia.Barn
|
||||
PackageVersion: 1.2.3
|
||||
PackageLocale: en-US
|
||||
Publisher: Samson Media
|
||||
PackageName: Barn
|
||||
PackageUrl: https://github.com/samson-media/barn
|
||||
License: MIT
|
||||
ShortDescription: Cross-platform job daemon for media processing
|
||||
Description: A cross-platform service for managing long-running jobs involving media download, upload, and FFmpeg processing.
|
||||
Tags:
|
||||
- cli
|
||||
- ffmpeg
|
||||
- media
|
||||
- daemon
|
||||
- job-scheduler
|
||||
ManifestType: defaultLocale
|
||||
ManifestVersion: 1.6.0
|
||||
```
|
||||
|
||||
#### Submitting to WinGet
|
||||
|
||||
1. Fork [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs)
|
||||
2. Create branch: `barn-1.2.3`
|
||||
3. Add manifest files to `manifests/s/SamsonMedia/Barn/1.2.3/`
|
||||
4. Validate: `winget validate manifests/s/SamsonMedia/Barn/1.2.3/`
|
||||
5. Create pull request
|
||||
|
||||
---
|
||||
|
||||
## Linux .deb (apt)
|
||||
|
||||
### Package Structure
|
||||
|
||||
```
|
||||
packaging/deb/
|
||||
DEBIAN/
|
||||
control
|
||||
postinst
|
||||
prerm
|
||||
conffiles
|
||||
usr/
|
||||
bin/
|
||||
barn
|
||||
lib/
|
||||
systemd/
|
||||
system/
|
||||
barn.service
|
||||
etc/
|
||||
barn/
|
||||
barn.conf
|
||||
```
|
||||
|
||||
### Control File
|
||||
|
||||
File: `packaging/deb/DEBIAN/control`
|
||||
|
||||
```
|
||||
Package: barn
|
||||
Version: 1.2.3
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Maintainer: Samson Media <support@samson-media.com>
|
||||
Description: Cross-platform job daemon for media processing
|
||||
A cross-platform service for managing long-running jobs involving
|
||||
media download, upload, and FFmpeg processing with strong guarantees
|
||||
around durability, observability, and crash recovery.
|
||||
Homepage: https://github.com/samson-media/barn
|
||||
Depends: libc6 (>= 2.31)
|
||||
```
|
||||
|
||||
### Post-Install Script
|
||||
|
||||
File: `packaging/deb/DEBIAN/postinst`
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Reload systemd
|
||||
systemctl daemon-reload
|
||||
|
||||
# Enable and start service
|
||||
systemctl enable barn.service
|
||||
systemctl start barn.service
|
||||
|
||||
echo "Barn installed successfully. Service is running."
|
||||
echo "Run 'barn status' to check job status."
|
||||
```
|
||||
|
||||
### Pre-Remove Script
|
||||
|
||||
File: `packaging/deb/DEBIAN/prerm`
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Stop and disable service
|
||||
systemctl stop barn.service || true
|
||||
systemctl disable barn.service || true
|
||||
|
||||
echo "Barn service stopped."
|
||||
```
|
||||
|
||||
### Systemd Service File
|
||||
|
||||
File: `packaging/deb/lib/systemd/system/barn.service`
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Barn Job Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/barn service run
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
### Building the .deb
|
||||
|
||||
```bash
|
||||
# Set permissions
|
||||
chmod 755 packaging/deb/DEBIAN/postinst
|
||||
chmod 755 packaging/deb/DEBIAN/prerm
|
||||
chmod 755 packaging/deb/usr/bin/barn
|
||||
|
||||
# Build package
|
||||
dpkg-deb --build packaging/deb barn-linux-x64.deb
|
||||
|
||||
# Verify
|
||||
dpkg-deb --info barn-linux-x64.deb
|
||||
https://github.com/samson-media/barn/releases/download/v1.2.3/setup-barn-v1.2.3-windows-x64.exe
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
||||
Users install directly from GitHub Releases:
|
||||
1. Download `setup-barn-vX.X.X-windows-x64.exe` from the [releases page](https://github.com/samson-media/barn/releases/latest)
|
||||
2. Run the installer (requires Administrator privileges)
|
||||
3. The installer will:
|
||||
- Install `barn.exe` to `C:\Program Files\Barn\`
|
||||
- Add Barn to the system PATH
|
||||
- Install and start the Barn Windows Service
|
||||
|
||||
```bash
|
||||
# Download
|
||||
wget https://github.com/samson-media/barn/releases/download/v1.2.3/barn-linux-x64.deb
|
||||
### Silent Installation
|
||||
|
||||
# Install
|
||||
sudo dpkg -i barn-linux-x64.deb
|
||||
For automated deployments:
|
||||
|
||||
# Or with apt (handles dependencies)
|
||||
sudo apt install ./barn-linux-x64.deb
|
||||
```powershell
|
||||
.\setup-barn-v1.2.3-windows-x64.exe /S
|
||||
```
|
||||
|
||||
### Optional: Launchpad PPA
|
||||
### Uninstallation
|
||||
|
||||
For automatic updates via apt:
|
||||
Use Windows Settings → Apps → Barn, or run:
|
||||
|
||||
1. Create account at [Launchpad](https://launchpad.net/)
|
||||
2. Create PPA: `ppa:samson-media/barn`
|
||||
3. Upload source package with `dput`
|
||||
4. Users add: `sudo add-apt-repository ppa:samson-media/barn`
|
||||
```powershell
|
||||
"C:\Program Files\Barn\uninstall.exe" /S
|
||||
```
|
||||
|
||||
### Updating
|
||||
|
||||
To update Barn on Windows:
|
||||
|
||||
1. Download the latest setup installer
|
||||
2. Run the installer - it will automatically stop the service, update the binary, and restart the service
|
||||
|
||||
---
|
||||
|
||||
## Linux PKGBUILD (pacman/AUR)
|
||||
## Linux
|
||||
|
||||
### PKGBUILD File
|
||||
Linux users install Barn by downloading the native binary directly from GitHub Releases.
|
||||
|
||||
File: `packaging/aur/PKGBUILD`
|
||||
### Download
|
||||
|
||||
Download the appropriate binary for your architecture:
|
||||
|
||||
- **x86_64**: `barn-linux-x64`
|
||||
- **ARM64**: `barn-linux-arm64`
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
# Maintainer: Samson Media <support@samson-media.com>
|
||||
pkgname=barn
|
||||
pkgver=1.2.3
|
||||
pkgrel=1
|
||||
pkgdesc="Cross-platform job daemon for media processing"
|
||||
arch=('x86_64' 'aarch64')
|
||||
url="https://github.com/samson-media/barn"
|
||||
license=('MIT')
|
||||
depends=('glibc')
|
||||
provides=('barn')
|
||||
conflicts=('barn-git')
|
||||
source_x86_64=("${pkgname}-${pkgver}-x86_64::https://github.com/samson-media/barn/releases/download/v${pkgver}/barn-linux-x64")
|
||||
source_aarch64=("${pkgname}-${pkgver}-aarch64::https://github.com/samson-media/barn/releases/download/v${pkgver}/barn-linux-arm64")
|
||||
sha256sums_x86_64=('SKIP') # Replace with actual hash
|
||||
sha256sums_aarch64=('SKIP') # Replace with actual hash
|
||||
# Download (x86_64 example)
|
||||
curl -LO https://github.com/samson-media/barn/releases/download/v1.2.3/barn-linux-x64
|
||||
|
||||
package() {
|
||||
install -Dm755 "${srcdir}/${pkgname}-${pkgver}-${CARCH}" "${pkgdir}/usr/bin/barn"
|
||||
install -Dm644 "${srcdir}/barn.service" "${pkgdir}/usr/lib/systemd/system/barn.service"
|
||||
}
|
||||
# Verify checksum
|
||||
curl -LO https://github.com/samson-media/barn/releases/download/v1.2.3/SHA256SUMS
|
||||
sha256sum -c SHA256SUMS --ignore-missing
|
||||
|
||||
# Install
|
||||
chmod +x barn-linux-x64
|
||||
sudo mv barn-linux-x64 /usr/local/bin/barn
|
||||
|
||||
# Verify
|
||||
barn --version
|
||||
```
|
||||
|
||||
### Install Script
|
||||
### Setting Up the Service
|
||||
|
||||
File: `packaging/aur/barn.install`
|
||||
After installing the binary, set up the systemd service:
|
||||
|
||||
```bash
|
||||
post_install() {
|
||||
systemctl daemon-reload
|
||||
echo ":: Run 'systemctl enable --now barn.service' to start Barn"
|
||||
}
|
||||
# Install the service
|
||||
barn service install
|
||||
|
||||
post_upgrade() {
|
||||
systemctl daemon-reload
|
||||
systemctl try-restart barn.service
|
||||
}
|
||||
# Enable and start the service
|
||||
sudo systemctl enable barn
|
||||
sudo systemctl start barn
|
||||
|
||||
pre_remove() {
|
||||
systemctl stop barn.service || true
|
||||
systemctl disable barn.service || true
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
systemctl daemon-reload
|
||||
}
|
||||
# Verify
|
||||
barn service status
|
||||
```
|
||||
|
||||
### AUR Submission
|
||||
### Updating
|
||||
|
||||
1. Create account at [AUR](https://aur.archlinux.org/)
|
||||
2. Add SSH key to account
|
||||
3. Clone AUR package base:
|
||||
```bash
|
||||
git clone ssh://aur@aur.archlinux.org/barn.git
|
||||
```
|
||||
4. Add PKGBUILD and .SRCINFO:
|
||||
```bash
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
```
|
||||
5. Commit and push:
|
||||
```bash
|
||||
git add PKGBUILD .SRCINFO barn.install
|
||||
git commit -m "Update to version 1.2.3"
|
||||
git push
|
||||
```
|
||||
To update Barn on Linux:
|
||||
|
||||
### Updating AUR Package
|
||||
|
||||
AUR updates are **automated** via GitHub Actions. See [CI/CD](ci-cd.md#aur-update-workflow) for the workflow details.
|
||||
|
||||
If manual update is needed:
|
||||
|
||||
1. Update `pkgver` in PKGBUILD
|
||||
2. Update SHA256 checksums
|
||||
3. Regenerate .SRCINFO
|
||||
4. Commit and push
|
||||
|
||||
```bash
|
||||
# Clone the AUR repo
|
||||
git clone ssh://aur@aur.archlinux.org/barn.git aur-barn
|
||||
cd aur-barn
|
||||
|
||||
# Update version
|
||||
sed -i "s/pkgver=.*/pkgver=1.2.4/" PKGBUILD
|
||||
|
||||
# Get new checksums from GitHub release
|
||||
curl -sL https://github.com/samson-media/barn/releases/download/v1.2.4/SHA256SUMS
|
||||
|
||||
# Update checksums in PKGBUILD
|
||||
# Edit sha256sums_x86_64 and sha256sums_aarch64
|
||||
|
||||
# Regenerate .SRCINFO
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
|
||||
# Commit and push
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m "Update to version 1.2.4"
|
||||
git push
|
||||
```
|
||||
|
||||
### Initial AUR Setup
|
||||
|
||||
Before the first release, create the AUR package:
|
||||
|
||||
1. **Create AUR Account**
|
||||
- Register at https://aur.archlinux.org/register/
|
||||
- Verify email and log in
|
||||
|
||||
2. **Add SSH Key**
|
||||
```bash
|
||||
ssh-keygen -t ed25519 -C "aur" -f ~/.ssh/aur
|
||||
```
|
||||
- Add public key at https://aur.archlinux.org/account/
|
||||
- Configure SSH:
|
||||
```
|
||||
# ~/.ssh/config
|
||||
Host aur.archlinux.org
|
||||
IdentityFile ~/.ssh/aur
|
||||
User aur
|
||||
```
|
||||
|
||||
3. **Create Package Base**
|
||||
```bash
|
||||
git clone ssh://aur@aur.archlinux.org/barn.git
|
||||
cd barn
|
||||
# Directory will be empty for new packages
|
||||
```
|
||||
|
||||
4. **Add Package Files**
|
||||
```bash
|
||||
# Copy PKGBUILD, barn.install, barn.service from packaging/aur/
|
||||
cp /path/to/packaging/aur/* .
|
||||
|
||||
# Generate .SRCINFO
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
|
||||
# Initial commit
|
||||
git add PKGBUILD .SRCINFO barn.install barn.service
|
||||
git commit -m "Initial package submission"
|
||||
git push
|
||||
```
|
||||
|
||||
5. **Verify Package**
|
||||
- Check https://aur.archlinux.org/packages/barn
|
||||
- Test installation:
|
||||
```bash
|
||||
yay -S barn # or paru -S barn
|
||||
```
|
||||
|
||||
### AUR Best Practices
|
||||
|
||||
- **Test locally** before pushing: `makepkg -si`
|
||||
- **Bump pkgrel** for packaging changes (same upstream version)
|
||||
- **Reset pkgrel to 1** when pkgver changes
|
||||
- **Respond to comments** on AUR package page
|
||||
- **Flag out-of-date** packages if automation fails
|
||||
|
||||
### barn-git Package (Optional)
|
||||
|
||||
For users who want the latest development version, consider maintaining a `-git` package:
|
||||
|
||||
File: `packaging/aur-git/PKGBUILD`
|
||||
|
||||
```bash
|
||||
# Maintainer: Samson Media <support@samson-media.com>
|
||||
pkgname=barn-git
|
||||
pkgver=r123.abc1234
|
||||
pkgrel=1
|
||||
pkgdesc="Cross-platform job daemon for media processing (development version)"
|
||||
arch=('x86_64' 'aarch64')
|
||||
url="https://github.com/samson-media/barn"
|
||||
license=('MIT')
|
||||
depends=('glibc')
|
||||
makedepends=('git' 'graalvm-jdk' 'gradle')
|
||||
provides=('barn')
|
||||
conflicts=('barn')
|
||||
source=("git+https://github.com/samson-media/barn.git")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
pkgver() {
|
||||
cd barn
|
||||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd barn
|
||||
./gradlew nativeCompile
|
||||
}
|
||||
|
||||
package() {
|
||||
cd barn
|
||||
install -Dm755 "build/native/nativeCompile/barn" "${pkgdir}/usr/bin/barn"
|
||||
}
|
||||
```
|
||||
1. Download the new binary from GitHub Releases
|
||||
2. Stop the service: `sudo systemctl stop barn`
|
||||
3. Replace the binary: `sudo mv barn-linux-x64 /usr/local/bin/barn`
|
||||
4. Start the service: `sudo systemctl start barn`
|
||||
|
||||
---
|
||||
|
||||
@@ -676,10 +261,8 @@ barn --version
|
||||
|
||||
After publishing a GitHub Release:
|
||||
|
||||
1. **Windows**: Submit WinGet manifest PR
|
||||
2. **Arch Linux**: Update AUR PKGBUILD
|
||||
3. **Homebrew**: Formula auto-updates via workflow
|
||||
4. **Debian**: .deb available on GitHub Releases
|
||||
1. **Homebrew**: Formula auto-updates via GitHub Actions workflow
|
||||
2. **Windows/Linux**: Binaries and setup installer available on GitHub Releases (manual download)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user