From 7935c1435e2cc971df11a091de4777a37214fa8b Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Tue, 19 Dec 2023 15:31:00 +1300 Subject: [PATCH] chore: tidy repo and docs - add deployment docs for using crane and tar - update copyright year - remove helm chart - remove tiltfile --- README.org | 3 +- Tiltfile | 14 -- deployments/go-http-server/.helmignore | 23 ---- deployments/go-http-server/Chart.yaml | 23 ---- .../go-http-server/templates/NOTES.txt | 21 --- .../go-http-server/templates/_helpers.tpl | 62 --------- .../templates/configmap-headermap.yaml | 17 --- .../templates/configmap-templatemap.yaml | 17 --- .../go-http-server/templates/deployment.yaml | 123 ------------------ deployments/go-http-server/templates/hpa.yaml | 29 ----- .../templates/ingress-less-than-1-20.0.yaml | 44 ------- .../go-http-server/templates/ingress.yaml | 43 ------ .../go-http-server/templates/service.yaml | 16 --- .../templates/serviceaccount.yaml | 13 -- .../templates/tests/test-connection.yaml | 15 --- .../go-http-server/values-example.yaml | 47 ------- deployments/go-http-server/values.yaml | 111 ---------------- docs/configuration.md | 42 ------ docs/deployment.md | 50 ++----- 19 files changed, 15 insertions(+), 698 deletions(-) delete mode 100644 Tiltfile delete mode 100644 deployments/go-http-server/.helmignore delete mode 100644 deployments/go-http-server/Chart.yaml delete mode 100644 deployments/go-http-server/templates/NOTES.txt delete mode 100644 deployments/go-http-server/templates/_helpers.tpl delete mode 100644 deployments/go-http-server/templates/configmap-headermap.yaml delete mode 100644 deployments/go-http-server/templates/configmap-templatemap.yaml delete mode 100644 deployments/go-http-server/templates/deployment.yaml delete mode 100644 deployments/go-http-server/templates/hpa.yaml delete mode 100644 deployments/go-http-server/templates/ingress-less-than-1-20.0.yaml delete mode 100644 deployments/go-http-server/templates/ingress.yaml delete mode 100644 deployments/go-http-server/templates/service.yaml delete mode 100644 deployments/go-http-server/templates/serviceaccount.yaml delete mode 100644 deployments/go-http-server/templates/tests/test-connection.yaml delete mode 100644 deployments/go-http-server/values-example.yaml delete mode 100644 deployments/go-http-server/values.yaml diff --git a/README.org b/README.org index 5660984..908a97f 100644 --- a/README.org +++ b/README.org @@ -8,6 +8,7 @@ A HTTP server for sharing a local folder - Serve a plain folder to the web - Vue.js history mode (rewrite all requests to index.html, except assets) - Dynamic HTML templating +- Alternate webserver root ~.ghs.yaml~ based config * Documentation Docs are located in the [[./docs/][docs]] folder, as well as [[https://BobyMCbobs.gitlab.io/go-http-server][on GitLab pages]]. @@ -15,6 +16,6 @@ Docs are located in the [[./docs/][docs]] folder, as well as [[https://BobyMCbob This is a hard-fork of https://gitlab.com/safesurfer/go-http-server * License -Copyright 2020-2021 Safe Surfer, 2020-2022 BobyMCbobs. +Copyright 2020-2021 Safe Surfer, 2020-2023 BobyMCbobs. This project is licensed under the [[http://www.gnu.org/licenses/agpl-3.0.html][AGPL-3.0]] and is [[https://www.gnu.org/philosophy/free-sw.en.html][Free Software]]. This program comes with absolutely no warranty. diff --git a/Tiltfile b/Tiltfile deleted file mode 100644 index 6ac8fd5..0000000 --- a/Tiltfile +++ /dev/null @@ -1,14 +0,0 @@ -load('ext://ko', 'ko_build') -yaml = helm( - 'deployments/go-http-server', - name='go-http-server-dev', - namespace='go-http-server-dev', - set=[ - "service.type=NodePort" - ] - ) -k8s_yaml(yaml) -ko_build('registry.gitlab.com/BobyMCbobs/go-http-server', - '.', - deps=['./']) -allow_k8s_contexts('in-cluster') diff --git a/deployments/go-http-server/.helmignore b/deployments/go-http-server/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/deployments/go-http-server/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/deployments/go-http-server/Chart.yaml b/deployments/go-http-server/Chart.yaml deleted file mode 100644 index 3ce8508..0000000 --- a/deployments/go-http-server/Chart.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: v2 -name: go-http-server -description: A HTTP server for sharing a local folder - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 1.5.0 diff --git a/deployments/go-http-server/templates/NOTES.txt b/deployments/go-http-server/templates/NOTES.txt deleted file mode 100644 index 1cc160d..0000000 --- a/deployments/go-http-server/templates/NOTES.txt +++ /dev/null @@ -1,21 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "go-http-server.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "go-http-server.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "go-http-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "go-http-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:{{ .Values.service.port }} to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME {{ .Values.service.port }} -{{- end }} diff --git a/deployments/go-http-server/templates/_helpers.tpl b/deployments/go-http-server/templates/_helpers.tpl deleted file mode 100644 index 686f258..0000000 --- a/deployments/go-http-server/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "go-http-server.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "go-http-server.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "go-http-server.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "go-http-server.labels" -}} -helm.sh/chart: {{ include "go-http-server.chart" . }} -{{ include "go-http-server.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "go-http-server.selectorLabels" -}} -app.kubernetes.io/name: {{ include "go-http-server.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "go-http-server.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "go-http-server.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/deployments/go-http-server/templates/configmap-headermap.yaml b/deployments/go-http-server/templates/configmap-headermap.yaml deleted file mode 100644 index 7b51777..0000000 --- a/deployments/go-http-server/templates/configmap-headermap.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if .Values.headerMap }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "go-http-server.fullname" . }}-headermap - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.labels" . | nindent 4 }} -{{- if .Values.labels }} -{{- with .Values.labels }} - {{- toYaml . | nindent 4 }} -{{- end }} -{{- end }} -data: - "headers.yaml": | - {{- toYaml .Values.headerMap | nindent 4 }} -{{- end }} diff --git a/deployments/go-http-server/templates/configmap-templatemap.yaml b/deployments/go-http-server/templates/configmap-templatemap.yaml deleted file mode 100644 index 3f1390a..0000000 --- a/deployments/go-http-server/templates/configmap-templatemap.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if .Values.templateMap }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "go-http-server.fullname" . }}-templatemap - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.labels" . | nindent 4 }} -{{- if .Values.labels }} -{{- with .Values.labels }} - {{- toYaml . | nindent 4 }} -{{- end }} -{{- end }} -data: - "template.yaml": | - {{- toYaml .Values.templateMap | nindent 4 }} -{{- end }} diff --git a/deployments/go-http-server/templates/deployment.yaml b/deployments/go-http-server/templates/deployment.yaml deleted file mode 100644 index ec993b6..0000000 --- a/deployments/go-http-server/templates/deployment.yaml +++ /dev/null @@ -1,123 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "go-http-server.fullname" . }} - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.labels" . | nindent 4 }} -{{- if .Values.labels }} -{{- with .Values.labels }} - {{- toYaml . | nindent 4 }} -{{- end }} -{{- end }} -spec: -{{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} -{{- end }} - selector: - matchLabels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "go-http-server.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - initContainers: - {{- toYaml .Values.initContainers | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - env: - - name: APP_SERVE_FOLDER - value: {{ .Values.serveFolder }} - {{- if .Values.ingress.realIPHeader }} - - name: APP_HTTP_REAL_IP_HEADER - value: {{ .Values.ingress.realIPHeader }} - {{- end }} - {{- if .Values.templateMap }} - - name: APP_TEMPLATE_SET_ENABLE - value: "true" - - name: APP_TEMPLATE_MAP_PATH - value: {{ .Values.templateMapPath }} - {{- end }} - {{- if .Values.headerMap }} - - name: APP_HEADER_SET_ENABLE - value: "true" - - name: APP_HEADER_MAP_PATH - value: {{ .Values.headerMapPath }} - {{- end }} - {{- if .Values.vuejsHistoryMode }} - - name: APP_VUEJS_HISTORY_MODE - value: "true" - {{- end }} - {{- with .Values.extraEnv }} - {{- toYaml . | nindent 12 }} - {{- end }} - volumeMounts: - {{- if .Values.templateMap }} - - name: templatemap - mountPath: {{ .Values.templateMapPath }} - subPath: "template.yaml" - {{- end }} - {{- if .Values.headerMap }} - - name: headermap - mountPath: {{ .Values.headerMapPath }} - subPath: "headers.yaml" - {{- end }} - {{- if .Values.extraVolumeMounts }} - {{ toYaml .Values.extraVolumeMounts | trim | nindent 12 }} - {{- end }} - ports: - - name: http - containerPort: {{ .Values.service.port }} - protocol: TCP - livenessProbe: - tcpSocket: - port: http - readinessProbe: - tcpSocket: - port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - volumes: - {{- if .Values.templateMap }} - - name: templatemap - configMap: - name: {{ include "go-http-server.fullname" . }}-templatemap - {{- end }} - {{- if .Values.headerMap }} - - name: headermap - configMap: - name: {{ include "go-http-server.fullname" . }}-headermap - {{- end }} - {{- if .Values.extraVolumes }} - {{ toYaml .Values.extraVolumes | trim | nindent 8 }} - {{ end }} diff --git a/deployments/go-http-server/templates/hpa.yaml b/deployments/go-http-server/templates/hpa.yaml deleted file mode 100644 index 6f801b1..0000000 --- a/deployments/go-http-server/templates/hpa.yaml +++ /dev/null @@ -1,29 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "go-http-server.fullname" . }} - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "go-http-server.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/deployments/go-http-server/templates/ingress-less-than-1-20.0.yaml b/deployments/go-http-server/templates/ingress-less-than-1-20.0.yaml deleted file mode 100644 index f063f6f..0000000 --- a/deployments/go-http-server/templates/ingress-less-than-1-20.0.yaml +++ /dev/null @@ -1,44 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "go-http-server.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if semverCompare "<1.20-0" .Capabilities.KubeVersion.GitVersion -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ . }} - backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/deployments/go-http-server/templates/ingress.yaml b/deployments/go-http-server/templates/ingress.yaml deleted file mode 100644 index ff9b9e8..0000000 --- a/deployments/go-http-server/templates/ingress.yaml +++ /dev/null @@ -1,43 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "go-http-server.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.20-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ . }} - pathType: ImplementationSpecific - backend: - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/deployments/go-http-server/templates/service.yaml b/deployments/go-http-server/templates/service.yaml deleted file mode 100644 index 59c5a35..0000000 --- a/deployments/go-http-server/templates/service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "go-http-server.fullname" . }} - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "go-http-server.selectorLabels" . | nindent 4 }} diff --git a/deployments/go-http-server/templates/serviceaccount.yaml b/deployments/go-http-server/templates/serviceaccount.yaml deleted file mode 100644 index 056c756..0000000 --- a/deployments/go-http-server/templates/serviceaccount.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "go-http-server.serviceAccountName" . }} - labels: - app: io.bobymcbobs.go-http-server - {{- include "go-http-server.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/deployments/go-http-server/templates/tests/test-connection.yaml b/deployments/go-http-server/templates/tests/test-connection.yaml deleted file mode 100644 index 50aed14..0000000 --- a/deployments/go-http-server/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "go-http-server.fullname" . }}-test-connection" - labels: - {{- include "go-http-server.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test-success -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "go-http-server.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/deployments/go-http-server/values-example.yaml b/deployments/go-http-server/values-example.yaml deleted file mode 100644 index 3ac66e3..0000000 --- a/deployments/go-http-server/values-example.yaml +++ /dev/null @@ -1,47 +0,0 @@ -templateMap: - title: Welcome to go-http-server - body: "${BODY}" - -extraEnv: - - name: BODY - value: | - go-http-server is a fast, efficent scalable, minimal and secure web server from Safe Surfer. - It supports SPA navigation (for Vue.js), as well as go html templating the index.html file upon serving. - - Find out more at: - https://BobyMCbobs.gitlab.io/go-http-server - -vuejsHistoryMode: true - -initContainers: - - name: prepare - image: alpine:3.12 - volumeMounts: - - name: app-site - mountPath: /app/site - command: - - sh - - -c - - echo "

{{ .title }}

{{ .body }}

" > /app/site/index.html - -ingress: - enabled: true - annotations: - kubernetes.io/ingress.class: nginx - realIPHeader: X-Real-Ip - hosts: - - host: chart-example.local - paths: - - / - tls: - - hosts: - - chart-example.local - secretName: letsencrypt-prod - -extraVolumes: - - name: app-site - emptyDir: {} - -extraVolumeMounts: - - name: app-site - mountPath: /app/site diff --git a/deployments/go-http-server/values.yaml b/deployments/go-http-server/values.yaml deleted file mode 100644 index bec3742..0000000 --- a/deployments/go-http-server/values.yaml +++ /dev/null @@ -1,111 +0,0 @@ -# Default values for go-http-server. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -serveFolder: /app/site -templateMap: {} -# description: "${APP_DESCRIPTION}" -# title: go-http-server -templateMapPath: /app/template/template.yaml -vuejsHistoryMode: false -headerMap: {} -# Referrer-Policy: -# - strict-origin -# X-Content-Type-Options: -# - "${APP_CONTENT_TYPE_OPTIONS}" -headerMapPath: /app/headers/headers.yaml - -replicaCount: 1 - -image: - repository: registry.gitlab.com/bobymcbobs/go-http-server - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -labels: {} -extraEnv: [] - -serviceAccount: - # Specifies whether a service account should be created - create: false - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: - runAsUser: 1000 - runAsGroup: 1000 - readOnlyRootFilesystem: true - runAsNonRoot: true - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 8080 - -ingress: - enabled: false - annotations: {} - realIPHeader: "" - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: [] - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} - -extraVolumes: [] - # - name: app-site - # persistentVolumeClaim: - # claimName: pv0001 - -extraVolumeMounts: [] - # - name: site - # mountPath: /app/site - -initContainers: [] diff --git a/docs/configuration.md b/docs/configuration.md index 97d2736..266857a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -77,45 +77,3 @@ redirectRoutes: map[string]string for overriding the value set by the server. -# Helm configuration - -| Parameter | Description | Default | -|--------------------------------------------- |------------------------------------------------------------------------------------------------- |----------------------------------------------- | -| serveFolder | The local folder path to serve | `/app/site` | -| templateMap | The template map of fields and environment variables to template in `$APP_SERVE_FOLER/index.html` | `{}` | -| templateMapPath | The path to a template map | `/app/map.yaml` | -| vuejsHistoryMode | Enable Vuejs history mode path rewriting | `true` | -| headerMap | Custom headers to set on response | `{}` | -| headerMapPath | The path to a header map | `/app/headers.yaml` | -| labels | Extra labels to add to all managed resources | `{}` | -| extraEnv | Declare extra environment variables | | -| image.repository | The repo where the image lives | `registry.gitlab.com/bobymcbobs/go-http-server` | -| image.tag | Specifies a tag of from the image to use | `latest` | -| image.pullPolicy | Pod container pull policy | `IfNotPresent` | -| imagePullSecrets | References for the registry secrets to pull the container images in the Pod with | `[]` | -| nameOverride | Expand the name of the chart | `""` | -| fullNameOverride | Create a FQDN for the app name | `""` | -| serviceAccount.create | Whether a serviceAccount should be created for the Pod to use | `false` | -| serviceAccount.name | A name to give the servce account | `nil` | -| podAnnotations | Annotations to assign Pods | `{}` | -| podSecurityContext | Set a security context for the Pod | `{}` | -| securityContext.readOnlyRootFilesystem | Mount container filesytem as read only | `true` | -| securityContext.runAsNonRoot | Don’t allow the container in the Pod to run as root | `true` | -| securityContext.runAsUser | The user ID to run the container in the Pod as | `1000` | -| securityContext.runAsGroup | The group ID to run the container in the Pod as | `1000` | -| service.type | The service type to create | `ClusterIP` | -| service.port | The port to bind the app on and for the service to be set to | `8080` | -| ingress.enabled | Create an ingress manifests | `false` | -| ingress.realIPHeader | A header to forward, which contains the real client IP address | `""` | -| ingress.annotations | Set annotations for the ingress manifest | `{}` | -| ingress.hosts | The hosts which the ingress endpoint should be accessed from | | -| ingress.tls | References to TLS secrets | `[]` | -| resources | Limits and requests for the Pods | `{}` | -| autoscaling.enabled | Enable autoscaling for the deployment | `false` | -| autoscaling.minReplicas | The minimum amount of Pods to run | `1` | -| autoscaling.maxReplicas | The maximum amount of Pods to run | `1` | -| autoscaling.targetCPUUtilizationPercentage | The individual Pod CPU amount until autoscaling occurs | `80` | -| autoscaling.targetMemoryUtilizationPercentage | The individual Pod Memory amount until autoscaling occurs | | -| nodeSelector | Declare the node labels for Pod scheduling | `{}` | -| tolerations | Declare the toleration labels for Pod scheduling | `[]` | -| affinity | Declare the affinity settings for the Pod scheduling | `{}` | diff --git a/docs/deployment.md b/docs/deployment.md index 945fbb4..34e65e2 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -1,47 +1,23 @@ -# As a base image +# Deployment -``` -FROM registry.gitlab.com/bobymcbobs/go-http-server:latest -ADD mysite /var/run/ko -``` +> How to deploy go-http-server -# Helm +## As a base image -## Preliminary steps +With a Dockerfile -Create a namespace: - -```shell -kubectl create ns go-http-server ``` - -## Installation - -Install with Helm: - -```shell -helm install go-http-server-dev \ - -n go-http-server-dev \ -deployments/go-http-server +FROM registry.gitlab.com/bobymcbobs/go-http-server:latest +ADD mysite /var/run/ko ``` -Note: to configure, please check out [the configuration docs](./configuration.md) - -## Upgrading versions - -Upgrade a release with Helm: +With [crane](https://github.com/google/go-containerregistry/tree/main/cmd/crane) -```shell -helm upgrade go-http-server-dev \ - -n go-http-server-dev \ -deployments/go-http-server ``` - -## Uninstalling - -Uninstall with Helm: - -```shell -helm uninstall go-http-server-dev \ - -n go-http-server-dev +BASE_IMAGE=registry.gitlab.com/bobymcbobs/go-http-server:latest +mkdir -p output/var/run +mv some/path/to/dir output/var/run/ko +crane append --base="$BASE_IMAGE" --new_layer=<(cd output/ && tar -f - -c .) --new_tag=registry.example.com/image:tag ``` + +please note: the intended _output_ folder must be resulting in /var/run/ko inside, as that's the default serve location for a built container.