@@ -0,0 +1,275 @@ |
| 1 | +# Fortress Deployment Guide |
| 2 | + |
| 3 | +This guide covers deploying fortress to AUR, Homebrew, and repos.musicsian.com. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +### For RPM builds |
| 8 | +- `rpmbuild` (install via `dnf install rpm-build`) |
| 9 | +- `fpm` (Fortran Package Manager) - install via `cargo install fpm` |
| 10 | +- `createrepo_c` (for repository metadata) |
| 11 | +- GPG key configured for signing |
| 12 | + |
| 13 | +### For AUR |
| 14 | +- AUR account with SSH key configured |
| 15 | +- `makepkg` (part of Arch Linux base-devel) |
| 16 | +- `updpkgsums` (to update checksums) |
| 17 | + |
| 18 | +### For Homebrew |
| 19 | +- Homebrew tap repository (or PR to homebrew-core) |
| 20 | +- Access to create GitHub releases |
| 21 | + |
| 22 | +## 1. AUR Deployment |
| 23 | + |
| 24 | +The AUR package is already configured in this repository. |
| 25 | + |
| 26 | +### Initial Setup (One-time) |
| 27 | + |
| 28 | +```bash |
| 29 | +# Clone your AUR repository |
| 30 | +git clone ssh://aur@aur.archlinux.org/fortress.git fortress-aur |
| 31 | +cd fortress-aur |
| 32 | + |
| 33 | +# Copy files from fortress repo |
| 34 | +cp /path/to/fortress/{PKGBUILD,.SRCINFO,fortress.install} . |
| 35 | +``` |
| 36 | + |
| 37 | +### Deploying Updates |
| 38 | + |
| 39 | +```bash |
| 40 | +cd fortress-aur |
| 41 | + |
| 42 | +# Update version in PKGBUILD |
| 43 | +vim PKGBUILD # Update pkgver and pkgrel |
| 44 | + |
| 45 | +# Generate checksums |
| 46 | +updpkgsums |
| 47 | + |
| 48 | +# Generate .SRCINFO |
| 49 | +makepkg --printsrcinfo > .SRCINFO |
| 50 | + |
| 51 | +# Test build locally |
| 52 | +makepkg -si |
| 53 | + |
| 54 | +# Push to AUR |
| 55 | +git add PKGBUILD .SRCINFO fortress.install |
| 56 | +git commit -m "Update fortress to version X.Y.Z" |
| 57 | +git push |
| 58 | +``` |
| 59 | + |
| 60 | +**Notes:** |
| 61 | +- Shell integration is automatic for bash and fish |
| 62 | +- Zsh users need to manually source `/usr/share/fortress/fortress.sh` |
| 63 | +- The `fortress.install` file shows post-install messages to users |
| 64 | + |
| 65 | +## 2. Homebrew Deployment |
| 66 | + |
| 67 | +Homebrew formulas can be deployed via a tap or submitted to homebrew-core. |
| 68 | + |
| 69 | +### Option A: Personal Tap (Easier) |
| 70 | + |
| 71 | +```bash |
| 72 | +# Create a tap repository (first time only) |
| 73 | +# Repository name must be: homebrew-<tapname> |
| 74 | +# Example: homebrew-fortran |
| 75 | + |
| 76 | +git clone https://github.com/yourusername/homebrew-fortran |
| 77 | +cd homebrew-fortran |
| 78 | + |
| 79 | +# Copy the formula |
| 80 | +cp /path/to/fortress/fortress.rb Formula/ |
| 81 | + |
| 82 | +# Create a GitHub release first with the tarball |
| 83 | +# Update the sha256 in fortress.rb: |
| 84 | +shasum -a 256 fortress-0.1.0.tar.gz |
| 85 | + |
| 86 | +# Commit and push |
| 87 | +git add Formula/fortress.rb |
| 88 | +git commit -m "Add fortress 0.1.0" |
| 89 | +git push |
| 90 | + |
| 91 | +# Users install with: |
| 92 | +# brew tap yourusername/fortran |
| 93 | +# brew install fortress |
| 94 | +``` |
| 95 | + |
| 96 | +### Option B: Submit to homebrew-core (Official) |
| 97 | + |
| 98 | +1. Fork https://github.com/Homebrew/homebrew-core |
| 99 | +2. Add `fortress.rb` to `Formula/` |
| 100 | +3. Submit a PR following Homebrew guidelines |
| 101 | +4. Wait for review and approval |
| 102 | + |
| 103 | +**Notes:** |
| 104 | +- Homebrew **cannot** automatically modify user dotfiles |
| 105 | +- Users must manually source the shell integration files |
| 106 | +- The caveats block provides clear installation instructions |
| 107 | +- Shell integration files are installed to `#{HOMEBREW_PREFIX}/share/fortress/` |
| 108 | + |
| 109 | +### Updating the Formula |
| 110 | + |
| 111 | +```bash |
| 112 | +# Update version and sha256 |
| 113 | +vim Formula/fortress.rb |
| 114 | + |
| 115 | +# Test locally |
| 116 | +brew install --build-from-source ./Formula/fortress.rb |
| 117 | +brew test fortress |
| 118 | +brew audit --strict fortress |
| 119 | + |
| 120 | +# Commit and push |
| 121 | +git add Formula/fortress.rb |
| 122 | +git commit -m "fortress 0.2.0" |
| 123 | +git push |
| 124 | +``` |
| 125 | + |
| 126 | +## 3. RPM Repository (repos.musicsian.com) |
| 127 | + |
| 128 | +### Build the RPM |
| 129 | + |
| 130 | +```bash |
| 131 | +cd /home/espadon/src/fortress |
| 132 | + |
| 133 | +# Ensure fpm is installed |
| 134 | +cargo install fpm # If not already installed |
| 135 | + |
| 136 | +# Build the RPM |
| 137 | +./build-rpm.sh |
| 138 | +``` |
| 139 | + |
| 140 | +This script will: |
| 141 | +1. Create a source tarball |
| 142 | +2. Build the RPM using rpmbuild |
| 143 | +3. Output RPMs to `~/rpmbuild/RPMS/` |
| 144 | + |
| 145 | +### Deploy to Repository |
| 146 | + |
| 147 | +```bash |
| 148 | +cd /home/espadon/src/fortress |
| 149 | + |
| 150 | +# Copy RPM to repo and prepare deployment |
| 151 | +./deploy-to-repo.sh |
| 152 | + |
| 153 | +# Change to repo directory |
| 154 | +cd ~/src/repos-musicsian-com |
| 155 | + |
| 156 | +# Add and commit |
| 157 | +git add RPMS/fortress-*.rpm fortress.repo |
| 158 | +git commit -m "Add fortress 0.1.0-1" |
| 159 | +git push |
| 160 | + |
| 161 | +# Deploy to server (signs RPMs, creates metadata, updates site) |
| 162 | +./deploy.sh |
| 163 | +``` |
| 164 | + |
| 165 | +The `deploy.sh` script will: |
| 166 | +1. Stage files to a timestamped build directory |
| 167 | +2. Sign all RPM packages with GPG |
| 168 | +3. Generate repository metadata with createrepo_c |
| 169 | +4. Sign repository metadata |
| 170 | +5. Deploy to `/var/www/repos.musicsian.com/releases/` |
| 171 | +6. Update the `current` symlink |
| 172 | +7. Reload nginx |
| 173 | +8. Test the deployment |
| 174 | + |
| 175 | +### User Installation |
| 176 | + |
| 177 | +Users can install from your repo with: |
| 178 | + |
| 179 | +```bash |
| 180 | +# Add the repository |
| 181 | +sudo curl -o /etc/yum.repos.d/fortress.repo https://repos.musicsian.com/fortress.repo |
| 182 | + |
| 183 | +# Install fortress |
| 184 | +sudo dnf install fortress |
| 185 | + |
| 186 | +# The shell integration is automatic for bash and fish |
| 187 | +# Zsh users need to add to ~/.zshrc: |
| 188 | +source /usr/share/fortress/fortress.sh |
| 189 | +``` |
| 190 | + |
| 191 | +## Shell Integration Comparison |
| 192 | + |
| 193 | +| Package Manager | Bash | Fish | Zsh | |
| 194 | +|----------------|------|------|-----| |
| 195 | +| AUR | ✅ Auto | ✅ Auto | ⚠️ Manual | |
| 196 | +| Homebrew | ⚠️ Manual | ⚠️ Manual | ⚠️ Manual | |
| 197 | +| RPM | ✅ Auto | ✅ Auto | ⚠️ Manual | |
| 198 | + |
| 199 | +**Auto**: Shell integration is automatically set up during installation |
| 200 | +**Manual**: User must manually source the integration file |
| 201 | + |
| 202 | +## Version Bumping Checklist |
| 203 | + |
| 204 | +When releasing a new version: |
| 205 | + |
| 206 | +- [ ] Update version in `fpm.toml` |
| 207 | +- [ ] Update version in `fortress.spec` (RPM) |
| 208 | +- [ ] Update version in `PKGBUILD` (AUR) |
| 209 | +- [ ] Update version in `fortress.rb` (Homebrew) |
| 210 | +- [ ] Create GitHub release with tarball |
| 211 | +- [ ] Update SHA256 checksums: |
| 212 | + - [ ] `updpkgsums` for AUR |
| 213 | + - [ ] Manual update in Homebrew formula |
| 214 | +- [ ] Update changelog in `fortress.spec` |
| 215 | +- [ ] Test build on all platforms |
| 216 | +- [ ] Deploy in order: AUR → RPM → Homebrew |
| 217 | + |
| 218 | +## Troubleshooting |
| 219 | + |
| 220 | +### RPM Build Fails - "fpm: command not found" |
| 221 | + |
| 222 | +```bash |
| 223 | +cargo install fpm |
| 224 | +# Add to PATH if needed: |
| 225 | +export PATH="$HOME/.cargo/bin:$PATH" |
| 226 | +``` |
| 227 | + |
| 228 | +### AUR Build Fails - Checksum Mismatch |
| 229 | + |
| 230 | +```bash |
| 231 | +updpkgsums # Regenerate checksums |
| 232 | +makepkg --printsrcinfo > .SRCINFO |
| 233 | +``` |
| 234 | + |
| 235 | +### Homebrew Install Fails - Binary Not Found |
| 236 | + |
| 237 | +Check that the glob pattern in `fortress.rb` matches your build output: |
| 238 | +```ruby |
| 239 | +built_binary = Dir["build/gfortran_*/app/fortress"].first |
| 240 | +``` |
| 241 | + |
| 242 | +### Shell Integration Not Working |
| 243 | + |
| 244 | +Make sure users restart their shell or source the integration file: |
| 245 | +```bash |
| 246 | +# Bash |
| 247 | +source /etc/profile.d/fortress.sh # RPM |
| 248 | +source /usr/share/fortress/fortress.sh # AUR |
| 249 | +source $(brew --prefix)/share/fortress/fortress.sh # Homebrew |
| 250 | + |
| 251 | +# Fish |
| 252 | +source /usr/share/fish/vendor_functions.d/fortress.fish # RPM/AUR |
| 253 | +source $(brew --prefix)/share/fortress/fortress.fish # Homebrew |
| 254 | +``` |
| 255 | + |
| 256 | +## Automation Ideas |
| 257 | + |
| 258 | +Consider setting up: |
| 259 | +- GitHub Actions to automatically build and test on releases |
| 260 | +- Automatic AUR updates via CI/CD |
| 261 | +- Homebrew bump-formula-pr for version updates |
| 262 | +- RPM builds in CI with artifact upload |
| 263 | + |
| 264 | +## Notes on Homebrew Shell Integration |
| 265 | + |
| 266 | +Homebrew **cannot** automatically set up shell integration because: |
| 267 | +1. Homebrew formulas run in a sandbox |
| 268 | +2. Writing to user home directories is not allowed |
| 269 | +3. System-wide profile.d directories vary by OS (macOS vs Linux) |
| 270 | + |
| 271 | +This is why the `caveats` block is important - it provides clear instructions users will see after installation. |
| 272 | + |
| 273 | +## License |
| 274 | + |
| 275 | +MIT - See LICENSE file for details |