Skip to content

Commit

Permalink
Adds Kubernetes deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
tantalic committed Oct 4, 2016
1 parent 14523b0 commit 9714d1e
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,14 @@ docker run \
tantalic/bellinghamcodes-website:latest
```

## Running in Production
The production site runs on a [Kubernetes][k8s] cluster. To deploy on Kubernetes copy the `kubernetes/secrets.example.yaml` to `kubernetes/secrets.yaml` and complete the required values. Then run:

```sh
cd kubernetes/
./apply.sh
```

[go]: http://www.golang.org
[glide]: https://glide.sh
[k8s]: http://kubernetes.io
1 change: 1 addition & 0 deletions kubernetes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
secrets.yaml
8 changes: 8 additions & 0 deletions kubernetes/apply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

NAMESACE=bellinghamcodes

kubectl apply -f namespace.yaml
kubectl --namespace=${NAMESACE} apply -f ./secrets.yaml
kubectl --namespace=${NAMESACE} apply -f ./service.yaml
kubectl --namespace=${NAMESACE} apply -f ./deployment.yaml
38 changes: 38 additions & 0 deletions kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: website
spec:
replicas: 1
template:
metadata:
labels:
app: website
spec:
containers:
- image: tantalic/bellinghamcodes-website:latest
name: api
ports:
- containerPort: 80
protocol: TCP
env:
- name: SLACK_TEAM
valueFrom:
secretKeyRef:
name: slack
key: team
- name: SLACK_TOKEN
valueFrom:
secretKeyRef:
name: slack
key: token
- name: MAILCHIMP_TOKEN
valueFrom:
secretKeyRef:
name: mailchimp
key: token
- name: MAILCHIMP_LIST
valueFrom:
secretKeyRef:
name: mailchimp
key: list
4 changes: 4 additions & 0 deletions kubernetes/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: bellinghamcodes
21 changes: 21 additions & 0 deletions kubernetes/secrets.example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The following example shows the secrets that should be defined for a
# kubernetes deployment

apiVersion: v1
kind: Secret
metadata:
name: slack
type: Opaque
data:
team:
token:
---
apiVersion: v1
kind: Secret
metadata:
name: mailchimp
type: Opaque
data:
token:
list:
---
18 changes: 18 additions & 0 deletions kubernetes/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: website
labels:
name: website
router.deis.io/routable: "true"
annotations:
router.deis.io/domains: bellingham.codes,www.bellingham.codes
spec:
type: ClusterIP
selector:
app: website

ports:
- name: http
port: 80
protocol: TCP

0 comments on commit 9714d1e

Please sign in to comment.