-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from CodeForPhilly/releases/k8s-manifests
Deploy releases/k8s-manifests c12c9cb
- Loading branch information
Showing
13 changed files
with
302 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
data: | ||
DATABASE: postgres | ||
DEBUG: 'FALSE' | ||
DJANGO_ALLOWED_HOSTS: 'frontend localhost 127.0.0.1 [::1]' | ||
EMAIL_HOST: smtp.gmail.com | ||
EMAIL_HOST_USER: [email protected] | ||
EMAIL_PORT: '587' | ||
LOGIN_REDIRECT_URL: 'https://balancertestsite.com/login' | ||
SQL_ENGINE: django.db.backends.postgresql | ||
SQL_PORT: '5432' | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: backend | ||
name: backend-env | ||
namespace: balancer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,82 @@ | ||
apiVersion: v1 | ||
data: | ||
nginx.conf: | | ||
user nginx; | ||
worker_processes 1; | ||
worker_processes 1; | ||
user nobody nogroup; | ||
# 'user nobody nobody;' for systems with 'nobody' as a group instead | ||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
events { | ||
worker_connections 1024; | ||
worker_connections 1024; # increase if you have lots of clients | ||
accept_mutex off; # set to 'on' if nginx worker_processes > 1 | ||
# 'use epoll;' to enable for Linux 2.6+ | ||
# 'use kqueue;' to enable for FreeBSD, OSX | ||
} | ||
http { | ||
include /etc/nginx/mime.types; | ||
error_log /var/log/nginx/error_log; | ||
access_log /var/log/nginx/access_log; | ||
include mime.types; | ||
# fallback in case we can't determine a type | ||
default_type application/octet-stream; | ||
access_log /var/log/nginx/access.log combined; | ||
sendfile on; | ||
upstream gunicorn_server { | ||
# fail_timeout=0 means we always retry an upstream even if it failed | ||
# to return a good HTTP response | ||
# for UNIX domain socket setups | ||
# server unix:/tmp/gunicorn.sock fail_timeout=0; | ||
# for a TCP configuration | ||
# "backend" here is the name of the kubernetes service | ||
server backend:8000 fail_timeout=0; | ||
} | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
# if no Host match, close the connection to prevent host spoofing | ||
listen 80 default_server; | ||
return 444; | ||
} | ||
location /access_log { | ||
alias /var/log/nginx/access_log; | ||
} | ||
location /error_log { | ||
alias /var/log/nginx/error_log; | ||
server { | ||
# use 'listen 80 deferred;' for Linux | ||
# use 'listen 80 accept_filter=httpready;' for FreeBSD | ||
listen 80 deferred; | ||
client_max_body_size 4G; | ||
# set the correct host(s) for your site | ||
server_name localhost; | ||
keepalive_timeout 5; | ||
# path for static files | ||
root /usr/share/nginx/html; | ||
location ~ (^\/api\/|^\/auth\/|^\/admin) { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header Host $http_host; | ||
# we don't want nginx trying to do something clever with | ||
# redirects, we set the Host: header above already. | ||
proxy_redirect off; | ||
proxy_pass http://gunicorn_server; | ||
} | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
#error_page 404 /404.html; | ||
# redirect server error pages to the static page /50x.html | ||
# | ||
#error_page 500 502 503 504 /50x.html; | ||
#location = /50x.html { | ||
# root /usr/share/nginx/html; | ||
#} | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
} | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: frontend | ||
name: nginx-conf | ||
namespace: balancer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: backend | ||
name: backend | ||
namespace: balancer | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/component: backend | ||
strategy: {} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: backend | ||
spec: | ||
containers: | ||
- args: | ||
- gunicorn | ||
- 'balancer_backend.wsgi:application' | ||
- '--bind' | ||
- '0.0.0.0:8000' | ||
env: | ||
- name: SQL_HOST | ||
value: db-service | ||
- name: SQL_USER | ||
valueFrom: | ||
secretKeyRef: | ||
key: POSTGRES_USER | ||
name: postgresql | ||
- name: SQL_DATABASE | ||
valueFrom: | ||
secretKeyRef: | ||
key: POSTGRES_DB | ||
name: postgresql | ||
- name: SQL_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
key: POSTGRES_PASSWORD | ||
name: postgresql | ||
envFrom: | ||
- configMapRef: | ||
name: backend-env | ||
- secretRef: | ||
name: backend | ||
image: 'ghcr.io/codeforphilly/balancer-main/backend:latest' | ||
imagePullPolicy: Always | ||
name: backend | ||
ports: | ||
- containerPort: 8000 | ||
protocol: TCP | ||
resources: {} | ||
restartPolicy: Always |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: frontend | ||
name: frontend | ||
namespace: balancer | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/component: frontend | ||
strategy: {} | ||
template: | ||
metadata: | ||
annotations: | ||
kompose.cmd: kompose convert -c -f docker-compose.prod.yml -o helm-chart | ||
kompose.version: 1.31.2 (a92241f79) | ||
labels: | ||
app.kubernetes.io/component: frontend | ||
io.kompose.network/balancer-main-default: 'true' | ||
spec: | ||
containers: | ||
- image: 'ghcr.io/codeforphilly/balancer-main/frontend:latest' | ||
imagePullPolicy: Always | ||
name: frontend | ||
ports: | ||
- containerPort: 80 | ||
protocol: TCP | ||
resources: {} | ||
volumeMounts: | ||
- mountPath: /etc/nginx/nginx.conf | ||
name: nginx-conf | ||
readOnly: true | ||
subPath: nginx.conf | ||
restartPolicy: Always | ||
volumes: | ||
- configMap: | ||
items: | ||
- key: nginx.conf | ||
path: nginx.conf | ||
name: nginx-conf | ||
name: nginx-conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: / | ||
name: balancer-ingress | ||
namespace: balancer | ||
spec: | ||
rules: | ||
- host: balancer.sandbox.k8s.phl.io | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: frontend | ||
port: | ||
name: http | ||
path: / | ||
pathType: Prefix | ||
- host: balancertestsite.com | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: frontend | ||
port: | ||
name: http | ||
path: / | ||
pathType: Prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: db | ||
name: postgres-data-claim | ||
namespace: balancer | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 100Mi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: backend | ||
name: backend | ||
namespace: balancer | ||
spec: | ||
ports: | ||
- name: gunicorn | ||
port: 8000 | ||
targetPort: 8000 | ||
selector: | ||
app.kubernetes.io/component: backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: db-service | ||
namespace: balancer | ||
spec: | ||
ports: | ||
- port: 5432 | ||
protocol: TCP | ||
selector: | ||
app.kubernetes.io/component: db | ||
type: NodePort |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.