Commit Graph

23 Commits

Author SHA1 Message Date
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
juanatsap 0be8972429 fix: Skip PDF integration tests in CI
PDF generation tests require a running HTTP server for chromedp to connect to.
This is not available in CI environment, causing tests to fail with ERR_CONNECTION_REFUSED.

Changes:
- Added skip condition to TestDefaultCVShortcut when running in short mode
- Updated CI workflow to use -short flag for tests and benchmarks
- Removed Chrome installation from CI (not needed for unit tests)
- Integration tests can still run locally without -short flag
2025-11-25 06:10:26 +00:00
juanatsap 295a9948f7 fix: PDF tests data file loading and Chrome installation in CI
- Add findDataFile() helper to search up directory tree for data files
- Fixes tests running from subdirectories (internal/handlers)
- Install Chrome in GitHub Actions for PDF generation tests

This resolves test failures that have existed since PDF tests were introduced:
- Error: 'open data/cv-es.json: no such file or directory'
- Error: 'chrome failed to start'

Tests now properly locate data files from any working directory and
have Chrome available for PDF generation in CI environment.
2025-11-20 13:44:31 +00:00
juanatsap 92dffe8c60 feat: add comprehensive testing infrastructure and security hardening
- Enhanced CI/CD pipeline with coverage reporting, benchmarks, and artifact uploads
- Implemented rate limiter IP validation with proxy support and spoofing protection
- Added extensive Makefile test targets for coverage, benchmarks, and continuous testing
- Expanded middleware chain with request validation, size limits, and suspicious activity logging
2025-11-11 21:43:12 +00:00
root a5d369625c fix: clean untracked files before pull in deployment workflow 2025-11-10 17:22:50 +00:00
juanatsap fbb8d2fa25 chore: add issue template config to redirect to CONTRIBUTING.md 2025-11-09 14:25:57 +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 c88d0f0f45 fix: use golangci-lint v2.6.0 for Go 1.25.1 compatibility
- Update golangci-lint from v1.65.1 to v2.6.0
- v2.6.0 is built with Go 1.25 and supports Go 1.25.1
- Resolves 404 error from non-existent v1.65.1 release
2025-10-31 12:13:54 +00:00
juanatsap 7fd5090d65 chore: update Go version requirements in CI workflow
- Update matrix Go version from 1.25 to 1.25.1 to match go.mod
- Specify golangci-lint v1.65.1 explicitly (supports Go 1.25+)
- Add skip-cache to force fresh download and avoid cached v1.64.8
2025-10-31 12:08:05 +00:00
juanatsap cccae3b408 fix: upgrade golangci-lint action to v6 for Go 1.25.1 support
- Update golangci-lint-action from v3 to v6
- Remove redundant cache skip flags (v6 has better defaults)
- Fixes compatibility with Go 1.25.1 specified in go.mod
2025-10-31 12:02:11 +00:00
juanatsap 6d154331d2 chore: update Go version requirements in CI workflow
- Removed Go 1.24 from test matrix to only run tests against Go 1.25
- Simplified CI configuration by focusing on latest stable Go version
2025-10-31 11:59:34 +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