ee4468ca23
* Add Debian packaging support with cargo-deb - Add cargo-deb metadata to socktop and socktop_agent Cargo.toml - Create systemd service file for socktop_agent - Add postinst/postrm maintainer scripts for user/group management - Create GitHub Actions workflow to build .deb packages for AMD64 and ARM64 - Add comprehensive documentation in docs/DEBIAN_PACKAGING.md - Packages will be available as artifacts on every push - Automatic GitHub releases for version tags * Add summary documentation for debian packaging * fix unit test, move to macro cargo_bin! * hotfix for issue with socktop agent not creating ssl certificate on first launch after upgrade of axum server version. * Add helpful post-install message to guide users on enabling socktop-agent service * Fix CI build by installing libdrm development dependencies * Fix package rename script - cargo-deb already includes architecture in filename * Make GPU support optional to enable RISC-V builds without libdrm - Add 'gpu' feature flag (enabled by default) - Make gfxinfo dependency optional - Provide no-op GPU metrics when gpu feature disabled - Disable GPU support for RISC-V builds in CI (libdrm unavailable) - All other architectures (amd64, arm64, armhf) still get GPU support * feature gate GPU stats for arm v7 * specify correct package names. * install aarch64-linux-gnu-gcc build dep * specify correct package name * add RISC-V GCC compiler * add .cargo to gitignore to elimicate issue with riscv64-linux-gnu-gcc linker in config.toml * add gcc-arm-linux-gnueabihf linker fore armv7 * set correct x-compile lib gcc-aarch64-linux-gnu for arm64 builds. * add ports.ubuntu.com to sources * Add ARM64 as a foreign architecture * fixe for ARM64 build. * security.ubuntu.com` aNNOYING * apt repo github page * copy output to apt repo * fix secrets path * fix secrets path * change build dep * Fix postinst message box alignment * ci(deb): restrict APT publish to v* release tags Previously the workflow built and published on every push to master and feature/debian-packaging in addition to v* tags. That meant the gh-pages APT repo got overwritten on every commit with same-version .debs, causing apt clients to see a phantom "update available" each time and burning ~5-10 min of cross-compile CI per merge. After this change: - PRs into master still cross-build .debs as a sanity check. - v* tags build, publish to gh-pages, and create a GitHub release. - workflow_dispatch remains as the manual escape hatch. - master pushes no longer trigger this workflow (ci.yml still runs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.8 KiB
3.8 KiB
Debian Packaging Implementation Summary
Overview
Successfully implemented Debian packaging for socktop using cargo-deb, with GitHub Actions automation for building packages for both AMD64 and ARM64 architectures.
Branches Created
feature/debian-packaging- Main branch with debian packaging implementationfeature/man-pages- Separate branch for man pages work (to be researched further)
What Was Added
1. Cargo.toml Updates
Both socktop/Cargo.toml and socktop_agent/Cargo.toml were updated with:
[package.metadata.deb]sections- Package metadata (maintainer, description, dependencies)
- Asset definitions (binaries, documentation)
- Systemd service configuration (agent only)
2. Systemd Service
File: socktop_agent/socktop-agent.service
- Runs as
socktopuser/group - Listens on port 3000 by default
- Security hardening enabled
- Disabled by default (user must explicitly enable)
3. Maintainer Scripts
Directory: socktop_agent/debian/
postinst: Createssocktopuser/group, sets up/var/lib/socktopdirectorypostrm: Cleanup on package removal/purge
4. GitHub Actions Workflow
File: .github/workflows/build-deb.yml
Features:
- Builds for both x86_64 and ARM64
- Triggered on:
- Push to
masterorfeature/debian-packaging - Pull requests to
master - Version tags (v*)
- Manual workflow dispatch
- Push to
- Creates artifacts:
debian-packages-amd64debian-packages-arm64all-debian-packages(combined)checksums(SHA256SUMS)
- Automatic GitHub releases for version tags
5. Documentation
File: docs/DEBIAN_PACKAGING.md
Comprehensive guide covering:
- Building packages locally
- Cross-compilation for ARM64
- Installation and configuration
- Using GitHub Actions artifacts
- Creating local APT repositories
- Troubleshooting
Package Details
socktop (TUI Client)
- Binary:
/usr/bin/socktop - Size: ~3.5 MB (x86_64)
- Dependencies: Auto-detected
socktop_agent (Daemon)
- Binary:
/usr/bin/socktop_agent - Service:
socktop-agent.service - User/Group:
socktop(created automatically) - State directory:
/var/lib/socktop - Size: ~6.7 MB (x86_64)
- Dependencies: Auto-detected
Testing
Both packages successfully built locally:
✓ socktop_1.50.0-1_amd64.deb
✓ socktop-agent_1.50.1-1_amd64.deb
Verified:
- Package contents (dpkg -c)
- Package metadata (dpkg -I)
- Systemd service file inclusion
- Maintainer scripts inclusion
- Documentation inclusion
Usage
For Users
Download pre-built packages from GitHub Actions artifacts:
- Go to Actions tab
- Select latest "Build Debian Packages" run
- Download architecture-specific artifact
- Install:
sudo dpkg -i socktop*.deb
For Developers
Build locally:
cargo install cargo-deb
cargo deb --package socktop
cargo deb --package socktop_agent
Cross-compile for ARM64:
rustup target add aarch64-unknown-linux-gnu
sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
cargo deb --package socktop --target aarch64-unknown-linux-gnu
Next Steps
To get packages in official APT repositories:
- Short term: Host packages on GitHub Releases (automated)
- Medium term: Create PPA for Ubuntu users
- Long term: Submit to Debian/Ubuntu official repositories
Files Modified/Created
Modified:
socktop/Cargo.toml
socktop_agent/Cargo.toml
Created:
.github/workflows/build-deb.yml
docs/DEBIAN_PACKAGING.md
socktop_agent/socktop-agent.service
socktop_agent/debian/postinst
socktop_agent/debian/postrm
Commit
532ed16 Add Debian packaging support with cargo-deb
Resources
- cargo-deb documentation
- Debian Policy Manual
- Full documentation in
docs/DEBIAN_PACKAGING.md