Skip to content

Commit

Permalink
add committees-next nginx, traefik and committees package
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Jan 30, 2018
1 parent fe317d0 commit 8442d06
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 10 deletions.
41 changes: 41 additions & 0 deletions charts-external/pipelines-jobs/templates/committee-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: pipeline-committee-package-ops-envfrom
data:
INITIAL_SYNC_SCRIPT: |
mkdir -p /pipelines/data/committees/meeting_protocols_text &&\
mkdir -p /pipelines/data/committees/meeting_protocols_parts &&\
mkdir -p /pipelines/data/committees/kns_cmtsessionitem &&\
mkdir -p /pipelines/data/committees/kns_committeesession &&\
gsutil -m rsync -r gs://knesset-data-pipelines/data/committees/meeting_protocols_text/ \
/pipelines/data/committees/meeting_protocols_text/
gsutil -m rsync -r gs://knesset-data-pipelines/data/committees/meeting_protocols_parts/ \
/pipelines/data/committees/meeting_protocols_parts/
gsutil -m rsync -r gs://knesset-data-pipelines/data/committees/kns_cmtsessionitem/ \
/pipelines/data/committees/kns_cmtsessionitem/
gsutil -m rsync -r gs://knesset-data-pipelines/data/committees/kns_committeesession/ \
/pipelines/data/committees/kns_committeesession/
---
apiVersion: v1
kind: ConfigMap
metadata:
name: pipeline-committee-package-envfrom
data:
PIPELINES_SCRIPT: |
cd /pipelines &&\
(
RES=0;
! run_pipeline ./committees/gcs_list_files && RES=1;
! run_pipeline ./committees/join-meetings && RES=1;
! run_pipeline ./committees/meetings_datapackage_zip && RES=1;
rm -rf /pipelines/data/committees/meeting_protocols_text;
rm -rf /pipelines/data/committees/meeting_protocols_parts;
rm -rf /pipelines/data/committees/kns_cmtsessionitem;
rm -rf /pipelines/data/committees/kns_committeesession;
exit $RES
)
---
{{ dict "name" "pipeline-committee-package" "Values" .Values "enabled" .Values.committeesPackage.enabled "opsEnvFrom" true "allowPipelineOps" true | include "pipeline-job" }}
6 changes: 5 additions & 1 deletion environments/production/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pipelines-jobs:

# download and parse committee protocols
committeesProtocols: {"enabled": true}
committeesProtocolsParse: {"enabled": true}
committeesPackage: {"enabled": true}

# build the meetings html pages
committeesBuildMeetings: {"enabled": true}
Expand All @@ -34,6 +34,8 @@ traefik:
acmeDomains: |
[[acme.domains]]
main = "production.oknesset.org"
[[acme.domains]]
main = "committees-next.oknesset.org"
acmeEmail: [email protected]
dnsProvider: route53
# AWS IAM user name = oknesset-route53-api
Expand All @@ -44,3 +46,5 @@ traefik:
# gcloud compute addresses describe oknesset-production-traefik --region=us-central1 | grep ^address:
loadBalancerIP: "35.184.112.37"
enableLoadBalancer: true
enableCommitteesNext: true
committeesNextDomain: committees-next.oknesset.org
12 changes: 11 additions & 1 deletion templates/nginx-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ kind: ConfigMap
metadata:
name: nginx-conf
data:
# default backend from traefik
default.conf: |
server {
listen 80;
Expand Down Expand Up @@ -51,6 +50,17 @@ data:
{{ end }}
}
{{ if .Values.traefik.enableCommitteesNext }}
server {
listen 81;
server_name _;
location / {
proxy_pass https://storage.googleapis.com/knesset-data-pipelines/data/dist/;
}
}
{{ end }}
healthcheck.inc: |
location = / {
return 200 'it works!';
Expand Down
12 changes: 8 additions & 4 deletions templates/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ spec:
ports:
- name: "80"
port: 80
{{ if .Values.traefik.enableCommitteesNext }}
- name: "81"
port: 81
{{ end }}
selector:
app: nginx
---
Expand All @@ -29,10 +33,10 @@ spec:
image: nginx:alpine
ports:
- containerPort: 80
resources:
requests:
cpu: 50m
memory: 100Mi
{{ if .Values.traefik.enableCommitteesNext }}
- containerPort: 81
{{ end }}
resources: {"requests": {"cpu": "20m", "memory": "20Mi"}}
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/conf.d
Expand Down
14 changes: 14 additions & 0 deletions templates/traefik-etc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,27 @@ data:
[backends.nginx]
[backends.nginx.servers.server1]
url = "http://nginx:80"

{{ if .Values.traefik.enableCommitteesNext }}
[backends.committeesnext]
[backends.committeesnext.servers.server1]
url = "http://nginx:81"
{{ end }}
{{ end }}

[frontends]
{{ if .Values.nginx.enabled }}
[frontends.default]
backend="nginx"
passHostHeader = true

{{ if .Values.traefik.enableCommitteesNext }}
[frontends.committeesnext]
backend="committeesnext"
passHostHeader = true
[frontends.committeesnext.routes.route1]
rule = "Host: {{ .Values.traefik.committeesNextDomain }};"
{{ end }}
{{ end }}

{{ end }}
7 changes: 3 additions & 4 deletions templates/traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
# initops container - copies the acme data from last backup before starting up the pod
- name: initops
image: gcr.io/uumpa-public/sk8s-google-storage-sync:v0.0.2
resources: {"requests": {"cpu": "1m", "memory": "2Mi"}}
resources: {"requests": {"cpu": "20m", "memory": "20Mi"}}
command:
- bash
- "-c"
Expand All @@ -60,7 +60,7 @@ spec:
containers:
- name: ops
image: gcr.io/uumpa-public/sk8s-google-storage-sync:v0.0.2
resources: {"requests": {"cpu": "1m", "memory": "2Mi"}}
resources: {"requests": {"cpu": "20m", "memory": "20Mi"}}
command:
- bash
- "-c"
Expand Down Expand Up @@ -102,8 +102,7 @@ spec:
ports:
- {containerPort: 80}
- {containerPort: 443}
resources:
requests: {cpu: 20m}
resources: {"requests": {"cpu": "50m", "memory": "50Mi"}}
volumeMounts:
- name: etc-traefik
mountPath: /etc-traefik
Expand Down

0 comments on commit 8442d06

Please sign in to comment.