Skip to content

Commit ce98438

Browse files
th3n3rdJenny Lea
authored and
Jenny Lea
committed
Improving installation via Helm (#247)
* Update helm docker image used in CI * Move helm dependencies from requirements.yaml into Chart.yaml * Fix the port-forwarding notes in the helm chart * Document how to clean up state after helm uninstall Signed-off-by: Jenny Lea <[email protected]> Signed-off-by: Othman Alkhamra <[email protected]>
1 parent 3937f10 commit ce98438

File tree

7 files changed

+38
-48
lines changed

7 files changed

+38
-48
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
tags: true
3232
- name: "Build & Deploy Helm"
3333
script:
34-
- docker run -v $TRAVIS_BUILD_DIR/deployment/helm/:/helm -w /helm --entrypoint /helm/build.sh alpine/helm:3.0.0-beta.5 $TRAVIS_TAG
34+
- docker run -v $TRAVIS_BUILD_DIR/deployment/helm/:/helm -w /helm --entrypoint /helm/build.sh alpine/helm:3.2.1 $TRAVIS_TAG
3535
deploy:
3636
- provider: releases
3737
draft: true

deployment/helm/Chart.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ dependencies:
55
- name: redis
66
repository: https://kubernetes-charts.storage.googleapis.com
77
version: 9.4.3
8-
digest: sha256:63b5c2d6fa6dbceb477ec60d94c9d4f3f14e0ee85738b32880213282ab9a7f0e
9-
generated: "2019-10-26T07:44:45.177984+01:00"
8+
digest: sha256:18dea218d4c6460be6a3b7b203d6668650e1a9dfe42a4859ccdd7f5ebc6b9038
9+
generated: "2020-05-12T14:21:00.129069+01:00"

deployment/helm/Chart.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,16 @@ type: application
4444

4545
# This is the chart version. This version number should be incremented each time you make changes
4646
# to the chart and its templates, including the app version.
47-
version: 0.2.0-beta
47+
version: 0.4.0-beta
4848

4949
# This is the version number of the application being deployed. This version number should be
5050
# incremented each time you make changes to the application.
5151
appVersion: latest
52+
53+
dependencies:
54+
- name: postgresql
55+
version: 6.5.0
56+
repository: "@stable"
57+
- name: redis
58+
version: 9.4.3
59+
repository: "@stable"

deployment/helm/README.md

+25-4
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ option for postgres you would add the following to the install/upgrade command
8585
```
8686
8787
88-
# Building the chart
88+
# Local development
8989
90-
To build and run the chart locally, follow the following steps
90+
## Building the chart
91+
92+
To build the chart locally, follow the following steps
9193
9294
1. Install Helm CLI (version 3+)
9395
1. Add stable chart repository to helm
@@ -100,5 +102,24 @@ To build and run the chart locally, follow the following steps
100102
```
101103
1. Build the chart:
102104
```shell script
103-
helm package
104-
```
105+
helm package .
106+
```
107+
108+
## Installing the chart
109+
110+
Installing the chart locally with the following command:
111+
112+
```shell script
113+
helm install postfacto <local-chart.tgz>
114+
```
115+
116+
This will automatically install `postgresql` and `redis` with persistence enabled, which means the configuration and data
117+
survive `helm uninstall`.
118+
119+
In this case the next time `postfacto` gets installed, `postgresql` will attempt to generate a new password and fail to authenticate.
120+
121+
In order to clean the state after `helm uninstall` it is recommended to delete all persistent volume claims using:
122+
123+
```shell script
124+
kubectl delete pvc -l release=postfacto
125+
```

deployment/helm/build.sh

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ sed -i.bak s/appVersion:.*/appVersion:\ $APP_VERSION/ Chart.yaml
4141

4242
helm repo add stable https://kubernetes-charts.storage.googleapis.com
4343

44-
rm -f Chart.lock # workaround for: https://github.com/helm/helm/issues/6416
4544
helm dependency build
4645

4746
helm package .

deployment/helm/requirements.yaml

-37
This file was deleted.

deployment/helm/templates/NOTES.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "postfacto.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
1616
echo http://$SERVICE_IP:{{ .Values.service.port }}
1717
{{- else if contains "ClusterIP" .Values.service.type }}
18-
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "postfacto.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
1918
echo "Visit http://127.0.0.1:8080 to use your application"
20-
kubectl port-forward $POD_NAME 8080:80
19+
kubectl port-forward service/{{ include "postfacto.fullname" . }} 8080:80
2120
{{- end }}

0 commit comments

Comments
 (0)