gohoarder

by raczylo-com

Helm chartv0.1.400App 0.1.400MITVerified publisher

A universal package cache proxy supporting npm, PyPI, and Go modules with security scanning

About this chart

GoHoarder Helm Chart

A universal package cache proxy supporting npm, PyPI, and Go modules with integrated security scanning.

Features

  • Multi-Registry Support: Proxy for npm, PyPI, and Go modules
  • Security Scanning: Integrated vulnerability scanning with multiple scanners
  • Flexible Storage: Support for filesystem, S3, and SMB storage backends
  • Metadata Storage: SQLite or PostgreSQL for metadata
  • Auto-Configuration: Generates configuration from Helm values
  • Production Ready: Includes health checks, resource limits, and security contexts

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.0+
  • PV provisioner support in the underlying infrastructure (for persistent storage)

Installation

Add Helm Repository

helm repo add gohoarder https://lukaszraczylo.github.io/gohoarder
helm repo update

Install Chart

# Install with default values
helm install gohoarder gohoarder/gohoarder

# Install with custom values
helm install gohoarder gohoarder/gohoarder -f values.yaml

# Install in a specific namespace
helm install gohoarder gohoarder/gohoarder -n gohoarder --create-namespace

Quick Start Examples

Minimal Installation

helm install gohoarder gohoarder/gohoarder \
  --set global.domain=example.com \
  --set ingress.enabled=true

With Security Scanning

helm install gohoarder gohoarder/gohoarder \
  --set security.enabled=true \
  --set security.scanners.trivy.enabled=true \
  --set security.scanners.osv.enabled=true

With S3 Storage

helm install gohoarder gohoarder/gohoarder \
  --set storage.backend=s3 \
  --set storage.s3.bucket=my-bucket \
  --set storage.s3.region=us-east-1 \
  --set storage.s3.accessKeyId=AKIAIOSFODNN7EXAMPLE \
  --set storage.s3.secretAccessKey=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

With Private Container Registry

If using images from a private registry, create an image pull secret and reference it:

# Create a Docker registry secret
kubectl create secret docker-registry ghcr-secret \
  --docker-server=ghcr.io \
  --docker-username=<your-username> \
  --docker-password=<your-token> \
  --docker-email=<your-email> \
  -n gohoarder

# Install with the secret
helm install gohoarder gohoarder/gohoarder \
  --set global.imagePullSecrets[0].name=ghcr-secret \
  -n gohoarder

Or using a values file to reference existing secrets:

global:
  imagePullSecrets:
    - name: ghcr-secret
    - name: dockerhub-secret  # Multiple secrets supported

Auto-create secrets (chart will create them for you):

imageCredentials:
  ghcr-secret:
    registry: ghcr.io
    username: myusername
    password: mytoken
    email: [email protected]

global:
  imagePullSecrets:
    - name: ghcr-secret

Note: Storing credentials in values files is less secure than creating secrets manually. Consider using external secret management solutions like Sealed Secrets or External Secrets Operator for production.

Configuration Methods

GoHoarder supports two configuration methods that can be used together:

1. ConfigMap (Default)

The chart automatically generates a config.yaml from Helm values and mounts it as a ConfigMap. This is the default approach and works out of the box.

2. Environment Variables

You can override any configuration using environment variables with the format GOHOARDER_<CONFIG_KEY> where dots are replaced with underscores.

Example using values file:

server:
  env:
    - name: GOHOARDER_STORAGE_BACKEND
      value: "s3"
    - name: GOHOARDER_STORAGE_S3_BUCKET
      value: "my-bucket"
    # Reference secrets for sensitive data
    - name: GOHOARDER_STORAGE_S3_SECRET_ACCESS_KEY
      valueFrom:
        secretKeyRef:
          name: aws-credentials
          key: secret-access-key
    - name: GOHOARDER_METADATA_POSTGRESQL_PASSWORD
      valueFrom:
        secretKeyRef:
          name: postgres-secret
          key: password

Example using command line:

helm install gohoarder gohoarder/gohoarder \
  --set server.env[0].name=GOHOARDER_STORAGE_BACKEND \
  --set server.env[0].value=s3 \
  --set server.env[1].name=GOHOARDER_LOGGING_LEVEL \
  --set server.env[1].value=debug

Benefits of environment variables:

  • Better integration with Kubernetes secrets
  • Override specific values without modifying ConfigMap
  • Support for secret references (no plain-text passwords)
  • Compatible with external secret management (External Secrets Operator, Sealed Secrets)

Common environment variable mappings:

Config PathEnvironment Variable
storage.backendGOHOARDER_STORAGE_BACKEND
storage.s3.bucketGOHOARDER_STORAGE_S3_BUCKET
storage.s3.regionGOHOARDER_STORAGE_S3_REGION
storage.s3.access_key_idGOHOARDER_STORAGE_S3_ACCESS_KEY_ID
storage.s3.secret_access_keyGOHOARDER_STORAGE_S3_SECRET_ACCESS_KEY
metadata.backendGOHOARDER_METADATA_BACKEND
metadata.postgresql.hostGOHOARDER_METADATA_POSTGRESQL_HOST
metadata.postgresql.passwordGOHOARDER_METADATA_POSTGRESQL_PASSWORD
security.enabledGOHOARDER_SECURITY_ENABLED
security.scanners.trivy.enabledGOHOARDER_SECURITY_SCANNERS_TRIVY_ENABLED
logging.levelGOHOARDER_LOGGING_LEVEL
logging.formatGOHOARDER_LOGGING_FORMAT

Configuration Reference

The following table lists the configurable parameters and their default values.

Global Parameters

ParameterDescriptionDefault
nameOverrideOverride the name of the chart""
fullnameOverrideOverride the full name of the chart""
global.domainBase domain for the deploymentgohoarder.local
global.imagePullSecretsImage pull secrets (reference existing)[]
imageCredentialsAuto-create image pull secrets from credentials{}

Replica Count

ParameterDescriptionDefault
replicaCount.serverNumber of server replicas1
replicaCount.frontendNumber of frontend replicas1
replicaCount.scannerNumber of scanner replicas1

Image Configuration

ParameterDescriptionDefault
image.server.repositoryServer image repositoryghcr.io/lukaszraczylo/gohoarder-server
image.server.tagServer image taglatest
image.server.pullPolicyServer image pull policyIfNotPresent
image.frontend.repositoryFrontend image repositoryghcr.io/lukaszraczylo/gohoarder-frontend
image.frontend.tagFrontend image taglatest
image.frontend.pullPolicyFrontend image pull policyIfNotPresent
image.scanner.repositoryScanner image repositoryghcr.io/lukaszraczylo/gohoarder-scanner
image.scanner.tagScanner image taglatest
image.scanner.pullPolicyScanner image pull policyIfNotPresent

Environment Variables

ParameterDescriptionDefault
server.envAdditional environment variables for server[]
frontend.envAdditional environment variables for frontend[]
scanner.envAdditional environment variables for scanner[]

Storage Configuration

ParameterDescriptionDefault
storage.backendStorage backend (filesystem, s3, smb)filesystem
storage.filesystem.storageClassStorage class for PVC""
storage.filesystem.sizeStorage size100Gi
storage.filesystem.useHostPathUse hostPath instead of PVCfalse
storage.filesystem.hostPathHost path for storage/var/lib/gohoarder
storage.s3.endpointS3 endpoints3.amazonaws.com
storage.s3.bucketS3 bucket namegohoarder-cache
storage.s3.regionS3 regionus-east-1

Metadata Configuration

ParameterDescriptionDefault
metadata.backendMetadata backend (sqlite, postgresql)sqlite
metadata.sqlite.persistence.enabledEnable persistence for SQLitetrue
metadata.sqlite.persistence.sizeSQLite storage size10Gi
metadata.postgresql.hostPostgreSQL hostlocalhost
metadata.postgresql.databasePostgreSQL databasegohoarder

Security Configuration

ParameterDescriptionDefault
security.enabledEnable security scanningfalse
security.blockOnSeverityBlock packages on severityhigh
security.scanners.trivy.enabledEnable Trivy scannerfalse
security.scanners.osv.enabledEnable OSV scannerfalse
security.scanners.grype.enabledEnable Grype scannerfalse

Authentication

ParameterDescriptionDefault
auth.enabledEnable authenticationtrue
auth.adminApiKeyAdmin API key (auto-generated if empty)""
auth.existingSecretUse existing secret for admin key""

Ingress

ParameterDescriptionDefault
ingress.enabledEnable ingressfalse
ingress.classNameIngress class namenginx
ingress.frontend.enabledEnable frontend ingresstrue
ingress.frontend.hostFrontend hostnamegohoarder.local
ingress.frontend.tls.enabledEnable TLS for frontendfalse

High Availability & Scaling

Running Multiple Server Replicas

GoHoarder can run with multiple server replicas for high availability and load distribution, but the configuration must be set correctly to avoid data inconsistency.

✅ Compatible Configurations (Safe for Multiple Replicas)

Storage:

  • ✅ S3 - Fully compatible, recommended for production HA setups
  • ✅ SMB - Compatible, shared network storage
  • ✅ Filesystem with RWX - Compatible when using ReadWriteMany storage classes
    • ✅ Examples: Longhorn RWX, NFS, CephFS, GlusterFS, Azure Files
    • ✅ Uses atomic rename operations for safe concurrent writes
    • ✅ Packages are static/immutable - perfect for shared storage
    • ❌ Not compatible with local storage or ReadWriteOnce (RWO) PVCs

Metadata:

  • ✅ PostgreSQL - Fully compatible, handles concurrent writes, recommended for HA
  • ⚠️ SQLite - Limited compatibility:
    • Uses WAL mode which supports concurrent reads
    • Multiple writers can cause lock contention
    • Works but may have performance issues under high concurrency
    • Only if using shared storage (NFS, etc.)

📋 Recommended HA Configurations

Option 1: Cloud Storage (S3)

Best for cloud deployments, object storage:

replicaCount:
  server: 3

storage:
  backend: s3
  s3:
    endpoint: s3.amazonaws.com
    region: us-east-1
    bucket: gohoarder-cache

metadata:
  backend: postgresql
  postgresql:
    host: postgres.database.svc.cluster.local
    database: gohoarder

podDisruptionBudget:
  enabled: true
  minAvailable: 1

Option 2: Shared Filesystem (Longhorn/NFS)

Best for on-premises or self-hosted Kubernetes:

replicaCount:
  server: 3

storage:
  backend: filesystem
  filesystem:
    # Use RWX storage class (Longhorn, NFS, CephFS, etc.)
    storageClass: "longhorn"  # or "nfs-client", "cephfs", etc.
    size: "500Gi"
    accessMode: "ReadWriteMany"  # RWX - Critical for multiple replicas!

metadata:
  backend: postgresql  # Or SQLite with RWX storage
  postgresql:
    host: postgres.database.svc.cluster.local
    database: gohoarder

podDisruptionBudget:
  enabled: true
  minAvailable: 1

Why Filesystem with RWX Works:

  • Packages are immutable once cached (static files)
  • Filesystem backend uses atomic rename() operations
  • Race condition safe: If two replicas cache same package, one wins
  • Performance: Local filesystem often faster than object storage for reads

⚠️ What Won't Work with Multiple Replicas

Filesystem storage with local volumes:

# ❌ DON'T DO THIS with multiple replicas
storage:
  backend: filesystem
  filesystem:
    useHostPath: true  # Each replica gets different storage

SQLite with local storage:

# ⚠️ AVOID with multiple replicas
metadata:
  backend: sqlite
  sqlite:
    persistence:
      enabled: true  # Each replica gets its own database

🔄 How It Works

Request Deduplication:

  • Single replica: Uses singleflight to prevent duplicate upstream fetches
  • Multiple replicas: Each replica may fetch the same package independently
  • Mitigation: Package metadata in shared database prevents duplicate downloads once one replica completes

Cache Consistency:

  • Storage backend (S3/SMB) ensures all replicas see the same cached packages
  • Metadata database ensures consistent package information across replicas
  • First replica to cache a package wins, others will use the cached version

Session Affinity:

  • Not required - GoHoarder is stateless
  • Load balancer can distribute requests randomly

Scanner Replicas:

  • Scanner can run as a single replica or multiple
  • If multiple scanners enabled, they share work through the metadata database
  • Package scans are deduplicated via database state

🔬 Technical Details: Concurrent Write Safety

Filesystem Backend with RWX Storage:

The filesystem storage backend uses a temp-file + atomic rename pattern:

1. Write package to: /cache/npm/[email protected]
2. Calculate checksums (MD5, SHA256)
3. Atomic rename: .tmp → /cache/npm/[email protected]

Why this is safe for concurrent writes:

  • os.Rename() is atomic on POSIX filesystems
  • If two replicas cache the same package simultaneously:
    • Both write to separate .tmp files
    • Both attempt atomic rename
    • One succeeds, one gets "file exists" error
    • Result: Same file cont

Deploy gohoarder with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has gohoarder on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgohoarder is pinned at v0.1.400 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply