Skip to content

Commit 848eaee

Browse files
committed
Initial Helm chart for diffgram.
1 parent 370fd3d commit 848eaee

24 files changed

Lines changed: 592 additions & 0 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
.idea/

Chart.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: cert-manager
3+
repository: https://charts.jetstack.io/
4+
version: v1.1.0
5+
digest: sha256:50d9686126f61b7d7b8a50112464b41ac426a483ae053b4820c9e5f953cf7b76
6+
generated: "2021-01-29T14:30:59.744116786-06:00"

Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: diffgram
3+
description: A Helm for Diffgram
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "0.0.1"

charts/cert-manager-v1.1.0.tgz

179 KB
Binary file not shown.

templates/default/configmap.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: diffgram-default-configmap
5+
data:
6+
USERDOMAIN: {{ .Values.diffgramSettings.USERDOMAIN }}
7+
DIFFGRAM_SYSTEM_MODE: {{ .Values.diffgramSettings.DIFFGRAM_SYSTEM_MODE }}
8+
DIFFGRAM_STATIC_STORAGE_PROVIDER: {{ .Values.diffgramSettings.DIFFGRAM_STATIC_STORAGE_PROVIDER }}
9+
DIFFGRAM_S3_BUCKET_NAME: {{ .Values.diffgramSettings.DIFFGRAM_S3_BUCKET_NAME }}
10+
ML__DIFFGRAM_S3_BUCKET_NAME: {{ .Values.diffgramSettings.ML__DIFFGRAM_S3_BUCKET_NAME }}
11+
GOOGLE_APPLICATION_CREDENTIALS: /etc/gcp/sa_credentials.json # Check the volume in deployment.yaml and service_account_secret.yaml
12+
CLOUD_STORAGE_BUCKET: {{ .Values.diffgramSettings.CLOUD_STORAGE_BUCKET }}
13+
ML__CLOUD_STORAGE_BUCKET: {{ .Values.diffgramSettings.ML__CLOUD_STORAGE_BUCKET }}
14+
URL_BASE: {{ .Values.diffgramDomain }}
15+
PYTHONPATH: /app

templates/default/deployment.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: diffgram-default
6+
name: diffgram-default
7+
namespace: default
8+
spec:
9+
replicas: {{ .Values.defaultService.numReplicas }}
10+
selector:
11+
matchLabels:
12+
app: diffgram-default
13+
template:
14+
metadata:
15+
labels:
16+
app: diffgram-default
17+
spec:
18+
imagePullSecrets:
19+
- name: diffgramsecret
20+
volumes:
21+
- name: service-account-credentials-volume
22+
secret:
23+
secretName: gcp-service-account-credentials
24+
items:
25+
- key: sa_json
26+
path: sa_credentials.json
27+
initContainers:
28+
- name: check-db-ready
29+
image: postgres:9.6.5
30+
{{ if eq .Values.dbSettings.dbProvider "local"}}
31+
command: ['sh', '-c',
32+
'until pg_isready -h diffgram-postgres -p 5432;
33+
do echo waiting for database; sleep 2; done;']
34+
{{ end }}
35+
{{ if eq .Values.dbSettings.dbProvider "rds"}}
36+
command: ['sh', '-c', 'until pg_isready -h postgres-rds-service -p 5432; do echo waiting for database; sleep 2; done;']
37+
{{ end }}
38+
- name: run-migrations
39+
imagePullPolicy: Always
40+
image: gcr.io/diffgram-001/default:{{ .Values.diffgramVersion }}
41+
envFrom:
42+
- configMapRef:
43+
name: diffgram-default-configmap
44+
- secretRef:
45+
name: diffgram-default-secrets
46+
command: ["sh","-c", "cd shared; export PYTHONPATH=/app; pip install sqlalchemy-utils==0.36.6;python /app/testing_and_other/create_database.py; alembic upgrade head"]
47+
containers:
48+
- image: gcr.io/diffgram-001/default:{{ .Values.diffgramVersion }}
49+
imagePullPolicy: Always
50+
name: diffgram-default
51+
ports:
52+
- containerPort: 8080
53+
volumeMounts:
54+
- name: service-account-credentials-volume
55+
mountPath: /etc/gcp
56+
readOnly: true
57+
envFrom:
58+
- configMapRef:
59+
name: diffgram-default-configmap
60+
- secretRef:
61+
name: diffgram-default-secrets
62+
resources:
63+
requests:
64+
cpu: {{ .Values.defaultService.requests.cpu }}
65+
memory: {{ .Values.defaultService.requests.memory }}
66+
limits:
67+
cpu: {{ .Values.defaultService.limits.cpu }}
68+
memory: {{ .Values.defaultService.limits.memory }}

templates/default/secrets.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: diffgram-default-secrets
5+
type: Opaque
6+
stringData:
7+
STRIPE_API_KEY: {{ .Values.diffgramSecrets.STRIPE_API_KEY }}
8+
DIFFGRAM_AWS_ACCESS_KEY_SECRET: {{ .Values.diffgramSecrets.DIFFGRAM_AWS_ACCESS_KEY_SECRET }}
9+
_ANALYTICS_WRITE_KEY: {{ .Values.diffgramSecrets._ANALYTICS_WRITE_KEY }}
10+
MAILGUN_KEY: {{ .Values.diffgramSecrets.MAILGUN_KEY }}
11+
HUB_SPOT_KEY: {{ .Values.diffgramSecrets.HUB_SPOT_KEY }}
12+
SECRET_KEY: {{ .Values.diffgramSecrets.SECRET_KEY }}
13+
INTER_SERVICE_SECRET: {{ .Values.diffgramSecrets.INTER_SERVICE_SECRET }}
14+
{{ if eq .Values.dbSettings.dbProvider "local"}}
15+
DATABASE_URL: "postgresql+psycopg2://{{ .Values.dbSettings.dbUser }}:{{ .Values.dbSettings.dbPassword }}@diffgram-postgres/{{ .Values.dbSettings.dbName }}"
16+
{{ end }}
17+
{{ if eq .Values.dbSettings.dbProvider "rds"}}
18+
DATABASE_URL: "postgresql+psycopg2://{{ .Values.dbSettings.dbUser }}:{{ .Values.dbSettings.dbPassword }}@postgres-rds-service/{{ .Values.dbSettings.dbName }}"
19+
{{ end }}
20+
USER_PASSWORDS_SECRET: {{ .Values.diffgramSecrets.USER_PASSWORDS_SECRET }}

templates/default/service.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app: diffgram-default
6+
name: diffgram-default
7+
namespace: default
8+
spec:
9+
ports:
10+
- port: 8080
11+
protocol: TCP
12+
targetPort: 8080
13+
selector:
14+
app: diffgram-default
15+
type: ClusterIP

templates/frontend/deployment.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: frontend
6+
name: frontend
7+
namespace: default
8+
spec:
9+
replicas: {{ .Values.frontendService.numReplicas }}
10+
selector:
11+
matchLabels:
12+
app: frontend
13+
template:
14+
metadata:
15+
labels:
16+
app: frontend
17+
spec:
18+
imagePullSecrets:
19+
- name: diffgramsecret
20+
containers:
21+
- image: gcr.io/diffgram-001/frontend:{{ .Values.diffgramVersion }}
22+
imagePullPolicy: Always
23+
name: frontend
24+
resources:
25+
requests:
26+
cpu: {{ .Values.frontendService.requests.cpu }}
27+
memory: {{ .Values.frontendService.requests.memory }}
28+
limits:
29+
cpu: {{ .Values.frontendService.limits.cpu }}
30+
memory: {{ .Values.frontendService.limits.memory }}

templates/frontend/service.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app: frontend
6+
name: frontend
7+
namespace: default
8+
spec:
9+
ports:
10+
- port: 8080
11+
protocol: TCP
12+
targetPort: 80
13+
selector:
14+
app: frontend
15+
type: ClusterIP

0 commit comments

Comments
 (0)