Commit Graph

16 Commits

Author SHA1 Message Date
juanatsap 837e6fac9d fix: deploy waits for port 1999 to be free before starting service 2026-04-09 23:10:47 +01:00
juanatsap 482350a924 fix: load .env in production systemd service for chat API keys
- Add EnvironmentFile=/home/txeo/Git/yo/cv/.env to systemd unit
- Add production overrides (GO_ENV, BEHIND_PROXY, ALLOWED_ORIGINS)
- Deploy workflow now auto-updates systemd service file on each deploy
2026-04-09 11:04:38 +01:00
juanatsap 65454c2bba fix: Add npx fallback for lightningcss in deploy 2025-11-30 12:39:34 +00:00
juanatsap 00e28906e6 fix: Resolve CSS bundling in production and lint errors
- Fix golangci-lint errcheck errors by using t.Setenv() instead of os.Setenv()
- Add CSS bundle build step to deploy workflow for production
- Add graceful fallback to modular CSS if bundle doesn't exist
- Remove unused os import from preferences_test.go
2025-11-30 12:38:31 +00:00
root a5d369625c fix: clean untracked files before pull in deployment workflow 2025-11-10 17:22:50 +00:00
juanatsap 0f1426a2d0 fix: auto-stash local changes before git pull in deployment
- Check for uncommitted changes (both staged and unstaged)
- Auto-stash with timestamp before pulling
- Prevents "Your local changes would be overwritten" errors
- Commented-out option to reapply stash after pull if needed

Server changes are preserved in git stash for recovery if needed.

Fixes: "error: Your local changes to the following files would be overwritten by merge"
2025-10-31 12:43:35 +00:00
juanatsap 89ef1350c5 fix: fix entire repository permissions, not just .git
- Change from fixing only .git/ to fixing entire repository (.)
- Prevents "unable to unlink" errors on workflow files
- Ensures deployment user has write access to all files
- Run unconditionally as it's fast and prevents all permission issues

Fixes: "error: unable to unlink old '.github/workflows/deploy.yml': Permission denied"
2025-10-31 12:41:38 +00:00
juanatsap 7999af9107 fix: auto-fix git permissions before pull in deployment
- Check if .git/FETCH_HEAD has write permission issues
- Auto-fix with sudo chown if needed
- Prevents "Permission denied" errors during git pull
- Ensures deployment user owns .git directory

Fixes deployment error: "error: cannot open '.git/FETCH_HEAD': Permission denied"
2025-10-31 12:40:08 +00:00
juanatsap 97ab363071 refactor: use appleboy/ssh-action for reliable SSH deployment
Replace manual SSH setup with proven appleboy/ssh-action@v1.0.3
- Automatically handles SSH key formatting and permissions
- No manual key validation or cleanup needed
- Consistent with working commando-web deployment
- Pass environment variables via 'envs' parameter
- Simplifies both deploy and verify steps

This eliminates "error in libcrypto" and permission issues.
2025-10-31 12:27:46 +00:00
juanatsap cdb6cbd2b0 fix: improve SSH key handling with validation and debugging
- Use printf instead of echo for proper SSH key formatting
- Add ssh-keygen validation before attempting connection
- Show first 50 chars of key on validation failure for debugging
- Maintains proper line endings and key structure

This will help identify if the SSH_PRIVATE_KEY secret is malformed.
2025-10-31 12:26:37 +00:00
juanatsap eb920baace fix: resolve SSH key and errcheck linter issues
Deploy workflow fixes:
- Add tr -d '\r' to strip carriage returns from SSH key
- Set chmod 700 on .ssh directory for proper permissions
- Suppress ssh-keyscan stderr output

Handler code fixes:
- Check json.Encode() return values in errors.go (2 locations)
- Check json.Encode() return value in health.go
- Add log import to health.go
- Log encoding errors instead of silently ignoring

Resolves:
- "Load key: error in libcrypto" SSH deployment error
- 3 errcheck linter warnings
2025-10-31 12:23:48 +00:00
juanatsap b167378526 fix: update workflows for Go 1.25.1 and SSH deployment
Test workflow:
- Upgrade golangci-lint-action from v6 to v7
- v7 is required for golangci-lint v2.x support
- Remove skip-cache as v7 handles caching better

Deploy workflow:
- Fix SSH heredoc to use unquoted ENDSSH delimiter
- Allows environment variables to expand in remote session
- Fixes "Permission denied" by properly passing REPO_PATH and SERVICE_NAME
2025-10-31 12:20:42 +00:00
juanatsap 73155e3900 chore: add manual deployment trigger to GitHub workflow
- Added workflow_dispatch trigger to enable manual deployments from GitHub Actions UI
- Maintains existing automated deployments on main branch pushes
- Improves operational flexibility by allowing ad-hoc deployments when needed
2025-10-31 11:54:26 +00:00
root e5e09926f1 Fix deployment workflow defaults for CV project
- Set correct SERVICE_NAME default: cv
- Set correct REPO_PATH default: /home/txeo/Git/yo/cv
- Workflow now pulls code and restarts service correctly
2025-10-31 11:20:49 +00:00
juanatsap a5804936ba from mac 2025-10-31 11:06:38 +00:00
root 5e38292d2e Add GitHub Actions deployment workflow
- Add deployment workflow with test, build, and deploy jobs
- Add testing workflow for PRs
- Add deployment scripts (deploy, healthcheck, rollback)
- Add systemd service configuration
- Update Makefile with CI/CD targets
- Add comprehensive deployment documentation
2025-10-30 12:19:57 +00:00