shortly

by lebe-dev

Helm chartv1.1.10App 1.6.1Verified publisher

A Helm chart for Kubernetes

About this chart

Shortly Helm Chart

Helm chart for deploying Shortly - a URL shortener service.

Installing the Chart

helm repo add tinyops https://tinyops.ru/helm-charts/
helm repo update

helm upgrade --install -n shortly --create-namespace shortly tinyops/shortly --version 1.1.8

# with custom values
helm upgrade --install -n shortly --create-namespace shortly tinyops/shortly --version 1.1.8 -f values.yml

Для установки из локального исходного кода:

helm upgrade --install -n shortly --create-namespace shortly ./helm-chart -f values.yml

Публикация чарта: just release-chart (обновляет Helm-репозиторий).

Uninstalling the Chart

helm uninstall -n shortly shortly

Configuration

Application Configuration

The following parameters configure the Shortly application itself. All values are exposed as environment variables to the container.

ParameterDescriptionDefaultSensitive
config.bindServer bind address and port0.0.0.0:8080No
config.logLevelLogging level (debug, info, warn, error)infoNo
config.logTargetLogging target (stdout, file)stdoutNo
config.baseUrlBase URL for generated short linkshttp://localhost:8080No
config.shortUrl.ttlLink TTL in hours168 (7 days)No
config.shortUrl.maxLengthMaximum URL length in characters2048No
config.scheduler.cleanupExpiredUrlsCron expression for cleanup task0 0 * * * * (hourly)No
config.features.createUrl.enabledEnable URL creation featuretrueNo
config.features.createUrl.authOnlyRequire authentication for URL creationtrueNo
config.features.createUrl.maxPerUserFallback total URL quota per user100No
config.features.createUrl.maxPerDayFallback URL quota per user in the last 24 hours10No
config.features.namedUrls.enabledEnable authenticated creation of named linksfalseNo
config.features.namedUrls.minLengthMinimum custom name length3No
config.features.namedUrls.maxLengthMaximum custom name length50No
config.features.namedUrls.defaultAccessNAMED_URL_DEFAULT_ACCESS: режим новых именных ссылок, public или internalpublicNo
config.features.namedUrls.allowAccessOverrideNAMED_URL_ALLOW_ACCESS_OVERRIDE: разрешить выбор режима в UI/APIfalseNo
config.features.namedUrls.checkRateLimitNAMED_URL_CHECK_RATE_LIMIT: проверки имён и попытки создания именных ссылок на источник в минуту, отдельно на каждой реплике30No
config.internalNetworkCidrsINTERNAL_NETWORK_CIDRS: разрешённые клиентские IPv4/IPv6 CIDR через запятую""No
config.trustedProxyCidrsTRUSTED_PROXY_CIDRS: доверенные прокси для X-Forwarded-For, CIDR через запятую""No
config.auth.enabledEnable authenticationtrueNo
config.auth.noteNote shown on the login page""No
config.auth.adminUsersComma-separated administrator usernames""No
config.metrics.enabledEnable /api/metricsfalseNo
config.auth.typeAuthentication typegitlabNo
config.auth.providers.gitlab.baseUrlGitLab instance URLhttps://gitlab.comNo
config.auth.passkey.enabledEnable login with a passkey (WebAuthn)falseNo
config.auth.passkey.rpIdRegistrable domain, without scheme or port. Required when passkeys are enabled""No
config.auth.passkey.rpOriginOrigin the browser reports, including scheme and port. Required when passkeys are enabled""No
config.auth.passkey.rpNameName shown by the authenticatorShortlyNo
config.auth.passkey.challengeTtlLifetime of an unfinished ceremony, in seconds300No
config.nginx.enabledEnable nginx reverse proxy sidecartrueNo
config.nginx.image.repositoryNginx image repositorynginxNo
config.nginx.image.tagNginx image tag1.30.0-alpine3.23-slimNo
config.nginx.image.pullPolicyNginx image pull policyIfNotPresentNo
config.nginx.portNginx container port80No
config.nginx.backendPortBackend application port8080No
config.nginx.resourcesNginx resource requests/limits{}No
config.nginx.configNginx configuration (nginx.conf)See values.yamlNo
secrets.dbCnnDatabase connection stringsqlite:///data/shortly.db?mode=rwcYes
secrets.auth.providers.gitlab.applicationIdGitLab OAuth application ID""Yes
secrets.auth.providers.gitlab.secretGitLab OAuth application secret""Yes
secrets.annotationsAnnotations for Secret resource{}N/A

Доступность именных ссылок

Старые и обычные сгенерированные ссылки остаются публичными. defaultAccess применяется только к новым именным ссылкам; пользователь может изменить его при создании, только если включён allowAccessOverride. Для internal или разрешения выбора режима необходимо заполнить internalNetworkCidrs, иначе приложение не запустится. Диапазоны по умолчанию пустые: укажите реальные адреса компании/VPN, включая публичные адреса выхода при необходимости.

Пример values.yml для цепочки Ingress → Nginx sidecar → Shortly:

config:
  features:
    namedUrls:
      enabled: true
      defaultAccess: internal
      allowAccessOverride: false
      checkRateLimit: 30
  internalNetworkCidrs: "10.20.0.0/16,fd12:3456::/32"
  trustedProxyCidrs: "127.0.0.1/32,10.244.2.0/24"

CIDR в примере нужно заменить: 10.20.0.0/16 и fd12:3456::/32 — клиентские сети, 10.244.2.0/24 — пример подсети ingress-подов. С Nginx sidecar добавьте его loopback 127.0.0.1/32; без sidecar укажите только реальные прокси перед backend. Клиентские сети и доверенные прокси задаются отдельно: не доверяйте всей корпоративной сети или всем адресам (0.0.0.0/0, ::/0) как прокси.

Backend определяет клиента по цепочке X-Forwarded-For справа налево, пропуская доверенные прокси. Ingress должен передавать достоверный IP клиента, а доступ к backend должен идти через заданные прокси. При недостоверном IP internal-ссылка недоступна. Снаружи она выглядит как отсутствующая; авторизация владельца или администратора не обходит проверку при переходе.

Лимит проверки имён общий с попытками создания именных ссылок и действует отдельно на каждой реплике, сбрасывается после перезапуска. Ответ при превышении — 429 с Retry-After. Для общего лимита нескольких реплик задайте дополнительное ограничение на ingress.

Изменение ConfigMap при helm upgrade перезапускает pod через checksum/config, применяя новые ENV. Прокси должны сохранять Cache-Control: private, no-store для редиректов и API получения ссылок.

Подробности: переменные окружения.

Image Configuration

ParameterDescriptionDefault
image.repositoryContainer image repositorytinyops/shortly
image.pullPolicyImage pull policyIfNotPresent
image.tagImage tag (overrides chart appVersion)""
imagePullSecretsImage pull secrets[]

Deployment Configuration

ParameterDescriptionDefault
replicaCountNumber of replicas1
nameOverrideOverride chart name""
fullnameOverrideOverride full name""
podAnnotationsAnnotations for pods{}
podLabelsLabels for pods{}
podSecurityContextSecurity context for pod{}
securityContextSecurity context for container{}
resourcesResource requests/limits{}
nodeSelectorNode selector{}
tolerationsTolerations[]
affinityAffinity rules{}

Service Configuration

ParameterDescriptionDefault
service.typeService typeClusterIP
service.portService port80

Service Account

ParameterDescriptionDefault
serviceAccount.createCreate service accounttrue
serviceAccount.automountAutomount service account tokentrue
serviceAccount.annotationsService account annotations{}
serviceAccount.nameService account name""

Ingress Configuration

ParameterDescriptionDefault
ingress.enabledEnable ingressfalse
ingress.classNameIngress class name""
ingress.annotationsIngress annotations{}
ingress.hostsIngress hosts configurationSee values.yaml
ingress.tlsIngress TLS configuration[]

По умолчанию ingress-аннотации пустые. Кеширование статических файлов настроено в Nginx sidecar.

HTTPRoute Configuration (Gateway API)

ParameterDescriptionDefault
httpRoute.enabledEnable HTTPRoutefalse
httpRoute.annotationsHTTPRoute annotations{}
httpRoute.parentRefsGateway referencesSee values.yaml
httpRoute.hostnamesHostnames[chart-example.local]
httpRoute.rulesRouting rulesSee values.yaml

Persistence Configuration

ParameterDescriptionDefault
persistence.enabledEnable persistent storage for SQLite databasetrue
persistence.existingClaimUse existing PVC (if empty, creates new)""
persistence.storageClassStorage class name (use "-" for default)""
persistence.accessModesAccess modes[ReadWriteOnce]
persistence.sizeVolume size1Gi
persistence.annotationsPVC annotations{}
persistence.selectorSelector to match existing PV{}
persistence.mountPathMount path in container/data
persistence.subPathSubpath within volume""

Note: SQLite database requires persistent storage in production. The database file is stored at /data/shortly.db inside the container.

Nginx Reverse Proxy

The chart includes an optional nginx reverse proxy sidecar container that provides:

  • Client-side caching for SvelteKit static assets (/_app/immutable/* paths)
  • Gzip compression at optimal level (6) for text-based content
  • Performance optimization with appropriate cache headers

Architecture:

When nginx is enabled (default):

  • Nginx container: Runs as sidecar, listens on port 80, serves as reverse proxy
  • Shortly app: Listens on port 8080 (backend)
  • Service: Routes external traffic to nginx on port 80
  • Communication: Nginx proxies requests to localhost:8080

Caching Strategy:

  1. SvelteKit immutable assets (/_app/immutable/*):

    • Cache-Control: public, immutable
    • Expires: max (1 year)
    • Access logging: disabled
    • Perfect for content-addressed assets that never change
  2. Other static assets (images, fonts, etc.):

    • Cache-Control: public
    • Expires: 7 days
    • Access logging: disabled
  3. Dynamic content:

    • No caching
    • Proxied directly to backend

Gzip Compression:

  • Compression level: 6 (optimal balance between size and CPU)
  • Compressed types: text/plain, text/css, text/javascript, application/json, application/javascript, SVG, fonts
  • Automatically adds Vary: Accept-Encoding header

Configuration:

ParameterDescriptionDefault
config.nginx.enabledEnable/disable nginx sidecartrue
config.nginx.configFull nginx.conf contentSee values.yaml
config.nginx.resourcesResource limits for nginx{}

Disabling Nginx:

To disable nginx and run the application directly (legacy mode):

config:
  nginx:
    enabled: false

When disabled, the Shortly app listens directly on port 8080.

Custom Nginx Configuration:

You can override the entire nginx configuration in your values file:

config:
  nginx:
    enabled: true
    config: |
      worker_processes auto;
      error_log /dev/stderr warn;
      # ... your custom nginx.conf ...

Resource Allocation Example:

config:
  nginx:
    enabled: true
    resources:
      requests:
        cpu: 50m
        memory: 32Mi
      limits:
        cpu: 100m
        memory: 64Mi

Additional Volumes and Volume Mounts

ParameterDescriptionDefault
volumesAdditional volumes[]
volumeMountsAdditional volume mounts[]

Probe Configuration

Control Kubernetes liveness, readiness, and startup probes for both containers.

ParameterDescriptionDefault
probes.shortly.livenessProbe.enabledEnable liveness probe for shortly containertrue
probes.shortly.livenessProbe.httpGet.pathHealth check path/api/health
probes.shortly.livenessProbe.initialDelaySecondsInitial delay before liveness probe starts10
probes.shortly.livenessProbe.periodSecondsHow often to perform the probe30
probes.shortly.livenessProbe.timeoutSecondsTimeout for probe response5
probes.shortly.livenessProbe.failureThresholdFailures before restart3
probes.shortly.readinessProbe.enabledEnable readiness probe for shortly containertrue
probes.shortly.readinessProbe.httpGet.pathHealth check path/api/health
probes.shortly.readinessProbe.initialDelaySecondsInitial delay before readiness probe starts5
probes.shortly.readinessProbe.periodSecondsHow often to perform the probe10
probes.shortly.readinessProbe.timeoutSecondsTimeout for probe response5
`probes.shortly.rea

Deploy shortly with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has shortly 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 chartshortly is pinned at v1.1.10 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