Skip to content

Commit

Permalink
deploy dreams to production --no-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Mar 5, 2018
1 parent f2e70ee commit 47487cb
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 7 deletions.
14 changes: 14 additions & 0 deletions charts-external/dreams/templates/dreams-autoscaler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{ if .Values.enabled }}{{ if .Values.autoscaler.enabled }}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: dreams
spec:
maxReplicas: {{ .Values.autoscaler.maxReplicas }}
minReplicas: {{ .Values.autoscaler.minReplicas }}
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: dreams
targetCPUUtilizationPercentage: {{ .Values.autoscaler.targetCPUUtilizationPercentage }}
{{ end }}{{ end }}
4 changes: 1 addition & 3 deletions charts-external/dreams/templates/dreams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ spec:
image: {{ .Values.image | quote }}
ports:
- containerPort: 3000
resources:
requests:
cpu: 20m
resources: {{ .Values.resources }}
env:
- name: APP_URL
value: {{ .Values.APP_URL }}
Expand Down
4 changes: 1 addition & 3 deletions charts-external/dreams/templates/dreamsdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ spec:
image: "postgres"
ports:
- containerPort: 5432
resources:
requests:
cpu: 20m
resources: {{ .Values.dbResources }}
{{ if .Values.importDB }}
command:
- bash
Expand Down
19 changes: 19 additions & 0 deletions environments/production/dreamsdb_persistent_storage_migration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

source switch_environment.sh production

PERSISTENT_STORAGE_NAME="dreamsdb"

echo "deleting existing ${PERSISTENT_STORAGE_NAME} data from persistent storage (if there is any)"
read -p "press <Enter> to continue"
! gcloud compute ssh midburn-k8s-persistent-storage-vm --command="bash -c 'sudo rm -rf /data/${K8S_ENVIRONMENT_NAME}/${PERSISTENT_STORAGE_NAME}'" && echo failed && exit 1

echo "creating storage"
gcloud compute ssh midburn-k8s-persistent-storage-vm --command="bash -c '
mkdir -p /data/${K8S_ENVIRONMENT_NAME}
! mkdir /data/${K8S_ENVIRONMENT_NAME}/${PERSISTENT_STORAGE_NAME} && echo failed to create ${PERSISTENT_STORAGE_NAME} dir && exit 1
echo setting permissions
sudo chown -R root:root /data/${K8S_ENVIRONMENT_NAME}/${PERSISTENT_STORAGE_NAME}
echo great success
exit 0
'"
9 changes: 8 additions & 1 deletion environments/production/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ traefik:
backupJob: true
enableLoadBalancer: true
# profilesHostsRule: "Host: profile.midburn.org;"
dreamsHostsRule: "Host: dreams.midburn.org;"
# SSLcheckMainDomain: production.midburn.org
# SSLcheckSparkDomain: spark.midburn.org
# SSLcheckProfilesDomain: profile.midburn.org
Expand Down Expand Up @@ -103,8 +104,14 @@ bi:
persistentStorageName: metabase

dreams:
enabled: false
enabled: true
enableSecrets: true
importDB: false
APP_URL: https://dreams.midburn.org/
# persistent storage was setup using environments/staging/dreamsdb_persistent_storage_migration.sh
persistentStorageName: dreamsdb
dbBackupJob: true


chatops:
enabled: true
Expand Down
10 changes: 10 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ bi:

dreams:
enableDeployment: true
resources: >
{"requests": {"cpu": "400m", "memory": "800Mi"}, "limits": {"cpu": "800m", "memory": "1500Mi"}}
dbResources: >
{"requests": {"cpu": "100m", "memory": "150Mi"}, "limits": {"cpu": "200m", "memory": "600Mi"}}
autoscaler:
enabled: false
maxReplicas: 3
minReplicas: 1
targetCPUUtilizationPercentage: 80


chatops:
resources: >
Expand Down

0 comments on commit 47487cb

Please sign in to comment.