Add the canary service to production

YAY
This commit is contained in:
R. Tyler Croy 2017-09-03 12:52:56 -07:00
parent 05f7fe4a76
commit f71bf3d7a8
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
3 changed files with 58 additions and 0 deletions

45
k8s/canary.yaml Normal file
View File

@ -0,0 +1,45 @@
---
apiVersion: "v1"
kind: "List"
items:
- apiVersion: "v1"
kind: "ReplicationController"
metadata:
name: 'canary'
labels:
name: 'canary'
spec:
replicas: 3
template:
metadata:
name: 'canary'
labels:
name: 'canary'
spec:
containers:
- name: 'canary'
image: 'rtyler/codevalet-canary:latest'
imagePullPolicy: Always
ports:
- containerPort: 9292
env:
- name: PRODUCTION
value: 'true'
- name: SENTRY_DSN
valueFrom:
secretKeyRef:
name: webapp
key: sentry
- name: SENTRY_API_TOKEN
valueFrom:
secretKeyRef:
name: canary
key: sentry
livenessProbe:
httpGet:
path: /
port: 9292
initialDelaySeconds: 60
timeoutSeconds: 10
# vim: ft=yaml

View File

@ -27,6 +27,16 @@ server {
# Need to do this before the catch-all location below
include /etc/nginx/monkeys.conf;
location /canary {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://$canary:$canary_port;
}
location / {
proxy_redirect off;
proxy_set_header Host $http_host;

View File

@ -11,6 +11,9 @@ cat > /etc/nginx/vars.conf << EOF
set \$webapp ${WEBAPP_SERVICE_HOST:-dummy-host};
set \$webapp_port ${WEBAPP_SERVICE_PORT:-80};
set \$canary ${CANARY_SERVICE_HOST:-dummy-host};
set \$canary_port ${CANARY_SERVICE_PORT:-80};
EOF