├── Chart.yaml ├── README.md ├── templates ├── service.yaml ├── hpa.yaml ├── ingress.yaml ├── _helpers.tpl ├── deployment.yaml └── NOTES.txt ├── nginx.conf └── values.yaml /Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.0" 3 | description: A Helm chart for Kubernetes 4 | name: strapi 5 | version: 0.1.0 6 | 7 | maintainers: 8 | - name: geekette 9 | email: geekette86@gmail.com 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # helm strapi 2 | 3 | This is a strapi helm Chart 4 | 5 |

Why i did this ?

6 | 7 | Strapi they dont really a clear deployment process on K8s so in some work projects , we need strapi as our back service and from there i did this 8 | 9 | To install 10 | https://helm.sh/docs/helm/helm_install/ 11 | 12 |

To Do

13 | 14 | package this on github pages or storage cloud 15 | 16 |

https://github.com/strapi/strapi

17 | 18 | 19 | @strapi 20 | -------------------------------------------------------------------------------- /templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ template "starpi.fullname" . }} 5 | labels: 6 | app: {{ template "starpi.name" . }} 7 | chart: {{ template "starpi.chart" . }} 8 | release: {{ .Release.Name }} 9 | heritage: {{ .Release.Service }} 10 | spec: 11 | type: {{ .Values.service.type }} 12 | ports: 13 | - port: {{ .Values.service.port }} 14 | targetPort: http 15 | protocol: TCP 16 | name: http 17 | selector: 18 | app: {{ template "starpi.name" . }} 19 | release: {{ .Release.Name }} 20 | -------------------------------------------------------------------------------- /templates/hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.autoscaling.enabled }} 2 | apiVersion: autoscaling/v2beta1 3 | kind: HorizontalPodAutoscaler 4 | metadata: 5 | name: {{ template "starpi.fullname" . }} 6 | labels: 7 | app: {{ template "starpi.name" . }} 8 | chart: {{ template "starpi.chart" . }} 9 | release: {{ .Release.Name }} 10 | heritage: {{ .Release.Service }} 11 | spec: 12 | scaleTargetRef: 13 | apiVersion: apps/v1beta1 14 | kind: Deployment 15 | name: {{ template "starpi.fullname" . }} 16 | minReplicas: {{ .Values.autoscaling.minReplicas }} 17 | maxReplicas: {{ .Values.autoscaling.maxReplicas }} 18 | metrics: 19 | {{- if .Values.autoscaling.cpu.enabled }} 20 | - type: Resource 21 | resource: 22 | name: cpu 23 | targetAverageUtilization: {{ .Values.autoscaling.cpu.targetPercentage }} 24 | {{- end }} 25 | {{- if .Values.autoscaling.memory.enabled }} 26 | - type: Resource 27 | resource: 28 | name: memory 29 | targetAverageUtilization: {{ .Values.autoscaling.memory.targetPercentage }} 30 | {{- end }} 31 | {{- end }} 32 | -------------------------------------------------------------------------------- /templates/ingress.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ingress.enabled -}} 2 | {{- $fullName := include "starpi.fullname" . -}} 3 | {{- $ingressPath := .Values.ingress.path -}} 4 | apiVersion: extensions/v1beta1 5 | kind: Ingress 6 | metadata: 7 | name: {{ $fullName }} 8 | labels: 9 | app: {{ template "starpi.name" . }} 10 | chart: {{ template "starpi.chart" . }} 11 | release: {{ .Release.Name }} 12 | heritage: {{ .Release.Service }} 13 | {{- with .Values.ingress.annotations }} 14 | annotations: 15 | {{ toYaml . | indent 4 }} 16 | {{- end }} 17 | spec: 18 | {{- if .Values.ingress.tls }} 19 | tls: 20 | {{- range .Values.ingress.tls }} 21 | - hosts: 22 | {{- range .hosts }} 23 | - {{ . }} 24 | {{- end }} 25 | secretName: {{ .secretName }} 26 | {{- end }} 27 | {{- end }} 28 | rules: 29 | {{- range .Values.ingress.hosts }} 30 | - host: {{ . }} 31 | http: 32 | paths: 33 | - path: {{ $ingressPath }} 34 | backend: 35 | serviceName: {{ $fullName }} 36 | servicePort: http 37 | {{- end }} 38 | {{- end }} 39 | -------------------------------------------------------------------------------- /templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "starpi.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "starpi.fullname" -}} 15 | {{- if .Values.fullnameOverride -}} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 | {{- else -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- if contains $name .Release.Name -}} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 | {{- else -}} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "starpi.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 | {{- end -}} 33 | -------------------------------------------------------------------------------- /templates/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta2 2 | kind: Deployment 3 | metadata: 4 | name: {{ template "starpi.fullname" . }} 5 | labels: 6 | app: {{ template "starpi.name" . }} 7 | chart: {{ template "starpi.chart" . }} 8 | release: {{ .Release.Name }} 9 | heritage: {{ .Release.Service }} 10 | spec: 11 | replicas: {{ .Values.replicaCount }} 12 | selector: 13 | matchLabels: 14 | app: {{ template "starpi.name" . }} 15 | release: {{ .Release.Name }} 16 | template: 17 | metadata: 18 | labels: 19 | app: {{ template "starpi.name" . }} 20 | release: {{ .Release.Name }} 21 | spec: 22 | containers: 23 | - name: {{ .Chart.Name }} 24 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" 25 | imagePullPolicy: {{ .Values.image.pullPolicy }} 26 | env: 27 | {{ toYaml .Values.envs | indent 12 }} 28 | ports: 29 | - name: http 30 | containerPort: {{ .Values.port }} 31 | protocol: TCP 32 | resources: 33 | {{ toYaml .Values.resources | indent 12 }} 34 | {{- with .Values.nodeSelector }} 35 | nodeSelector: 36 | {{ toYaml . | indent 8 }} 37 | {{- end }} 38 | {{- with .Values.affinity }} 39 | affinity: 40 | {{ toYaml . | indent 8 }} 41 | {{- end }} 42 | {{- with .Values.tolerations }} 43 | tolerations: 44 | {{ toYaml . | indent 8 }} 45 | {{- end }} 46 | 47 | -------------------------------------------------------------------------------- /templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | 1. Get the application URL by running these commands: 2 | {{- if .Values.ingress.enabled }} 3 | {{- range .Values.ingress.hosts }} 4 | http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} 5 | {{- end }} 6 | {{- else if contains "NodePort" .Values.service.type }} 7 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "starpi.fullname" . }}) 8 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 9 | echo http://$NODE_IP:$NODE_PORT 10 | {{- else if contains "LoadBalancer" .Values.service.type }} 11 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. 12 | You can watch the status of by running 'kubectl get svc -w {{ template "starpi.fullname" . }}' 13 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "starpi.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') 14 | echo http://$SERVICE_IP:{{ .Values.service.port }} 15 | {{- else if contains "ClusterIP" .Values.service.type }} 16 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "starpi.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") 17 | echo "Visit http://127.0.0.1:8080 to use your application" 18 | kubectl port-forward $POD_NAME 8080:80 19 | {{- end }} 20 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | # auto detects a good number of processes to run 2 | worker_processes auto; 3 | 4 | events { 5 | # Sets the maximum number of simultaneous connections that can be opened by a worker process. 6 | worker_connections 8000; 7 | # Tells the worker to accept multiple connections at a time 8 | multi_accept on; 9 | } 10 | 11 | 12 | http { 13 | # what times to include 14 | include /etc/nginx/mime.types; 15 | # what is the default one 16 | default_type application/octet-stream; 17 | 18 | # Sets the path, format, and configuration for a buffered log write 19 | log_format compression '$remote_addr - $remote_user [$time_local] ' 20 | '"$request" $status $upstream_addr ' 21 | '"$http_referer" "$http_user_agent"'; 22 | 23 | server { 24 | listen 80; 25 | access_log /var/log/nginx/access.log compression; 26 | 27 | location / { 28 | proxy_pass http://127.0.0.1:1337; 29 | } 30 | 31 | # Media: images, icons, video, audio, HTC 32 | location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { 33 | proxy_pass http://127.0.0.1:1337; 34 | expires 1M; 35 | #access_log off; 36 | add_header Cache-Control "public"; 37 | } 38 | 39 | # Javascript and CSS files 40 | location ~* \.(?:css|js)$ { 41 | proxy_pass http://127.0.0.1:1337; 42 | expires 1y; 43 | #access_log off; 44 | add_header Cache-Control "public"; 45 | } 46 | 47 | # Any route containing a file extension 48 | location ~ ^.+\..+$ { 49 | proxy_pass http://127.0.0.1:1337; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /values.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fullnameOverride: strapi 3 | 4 | replicaCount: 2 5 | 6 | port: 1337 7 | 8 | envs: 9 | - name: APPLICATION_NAME 10 | value: "strapi" 11 | - name: PORT 12 | value: '1337' 13 | - name: NODE_ENV 14 | value: development 15 | - name: DATABASE_HOST 16 | value: mongodb://{ Change to your mongo service }:27017/starpi-db?authSource=starpi-db&gssapiServiceName=mongodb 17 | - name: DATABASE_NAME 18 | value: "starpi-db" 19 | - name: DATABASE_SRV 20 | value: "false" 21 | - name: DATABASE_PORT 22 | value: "27017" 23 | - name: DATABASE_SSl 24 | value: "false" 25 | 26 | image: 27 | repository: {your registry} 28 | pullPolicy: IfNotPresent 29 | 30 | service: 31 | type: ClusterIP 32 | port: 80 33 | 34 | 35 | liveness: 36 | enabled: 1 37 | path: "/healthz" 38 | 39 | readiness: 40 | enabled: 1 41 | path: "/healthz" 42 | 43 | 44 | nginx: 45 | image: 46 | tag: 1.15-alpine 47 | config: 48 | file: nginx.conf 49 | resources: 50 | limits: 51 | cpu: 100m 52 | memory: 128Mi 53 | requests: 54 | cpu: 50m 55 | memory: 64Mi 56 | 57 | ingress: 58 | enabled: true 59 | annotations: 60 | kubernetes.io/ingress.class: nginx 61 | hosts: 62 | - host: admin.domain.com 63 | paths: [] 64 | tls: [] 65 | 66 | resources: 67 | limits: 68 | cpu: 200m 69 | memory: 256Mi 70 | requests: 71 | cpu: 100m 72 | memory: 126Mi 73 | 74 | # Horizontal Pod Autoscaler 75 | autoscaling: 76 | enabled: 0 77 | minReplicas: 1 78 | maxReplicas: 1 79 | cpu: 80 | enabled: 0 81 | targetPercentage: 60 82 | memory: 83 | enabled: 0 84 | targetPercentage: 60 85 | 86 | nodeSelector: {} 87 | 88 | tolerations: [] 89 | 90 | affinity: {} 91 | --------------------------------------------------------------------------------