Commit Graph
100 Commits
Author SHA1 Message Date
lukaszraczyloandGitHub bd07e45c05 Update go.mod and go.sum (#73) 2026-05-29 05:34:39 +01:00
lukaszraczyloandGitHub 69ef5a478a Update go.mod and go.sum (#72) 2026-05-28 05:33:24 +01:00
lukaszraczyloandGitHub 2b425d4012 Update go.mod and go.sum (#71) 2026-05-27 05:35:38 +01:00
lukaszraczyloandGitHub 875fd9025a Update go.mod and go.sum (#70) 2026-05-23 05:21:35 +01:00
lukaszraczyloandGitHub 1fc61b1ec3 Update go.mod and go.sum (#69) 2026-05-22 05:30:56 +01:00
lukaszraczyloandGitHub c38209d8d1 Update go.mod and go.sum (#68) 2026-05-09 05:14:14 +01:00
lukaszraczyloandGitHub 4ffb17757c Update go.mod and go.sum (#67) 2026-05-07 05:21:07 +01:00
lukaszraczyloandGitHub 5dcf1cf6b0 Update go.mod and go.sum (#66) 2026-05-05 05:08:46 +01:00
lukaszraczyloandGitHub 923651d11a Update go.mod and go.sum (#65) 2026-05-02 05:11:11 +01:00
lukaszraczyloandGitHub fedb40c826 Update go.mod and go.sum (#64) 2026-05-01 05:28:57 +01:00
lukaszraczyloandGitHub b9cd641db3 Update go.mod and go.sum (#63) 2026-04-30 05:20:27 +01:00
lukaszraczyloandGitHub ddad5883fe Update go.mod and go.sum (#62) 2026-04-27 05:19:04 +01:00
lukaszraczyloandGitHub b25dfcd263 Update go.mod and go.sum (#61) 2026-04-26 05:15:01 +01:00
lukaszraczyloandGitHub 8c85532c86 Update go.mod and go.sum (#60) 2026-04-24 05:10:16 +01:00
lukaszraczyloandGitHub 7e9b0067f1 Update go.mod and go.sum (#59) 2026-04-23 05:07:32 +01:00
lukaszraczyloandGitHub 7fb2ed6d8d Update go.mod and go.sum (#58) 2026-04-21 05:07:17 +01:00
lukaszraczyloandGitHub 65446ddbe7 Update go.mod and go.sum (#57) 2026-04-19 05:08:17 +01:00
lukaszraczyloandGitHub 205a8c0ee5 Update go.mod and go.sum (#56) 2026-04-18 05:01:42 +01:00
lukaszraczyloandGitHub 9462c66edf Update go.mod and go.sum (#55) 2026-04-17 05:07:50 +01:00
lukaszraczyloandGitHub 7c727df4f8 Update go.mod and go.sum (#54) 2026-04-16 05:08:18 +01:00
lukaszraczyloandGitHub 26fd95cea9 Update go.mod and go.sum (#53) 2026-04-10 05:06:27 +01:00
lukaszraczyloandGitHub 79c46f3b1e Update go.mod and go.sum (#52) 2026-04-09 05:01:23 +01:00
lukaszraczyloandGitHub 33f371967f Update go.mod and go.sum (#51) 2026-04-08 05:02:55 +01:00
lukaszraczyloandGitHub 7cc93d768d Update go.mod and go.sum (#50) 2026-04-07 05:02:05 +01:00
lukaszraczyloandGitHub a1b7f871bf Update go.mod and go.sum (#49) 2026-04-04 04:52:40 +01:00
lukaszraczyloandGitHub 9ee7df5f50 Update go.mod and go.sum (#48) 2026-04-03 05:00:47 +01:00
lukaszraczyloandGitHub 180254581c Update go.mod and go.sum (#47) 2026-04-01 05:08:29 +01:00
lukaszraczyloandGitHub 28752e7602 Update go.mod and go.sum (#46) 2026-03-31 05:02:26 +01:00
lukaszraczyloandGitHub d589cc0ffa Update go.mod and go.sum (#45) 2026-03-30 05:06:45 +01:00
lukaszraczyloandGitHub 97a1954a1b Update go.mod and go.sum (#44) 2026-03-28 03:52:59 +00:00
lukaszraczyloandGitHub f98ce363dd Update go.mod and go.sum (#43) 2026-03-27 04:02:11 +00:00
lukaszraczyloandGitHub f17f0b3310 Update go.mod and go.sum (#42) 2026-03-25 03:53:18 +00:00
lukaszraczyloandGitHub 140f19ed6f Update go.mod and go.sum (#41) 2026-03-24 03:53:06 +00:00
lukaszraczyloandGitHub 1e9ac2a9f2 Update go.mod and go.sum (#40) 2026-03-23 03:58:55 +00:00
lukaszraczyloandGitHub aeb67f7dd9 Update go.mod and go.sum (#39) 2026-03-22 03:54:22 +00:00
lukaszraczyloandGitHub afc0ece8d0 Update go.mod and go.sum (#38) 2026-03-21 03:48:43 +00:00
lukaszraczyloandGitHub 170d5a9f08 Update go.mod and go.sum (#37) 2026-03-19 03:56:15 +00:00
lukaszraczyloandGitHub 6e351f1a25 Update go.mod and go.sum (#35) 2026-03-17 03:53:16 +00:00
lukaszraczyloandGitHub d67cc0bf8e Update go.mod and go.sum (#34) 2026-03-14 03:51:56 +00:00
lukaszraczyloandGitHub 239b7e1f75 Update go.mod and go.sum (#33) 2026-03-13 03:51:41 +00:00
lukaszraczyloandGitHub 9f1d134d7d Update go.mod and go.sum (#32) 2026-03-12 03:52:18 +00:00
lukaszraczyloandGitHub 2dfad4f4e3 Update go.mod and go.sum (#31) 2026-03-09 03:52:49 +00:00
lukaszraczyloandGitHub defa86573e Update go.mod and go.sum (#30) 2026-03-08 03:51:16 +00:00
lukaszraczyloandGitHub 0880cc45f7 Update go.mod and go.sum (#29) 2026-03-07 03:45:21 +00:00
lukaszraczyloandGitHub 0c2dc0795a Update go.mod and go.sum (#28) 2026-03-06 03:51:06 +00:00
lukaszraczyloandGitHub af81f6c99b Update go.mod and go.sum (#27) 2026-03-04 03:51:01 +00:00
lukaszraczyloandGitHub a46af4b645 Update go.mod and go.sum (#26) 2026-03-01 03:56:38 +00:00
lukaszraczyloandGitHub fe3c0ebb63 Update go.mod and go.sum (#25) 2026-02-28 03:41:31 +00:00
lukaszraczyloandGitHub b3e15180af Update go.mod and go.sum (#24) 2026-02-27 03:51:56 +00:00
lukaszraczyloandGitHub 6735ed2071 Update go.mod and go.sum (#23) 2026-02-26 03:53:37 +00:00
lukaszraczyloandGitHub 2f379efc83 Update go.mod and go.sum (#22) 2026-02-25 03:53:35 +00:00
lukaszraczyloandGitHub 5f8e3b4dee Update go.mod and go.sum (#20) 2026-02-24 03:53:21 +00:00
lukaszraczyloandGitHub 0704a3b7c8 Update go.mod and go.sum (#19) 2026-02-21 03:49:36 +00:00
lukaszraczyloandGitHub b22129fcba Update go.mod and go.sum (#18) 2026-02-19 03:54:06 +00:00
lukaszraczyloandGitHub 210602566e Update go.mod and go.sum (#17) 2026-02-18 03:54:48 +00:00
lukaszraczyloandGitHub 1e39f9f2f4 Update go.mod and go.sum (#16) 2026-02-17 03:52:41 +00:00
lukaszraczyloandGitHub a98ee60d8b Update go.mod and go.sum (#15) 2026-02-11 04:01:31 +00:00
lukaszraczyloandGitHub 1293ca4f9d Update go.mod and go.sum (#13) 2026-02-10 04:03:22 +00:00
lukaszraczyloandGitHub 2e95518d48 Update go.mod and go.sum (#12) 2026-02-09 03:59:00 +00:00
lukaszraczyloandGitHub 0388d99d9e Update go.mod and go.sum (#11) 2026-02-02 03:56:15 +00:00
lukaszraczyloandGitHub 113564b497 Update go.mod and go.sum (#10) 2026-02-01 04:02:13 +00:00
lukaszraczyloandGitHub b78e6e79e3 Update go.mod and go.sum (#9) 2026-01-30 03:50:54 +00:00
lukaszraczyloandGitHub 3b26752e3c Update go.mod and go.sum (#8) 2026-01-29 03:51:11 +00:00
lukaszraczyloandGitHub ec3312d836 Update go.mod and go.sum (#7) 2026-01-25 03:40:38 +00:00
lukaszraczyloandGitHub f1913087e4 Update go.mod and go.sum (#6) 2026-01-19 03:40:28 +00:00
lukaszraczyloandGitHub eae3e33e7e Update go.mod and go.sum (#5) 2026-01-17 03:35:25 +00:00
lukaszraczyloandGitHub 2e8baad645 Update go.mod and go.sum (#4) 2026-01-13 03:37:10 +00:00
lukaszraczyloandGitHub e6f127cf9e Update go.mod and go.sum (#3) 2026-01-10 03:35:57 +00:00
lukaszraczyloandGitHub a1e16c989b Update go.mod and go.sum (#2) 2026-01-09 03:37:04 +00:00
lukaszraczyloandGitHub 955250650e Update go.mod and go.sum (#1) 2026-01-06 03:36:44 +00:00
lukaszraczylo 85c76150f5 fixup! fix: remove missing logo reference from Helm chart 2026-01-04 14:47:27 +00:00
lukaszraczylo 1baf0993de fix: remove missing logo reference from Helm chart
The referenced logo file (docs/logo.png) doesn't exist, causing
Artifact Hub to fail with 404 errors when indexing the chart.

Commented out the icon line until a logo is created.

Resolves: "error getting logo image https://raw.githubusercontent.com/
lukaszraczylo/gohoarder/main/docs/logo.png: unexpected status code
received: 404"
2026-01-04 14:25:57 +00:00
lukaszraczylo 434a15076e fix: generate continuous time series data with zero-filled gaps for charts
Issues fixed:
1. Charts not rendering correctly due to sparse data (missing time buckets)
2. Period "1h" returning empty data when aggregate stats not yet available

Changes:
- Generate continuous time series with 0 values for all time buckets
- Truncate start time to hour/day boundaries for consistent bucketing
- Fallback to package-level stats aggregation when registry totals unavailable
- Add proper time range filtering (since <= time_bucket <= now)

Behavior now:
- All time periods (1h, 1day, 7day, 30day) return complete data sets
- Missing hours/days are filled with value: 0
- Chart libraries can render continuous lines/bars correctly
- No more empty data for "1h" period

Example output (1 hour period):
Before: [{"timestamp":"14:00","value":5}, {"timestamp":"15:00","value":3}]
After:  [{"timestamp":"13:00","value":0}, {"timestamp":"14:00","value":5},
         {"timestamp":"15:00","value":3}, {"timestamp":"16:00","value":0}]

Resolves: "Chart doesn't generate correctly - it should automatically
fill 0 for the empty periods to render correctly"
2026-01-04 14:23:08 +00:00
lukaszraczylo 4e7350363d feat: track download counts for both cache hits and cache misses
Previously, download counts only incremented on cache hits (when package
was served from cache). First-time downloads (cache misses) were not counted.

Changes:
- Add UpdateDownloadCount() call when serving newly cached packages
- This ensures every download through the proxy increments the counter
- Analytics tracking also added for cache misses

Behavior now:
- First download (cache miss): counter = 1
- Second download (cache hit): counter = 2
- Third download (cache hit): counter = 3
- etc.

Updated all relevant tests to expect the additional UpdateDownloadCount call.

Resolves user requirement: "I want the counters to increase whenever
package is downloaded via proxy - regardless of it being new download
or cached download"
2026-01-04 13:50:42 +00:00
lukaszraczylo 38edd735b6 fix: improve download statistics tracking resilience
Problem:
- Download counts were not incrementing when packages existed in storage
  but not in the database (e.g., after database migration/reset)
- UpdateDownloadCount() was failing silently when package didn't exist in DB
- Error was completely ignored despite comment claiming "error logged"

Changes:
1. Log errors when UpdateDownloadCount() fails instead of silently ignoring
2. Auto-save package to database if UpdateDownloadCount() fails
3. Retry download count update after saving package
4. Provide detailed error logging for troubleshooting

This fixes the issue where:
- Database is migrated but storage still has cached packages
- Cache hits occur but download events aren't recorded
- Statistics show zero downloads despite actual usage

Resolves user report: "I cleaned go mod which redownloaded the modules
through the proxy but counters did not increased"
2026-01-04 13:44:36 +00:00
lukaszraczylo c207aa72e9 fix: accept GitHub API rate limits in GHSA health check
- Rate limits (403) are now accepted as healthy
- Rate limiting is expected without a GitHub token
- Only real errors (network failures, 500s) fail the health check
- Prevents health check failures due to unauthenticated API usage

Related: GHSA scanner health checks
2026-01-04 13:33:49 +00:00
lukaszraczylo bf0925a4fc fix: return degraded status for scanner health check failures
- Scanner failures (e.g., GitHub API rate limits) no longer mark server as unhealthy
- Server can still serve cached packages when scanners are unavailable
- Readiness probes will now pass with degraded scanner status
- Prevents unnecessary pod restarts due to external API issues

Fixes: Readiness probes failing with 503 due to GHSA rate limiting
2026-01-04 13:33:10 +00:00
lukaszraczylo bc854aa183 perf: remove nginx rate limiting for internal package proxy
- Removed rate limiting zones (10r/s for API, 5r/s for downloads)
- Internal package proxy doesn't need rate limiting
- During builds, package managers make hundreds of concurrent requests
- Rate limiting was causing unnecessary delays and potential 429 errors

This improves build performance significantly for CI/CD pipelines
2026-01-04 13:09:18 +00:00
lukaszraczylo c4bb2f6e3a fix: clean Go module paths before calling OSV API
- OSV API expects clean module paths like 'gorm.io/driver/sqlite'
- Cache keys include Go proxy format like 'gorm.io/driver/sqlite/@v/v1.6.0.zip'
- Added cleanGoModuleName() to extract module path and version
- Strips /@v/ prefix and .zip/.mod/.info suffixes
- Fixes 404 errors when scanning Go modules

Resolves: OSV API returning 404 for Go module scans
2026-01-04 13:07:31 +00:00
lukaszraczylo 8848656193 fix: preserve /api prefix in nginx reverse proxy
- Changed proxy_pass from http://backend/ to http://backend
- Trailing slash was stripping /api prefix causing 404 errors
- Backend expects /api/stats not /stats
2026-01-04 03:55:40 +00:00
lukaszraczylo 3ecff61114 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 03:18:49 +00:00
lukaszraczylo f86943b884 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 02:48:28 +00:00
lukaszraczylo 448bb70ac8 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 02:17:11 +00:00
lukaszraczylo d63ae21133 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 02:01:24 +00:00
lukaszraczylo f71414bbb1 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:37:57 +00:00
lukaszraczylo bdcacfc8db fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:32:12 +00:00
lukaszraczylo a36080c6de fixup! fixup! fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:24:14 +00:00
lukaszraczylo 0e6510636d fixup! fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:20:27 +00:00
lukaszraczylo 276d406fb6 fixup! fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:16:13 +00:00
lukaszraczylo fb79d82072 fixup! fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:13:41 +00:00
lukaszraczylo bbcbeeaf88 fixup! fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:11:26 +00:00
lukaszraczylo 9f4d8fc777 fixup! fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:08:55 +00:00
lukaszraczylo 1f781f6620 fixup! perf: build frontend once on runner instead of in Docker 2026-01-04 01:01:53 +00:00
lukaszraczylo 8a9d786b1a perf: build frontend once on runner instead of in Docker
- [x] Remove Docker compilation from server, scanner, migrate Dockerfiles
- [x] Use pre-built binaries injected by GoReleaser instead
- [x] Delete separate gateway container and merge into frontend
- [x] Update .goreleaser.yaml to reference pre-built binaries
- [x] Simplify Kubernetes deployment to remove gateway service
- [x] Simplify docker-compose to remove gateway container
- [x] Add backend proxy configuration to frontend
2026-01-04 00:53:44 +00:00
lukaszraczylo e1a02a6d69 perf: build frontend once on runner instead of in Docker
MAJOR PERFORMANCE IMPROVEMENT: Reduced frontend Docker build time
from ~20 minutes to ~30 seconds by building the SPA once on the
runner instead of twice (amd64 + arm64) in Docker.

Changes:
1. Release workflow now builds frontend on CI runner (native, fast)
2. Frontend artifact uploaded and downloaded in release job
3. Dockerfile.frontend simplified to just copy pre-built files
4. Multi-arch Docker build is now just copying files into nginx

Before:
- Docker builds frontend 2x (amd64 + arm64 with QEMU emulation)
- Each: pnpm install + pnpm build = ~10 min per arch
- Total: ~20 minutes for frontend image

After:
- Build frontend 1x on runner = ~2 min (native)
- Docker just copies files = ~30 sec (both architectures)
- Total: ~2.5 minutes for frontend image

Impact:
- 8x faster frontend builds
- Total release time reduced from ~25 min to ~7 min
- Lower resource usage (no QEMU emulation)

Files changed:
- .github/workflows/release.yaml: Enable node build
- Dockerfile.frontend: Remove build stage, expect pre-built files
- .goreleaser.yaml: Copy frontend/dist instead of full source
2026-01-04 00:33:47 +00:00
lukaszraczylo 5c8565367c refactor: merge gateway functionality into frontend container
Eliminated duplicate nginx containers by merging gateway reverse proxy
functionality into the frontend container. This simplifies deployment
and reduces resource usage.

Architecture changes:
- Frontend now serves both static files AND reverse proxies to backend
- Single nginx container handles all HTTP routing
- Gateway container removed from builds and Helm chart

Dockerfile.frontend changes:
- Added upstream backend configuration
- Added proxy locations for /api, /health, /metrics, /npm, /pypi, /go, /ws
- Added rate limiting for API and downloads
- Added WebSocket support
- Configurable via BACKEND_HOST and BACKEND_PORT env vars

Helm chart changes:
- Updated frontend deployment to configure backend connection
- Simplified ingress to single route (all traffic → frontend)
- Frontend proxies backend requests internally
- Removed separate frontend/api ingress configurations

GoReleaser changes:
- Removed gohoarder-gateway Docker build
- Now builds: server, scanner, migrate, frontend (4 images)

Benefits:
- Fewer containers to manage
- Reduced complexity in Docker Compose and Kubernetes
- Single point of configuration for routing
- Better resource utilization
2026-01-04 00:30:20 +00:00
lukaszraczylo 9db929ed8b fix: remove hardcoded platform args causing wrong architecture builds
CRITICAL FIX: arm64 images were getting amd64 binaries causing
"exec format error" when running on ARM platforms.

Root cause:
- Dockerfiles had ARG TARGETOS=linux and ARG TARGETARCH=amd64
- FROM --platform=$TARGETOS/$TARGETARCH used these defaults
- buildx couldn't override them, so all builds used amd64

Solution:
- Removed --platform from FROM statement
- Let buildx automatically handle platform selection
- Declared ARGs AFTER FROM to receive buildx values
- buildx automatically sets TARGETPLATFORM, TARGETOS, TARGETARCH

Now each platform builds native binaries:
- linux/amd64 → amd64 binary
- linux/arm64 → arm64 binary

This fixes: exec /usr/local/bin/migrate: exec format error
2026-01-04 00:05:08 +00:00
lukaszraczylo 0a2c5f6c2c fix: update Dockerfiles to use Go 1.25 to match go.mod requirement
go.mod requires go >= 1.25.5 but Dockerfiles were using golang:1.23-alpine.
Updated all Go-based Dockerfiles to use golang:1.25-alpine.

Affected files:
- Dockerfile.server
- Dockerfile.scanner
- Dockerfile.migrate

This fixes the build error:
"go: go.mod requires go >= 1.25.5 (running go 1.23.12; GOTOOLCHAIN=local)"
2026-01-03 23:50:55 +00:00
lukaszraczylo ae632a3dd7 fix: add extra_files to copy source directories into Docker build context
GoReleaser creates a temporary build context with only binaries, but our
Dockerfiles are multi-stage builds that need the full source code to
compile. Added extra_files to copy necessary directories.

Files copied per image:
- gohoarder-server: go.mod, go.sum, cmd, pkg, internal, config
- gohoarder-scanner: go.mod, go.sum, cmd, pkg, internal, config
- gohoarder-migrate: go.mod, go.sum, cmd, pkg, internal, migrations
- gohoarder-frontend: frontend/ directory (Node.js source)
- gohoarder-gateway: no extra files needed (static config)

This fixes the build context error:
"Seems like you tried to copy a file that is not available in the
build context."
2026-01-03 23:41:13 +00:00
lukaszraczylo c212077478 refactor: rebuild GoReleaser configuration with dockers_v2
Completely rebuilt GoReleaser Pro configuration using modern dockers_v2
syntax to fix Docker build issues. All Dockerfiles are self-contained
multi-stage builds that compile their own binaries.

Key changes:
- Migrated from deprecated 'dockers' to 'dockers_v2'
- Removed 'use: buildx' (implicit in dockers_v2)
- Changed 'image_templates' to 'images' + 'tags' structure
- Replaced 'build_flag_templates' with 'build_args' + 'flags'
- Removed incorrect 'extra_files' that caused build context errors
- Added 'platforms' for multi-arch support (linux/amd64, linux/arm64)

Binary builds:
- gohoarder: darwin/arm64, linux/amd64 (CGO enabled)
- migrate: darwin/arm64, linux/amd64 (CGO enabled)
- linux/arm64 binaries skipped (Docker provides multi-arch)

Docker images (all self-building):
- gohoarder-server (Go multi-stage build)
- gohoarder-scanner (Go multi-stage build)
- gohoarder-migrate (Go multi-stage build)
- gohoarder-frontend (Node.js multi-stage build)
- gohoarder-gateway (Nginx static config)
2026-01-03 23:34:10 +00:00