Skip to content

Commit

Permalink
0.0.1-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxpiper committed Jun 21, 2020
1 parent cb21351 commit 2e45a94
Show file tree
Hide file tree
Showing 13 changed files with 236 additions and 41 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@

This repo contains Helm charts for Ushahidi components.

## How to use

Add the repository to your helm installation, i.e.:

helm repo add ushahidi https://github.ushahidi.org/helm-charts

Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 11 additions & 9 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ apiVersion: v1
entries:
ushahidi-platform-api:
- apiVersion: v1
created: "2020-06-21T17:09:22.555221+02:00"
digest: 0f0a59ea378c3187a1746c2a74ead839214ae2a0f01e99a9ad597eec2b3e484a
created: "2020-06-21T21:50:22.046683+02:00"
digest: 3f518c4b021b86f4d1438a6842204f915c649808224cc61087f42f5d8894208c
icon: https://github.ushahidi.org/helm-charts/icon.png
name: ushahidi-platform-api
urls:
- https://github.com/ushahidi/helm-charts/releases/download/ushahidi-platform-api-0.0.1-alpha.1/ushahidi-platform-api-0.0.1-alpha.1.tgz
version: 0.0.1-alpha.1
- https://github.com/ushahidi/helm-charts/releases/download/ushahidi-platform-api-0.0.1-alpha.2/ushahidi-platform-api-0.0.1-alpha.2.tgz
version: 0.0.1-alpha.2
ushahidi-platform-client:
- apiVersion: v1
created: "2020-06-21T17:09:22.724436+02:00"
digest: 1d17b1caf737ea35b689c3eb7fcb1209c5947f646723a877bd7401e9485f0678
created: "2020-06-21T21:50:22.216681+02:00"
digest: b54294242c2fc6ec00ce075d4e6055f9794cf8851371c5bcfef7722ce3dbe236
icon: https://github.ushahidi.org/helm-charts/icon.png
name: ushahidi-platform-client
urls:
- https://github.com/ushahidi/helm-charts/releases/download/ushahidi-platform-client-0.0.1-alpha.1/ushahidi-platform-client-0.0.1-alpha.1.tgz
version: 0.0.1-alpha.1
generated: "2020-06-21T17:09:22.253405+02:00"
- https://github.com/ushahidi/helm-charts/releases/download/ushahidi-platform-client-0.0.1-alpha.2/ushahidi-platform-client-0.0.1-alpha.2.tgz
version: 0.0.1-alpha.2
generated: "2020-06-21T21:50:21.78513+02:00"
47 changes: 47 additions & 0 deletions kustomizers/apply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Applies a string of customizations
#
# Invoke with environment variable K set to list of kustomizers to apply in order.
# Usually invoked as a post renderer to helm, i.e.:
#
# K="deployment-keel-tag ingress-ssl-redirect" \
# helm template platform-api --post-renderer './kustomizers/apply.sh'
#

kbase=`dirname $0`

# work on temporary folder
_tmp=$(mktemp -d 2>/dev/null || mktemp -d -t 'krender')
if [[ ! "$_tmp" || ! -d "$_tmp" ]]; then
echo "Could not create temp dir"
exit 1
fi

function _cleanup {
rm -fr "$_tmp"
}

trap _cleanup EXIT

## Prepare kustomization sequence
# base level: helm output
mkdir "$_tmp/base"
echo "resources: [ helm.yaml ]" > "$_tmp/base/kustomization.yaml"
cat <&0 > "$_tmp/base/helm.yaml"
_base="../base"

# additional folders per customization
_i=1
for k in $K; do
_current=`printf %03d $_i`
echo "current: $_current" >&2
mkdir -p "$_tmp/$_current"
cp -a $kbase/$k/ "$_tmp/$_current"
echo -e "\nbases: [ $_base ]\n" >> "$_tmp/$_current/kustomization.yaml"
#
_base=../$_current
_i=$(($_i + 1))
done

kustomize build $_tmp/`basename $_base`
22 changes: 22 additions & 0 deletions kustomizers/deployment-keel-tag/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patches:
- target:
kind: Deployment
name: (api)|(worker)|(client)
## JSON pointer spec: "~1" translates to "/" character in a dictionary key
patch: |-
[
{"op": "add",
"path": "/metadata/annotations/keel.sh~1policy",
"value": "force"},
{"op": "add",
"path": "/metadata/annotations/keel.sh~1match-tag",
"value": "true"},
{"op": "add",
"path": "/metadata/annotations/keel.sh~1trigger",
"value": "poll"},
{"op": "add",
"path": "/metadata/annotations/keel.sh~1pollSchedule",
"value": "@every 2m"}
]
15 changes: 15 additions & 0 deletions kustomizers/ingress-ssl-redirect/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patches:
- target:
kind: Ingress
## JSON pointer spec: "~1" translates to "/" character in a dictionary key
patch: |-
[
{"op": "add",
"path": "/metadata/annotations/ingress.kubernetes.io~1ssl-redirect",
"value": "true"},
{"op": "add",
"path": "/metadata/annotations/ingress.kubernetes.io~1ssl-proxy-headers",
"value": "X-Forwarded-Proto: https"}
]
3 changes: 2 additions & 1 deletion platform-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1
name: ushahidi-platform-api
version: 0.0.1-alpha.1
version: 0.0.1-alpha.2
icon: https://github.ushahidi.org/helm-charts/icon.png
87 changes: 79 additions & 8 deletions platform-api/templates/api-worker.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{{- if .Values.config.dotenv }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: dotenv
data:
.env: |-
{{ .Values.config.dotenv | indent 4 }}
{{- end }}

---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -39,37 +50,61 @@ spec:
env:
- name: APP_KEY
value: {{ .Values.config.appkey }}
- name: APP_DEBUG
value: {{ .Values.api.debug | quote }}
- name: APP_TIMEZONE
value: {{ .Values.config.timezone }}
- name: DB_CONNECTION
value: mysql
- name: DB_HOST
value: {{ .Values.config.db.host }}
- name: DB_PORT
value: {{ .Values.config.db.port }}
value: {{ .Values.config.db.port | quote }}
- name: DB_DATABASE
value: {{ .Values.config.db.database }}
- name: DB_USERNAME
value: {{ .Values.config.db.username }}
- name: DB_PASSWORD
value: {{ .Values.config.db.password }}
- name: HDX_URL
value: {{ .Values.config.hdx_url }}
- name: MAIL_ADDRESS
value: {{ .Values.config.mail_from.address }}
- name: MAIL_NAME
value: {{ .Values.config.mail_from.name }}
- name: REDIS_HOST
value: {{ .Values.config.redis.host }}
- name: REDIS_PORT
value: {{ .Values.config.redis.port }}
value: {{ .Values.config.redis.port | quote }}
- name: CACHE_DRIVER
value: {{ .Values.config.drivers.cache }}
- name: QUEUE_DRIVER
value: {{ .Values.config.drivers.queue }}
- name: RATELIMITER_CACHE
value: {{ .Values.config.drivers.ratelimiter_cache }}
- { name: DOCKERIZE_TIMEOUT, value: 180s }
- { name: DOCKERIZE_WAIT_FOR_mysql, value: "tcp://mysql:3306" }
- { name: DOCKERIZE_WAIT_FOR_redis, value: "tcp://redis:6379" }
- name: DOCKERIZE_WAIT_FOR_mysql
value: "tcp://{{ .Values.config.db.host }}:{{ .Values.config.db.port }}"
- name: DOCKERIZE_WAIT_FOR_redis
value: "tcp://{{ .Values.config.redis.host }}:{{ .Values.config.redis.port }}"
- name: PHP_EXEC_TIME_LIMIT
value: {{ .Values.api.params.php_exec_time_limit | quote }}
- { name: ENABLE_NGINX, value: "true" }
- { name: ENABLE_PHPFPM, value: "true" }
- { name: ENABLE_PLATFORM_TASKS, value: "false" }
- { name: ENABLE_QUEUE_LISTEN, value: "false" }
- { name: RUN_PLATFORM_MIGRATIONS, value: "true" }
{{- if .Values.config.dotenv }}
- { name: DOTENV_PATH, value: "/var/www/.cfg/dotenv/.env" }
{{- end }}
image: {{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}
imagePullPolicy: Always
name: api
{{- if .Values.config.dotenv }}
volumeMounts:
- name: config-dotenv-file
mountPath: /var/www/.cfg/dotenv
{{- end }}
ports:
- containerPort: 8080
name: http
Expand All @@ -81,6 +116,12 @@ spec:
requests:
cpu: {{ .Values.api.requests.cpu }}
memory: {{ .Values.api.requests.memory }}
{{- if .Values.config.dotenv }}
volumes:
- name: config-dotenv-file
configMap:
name: dotenv
{{- end }}
terminationGracePeriodSeconds: 15

---
Expand Down Expand Up @@ -140,44 +181,72 @@ spec:
env:
- name: APP_KEY
value: {{ .Values.config.appkey }}
- name: APP_DEBUG
value: {{ .Values.api.debug | quote }}
- name: APP_TIMEZONE
value: {{ .Values.config.timezone }}
- name: DB_CONNECTION
value: mysql
- name: DB_HOST
value: {{ .Values.config.db.host }}
- name: DB_PORT
value: {{ .Values.config.db.port }}
value: {{ .Values.config.db.port | quote }}
- name: DB_DATABASE
value: {{ .Values.config.db.database }}
- name: DB_USERNAME
value: {{ .Values.config.db.username }}
- name: DB_PASSWORD
value: {{ .Values.config.db.password }}
- name: HDX_URL
value: {{ .Values.config.hdx_url }}
- name: MAIL_ADDRESS
value: {{ .Values.config.mail_from.address }}
- name: MAIL_NAME
value: {{ .Values.config.mail_from.name }}
- name: REDIS_HOST
value: {{ .Values.config.redis.host }}
- name: REDIS_PORT
value: {{ .Values.config.redis.port }}
value: {{ .Values.config.redis.port | quote }}
- name: CACHE_DRIVER
value: {{ .Values.config.drivers.cache }}
- name: QUEUE_DRIVER
value: {{ .Values.config.drivers.queue }}
- name: RATELIMITER_CACHE
value: {{ .Values.config.drivers.ratelimiter_cache }}
- { name: DOCKERIZE_TIMEOUT, value: 180s }
- { name: DOCKERIZE_WAIT_FOR_mysql, value: "tcp://mysql:3306" }
- { name: DOCKERIZE_WAIT_FOR_redis, value: "tcp://redis:6379" }
- name: DOCKERIZE_WAIT_FOR_mysql
value: "tcp://{{ .Values.config.db.host }}:{{ .Values.config.db.port }}"
- name: DOCKERIZE_WAIT_FOR_redis
value: "tcp://{{ .Values.config.redis.host }}:{{ .Values.config.redis.port }}"
- { name: ENABLE_NGINX, value: "false" }
- { name: ENABLE_PHPFPM, value: "false" }
- { name: ENABLE_PLATFORM_TASKS, value: "true" }
- { name: ENABLE_QUEUE_LISTEN, value: "true" }
- { name: RUN_PLATFORM_MIGRATIONS, value: "false" }
{{- if .Values.config.dotenv }}
- { name: DOTENV_PATH, value: "/var/www/.cfg/dotenv/.env" }
{{- end }}
image: {{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}
imagePullPolicy: Always
name: worker
{{- if .Values.config.dotenv }}
volumeMounts:
- name: config-dotenv-file
mountPath: /var/www/.cfg/dotenv
{{- end }}
resources:
limits:
cpu: {{ .Values.worker.limits.cpu }}
memory: {{ .Values.worker.limits.memory }}
requests:
cpu: {{ .Values.worker.requests.cpu }}
memory: {{ .Values.worker.requests.memory }}
{{- if .Values.config.dotenv }}
volumes:
- name: config-dotenv-file
configMap:
name: dotenv
{{- end }}
terminationGracePeriodSeconds: 15

{{- if .Values.api.ingress.enabled }}
Expand All @@ -188,6 +257,8 @@ metadata:
{{- if .Values.api.ingress.annotations }}
annotations:
{{ toYaml .Values.api.ingress.annotations | indent 4 }}
{{- else }}
annotations: {}
{{- end }}
name: api
spec:
Expand Down
7 changes: 4 additions & 3 deletions platform-api/templates/mysql.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.mysql.enabled }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -31,8 +32,6 @@ spec:
- docker-entrypoint.sh
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
# - --general-log=1
# - --general-log-file=/tmp/queries.log
env:
- name: MYSQL_ROOT_PASSWORD
value: root
Expand Down Expand Up @@ -75,4 +74,6 @@ spec:
selector:
app: platform
service: mysql
type: ClusterIP
type: ClusterIP

{{- end }}
3 changes: 3 additions & 0 deletions platform-api/templates/redis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.redis.enabled }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -62,3 +63,5 @@ spec:
app: platform
service: redis
type: ClusterIP

{{- end }}
Loading

0 comments on commit 2e45a94

Please sign in to comment.