gogs

by jfelten

Helm chartv0.1.3App 0.12.3MIT

Gogs is a painless self-hosted Git service

About this chart

Gogs Helm Chart

Gogs is a painless self-hosted Git service

Homepage: https://github.com/keyporttech/gogs-helm-chart

Introduction

This is a kubernetes helm chart for Gogs.

Looking for the gitea version of this chart? See: here

  • A kubernetes cluster ( most recent release recommended)
  • Helm 3 client
  • Please ensure that nodepools have enough resources to run both a web application and database
  • An external database if not using the in pod database

Installing the Chart

This chart is published in keyporttech/charts. To install the chart, first add the keyporttech helm repo:

helm repo add keyporttech https://keyporttech.github.io/helm-charts/

Then to install with the release name gogs in the namespace gogs with the customized values in custom_values.yaml run:

$ helm install -- values custom_values.yaml --name gogs --namespace gogs keyporttech/gogs

or locally:

$ helm install --name gogs --namespace gogs .

Tip: You can use the default values.yaml

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm uninstall my-release -n my-namespace

All resources associated with the last release of the chart as well as its release history will be deleted.

Database config in pod vs external db

By default the chart will spin up a postgres container inside the pod. It can also work with external databases. To disable the in pod database and use and external one use the following values:

dbType: "postgres"
useInPodPostgres: false

#Connect to an external database
externalDB:
  dbUser: "gogs"
  dbPassword: "<MY_PASSWORD>"
  dbHost: "db-service-name.namespace.svc.cluster.local" # or some external host
  dbPort: 5432
  dbDatabase: "gogs"

This chart has only been tested using a postgres database, but others should be possible.

Data Management

This chart will use and create optional persistent volume claims for both postgres (if using in pod db) and gogs data. By default the data will be deleted upon uninstalling the chart. This is not ideal but can be managed in a couple ways:

  • prevent helm from deleting the pvcs it creates. Do this by enabling annotation: helm.sh/resource-policy": keep in the pvc optional annotations
persistence:
  annotations:
    "helm.sh/resource-policy": keep
  • create a pvc outside the chart and configure the chart to use it. Do this by setting the persistence existingGogsClaim and existingPostgresClaim properties.
 existingGogsClaim: gogs-gogs
 existingPostgresClaim: gogs-postgres

a trick that can be is used to first set the helm.sh/resource-policy annotation so that the chart generates the pvcs, but doesn't delete them. Upon next deplyment set the exsiting claim names to the generated values.

Ingress And External Host/Ports

Gogs requires ports to be exposed for both web and ssh traffic. The chart is flexible and allow a combination of either ingresses, loadblancer, or nodeport services.

To expose the web application this chart will generate an ingress using the ingress controller of choice if specified. If an ingress is enabled services.http.externalHost must be specified. To expose SSH services it relies on either a LoadBalancer or NodePort.

Configuration

Refer to values.yaml for the full run-down on defaults.

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

Values

KeyTypeDefaultDescription
affinityobject{}
config.disableInstallerboolfalse
config.disableRegistrationboolfalse
config.mailer.enabledboolfalse
config.mailer.fromstring""
config.mailer.hoststring"smtp.gmail.com"
config.mailer.passwdstring""
config.mailer.portint587
config.mailer.tlsboolfalse
config.mailer.userstring""
config.metrics.enabledboolfalse
config.metrics.tokenstring""
config.notifyMailboolfalse
config.offlineModeboolfalse
config.openidSigninbooltrue
config.requireSigninboolfalse
dbTypestring"postgres"
deploymentAnnotationsobject{}
images.gogsstring"gogs/gogs:0.12.3"
images.imagePullPolicystring"IfNotPresent"
images.memcachedstring"memcached:1.5.19-alpine"
images.postgresstring"postgres:11"
inPodPostgres.dataMountPathstring"/var/lib/postgresql/data/pgdata"
inPodPostgres.postgresDatabasestring"gogs"Create a database if unset default: the postgres user
inPodPostgres.secretstring"postgresecrets"secret with generated credentials
inPodPostgres.subPathstring"postgresql-db"subPath
inPodPostgres.usePasswordFileboolfalse
ingress.enabledboolfalseEnable/Disable ingress
memcached.extendedOptionsstring"modern"Extended options
memcached.maxItemMemoryint64
memcached.verbositystring"v"
nodeSelectorobject{}
persistence.accessModestring"ReadWriteMany"
persistence.enabledboolfalse
persistence.gogsSizestring"10Gi"
persistence.postgresSizestring"5Gi"
podAnnotationsobject{}
resources.gogs.limits.cpuint1requests memory cpu for gogs containers
resources.gogs.limits.memorystring"2Gi"requests memory limits for gogs containers
resources.gogs.requests.cpustring"1000m"requests cpuresources for gogs containers
resources.gogs.requests.memorystring"500Mi"requests memory resources for gogs containers
resources.memcached.requests.cpustring"50m"requests memory limits for memcached containers
resources.memcached.requests.memorystring"64Mi"requests memory resources for memcached containers
resources.postgres.limits.cpuint1requests memory limits for postgres containers
resources.postgres.limits.memorystring"2Gi"requests memory limits for postgres containers
resources.postgres.requests.cpustring"200m"requests cpu resources for postgres containers
resources.postgres.requests.memorystring"200Mi"requests memory resources for postgres containers
service.http.externalHoststring"git.example.com"gogs external host name
service.http.externalPortint8280
service.http.portint3000kubernetes service port for gogs
service.http.serviceTypestring"ClusterIP"kubernetes service type for gogs
service.ssh.portint22ssh service port
service.ssh.serviceTypestring"ClusterIP"ssh service type
tolerationslist[]
useInPodPostgresbooltrueuse the chart built in db

Source Code

Maintainers

NameEmailUrl
Keyporttech[email protected]

Contributing

Please see keyporttech charts contribution guidelines helm Chart

Deploy gogs with OpenTenant

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