Skip to content

Commit d20e274

Browse files
committed
Update and document deployment process
1 parent 4d90ac0 commit d20e274

File tree

4 files changed

+97
-44
lines changed

4 files changed

+97
-44
lines changed

DEPLOYMENT.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# How to deploy this service
2+
3+
## Docker Image
4+
5+
Build the new Docker image. Check for previous version numbers [on Docker Hub here](https://hub.docker.com/repository/docker/bufferapp/buffer-code-exercise-api).
6+
7+
```
8+
docker build -t bufferapp/buffer-code-exercise-api:<YOUR-NEW-VERSION> .
9+
```
10+
11+
Verify the Docker image runs correctly:
12+
13+
```
14+
docker run --rm -p 8888:8888 bufferapp/buffer-code-exercise-api:<YOUR-NEW-VERSION>
15+
```
16+
```
17+
curl http://localhost:8888
18+
{
19+
"status": "awesome"
20+
}
21+
```
22+
23+
Push the image to Docker hub
24+
25+
```
26+
docker push buffer-code-exercise-api:<YOUR-NEW-VERSION>
27+
```
28+
29+
## Kubernetes Deployemnt
30+
31+
Update the `kubernetes.yaml` file with your new image version and apply the changes (create if the service has been previously deleted).
32+
33+
```
34+
kubectl apply -f kubernetes-deployment.yaml
35+
```
36+
37+
Monitor your rollout:
38+
39+
```
40+
kubectl -n internal get pods -l app=buffer-code-exercise-api
41+
```
42+
43+
## Kubernetes Service
44+
45+
If a change is required to the Kubernetes service, first get the AWS SSL cert ARN from the AWS dashboard, then apply the changes:
46+
47+
```
48+
kubectl apply -f kubernetes-service.yaml
49+
```

kubernetes-deployment.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Update your image tag before applying this file
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: buffer-code-exercise-api
6+
labels:
7+
app: buffer-code-exercise-api
8+
namespace: internal
9+
spec:
10+
replicas: 1
11+
selector:
12+
matchLabels:
13+
app: buffer-code-exercise-api
14+
template:
15+
metadata:
16+
labels:
17+
app: buffer-code-exercise-api
18+
spec:
19+
containers:
20+
- name: api
21+
image: bufferapp/buffer-code-exercise-api:2.0
22+
ports:
23+
- containerPort: 8888
24+
resources:
25+
limits:
26+
cpu: 100m
27+
memory: 200Mi
28+
restartPolicy: Always

kubernetes-service.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Before creating or applying, add the AWS SSL Cert ARN
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: buffer-code-exercise-api
6+
labels:
7+
app: buffer-code-exercise-api
8+
namespace: internal
9+
annotations:
10+
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: <REPLACE W/ VALID CERT ARN>
11+
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
12+
spec:
13+
ports:
14+
- port: 443
15+
targetPort: 8888
16+
protocol: TCP
17+
name: https
18+
selector:
19+
app: buffer-code-exercise-api
20+
type: LoadBalancer

kubernetes.yaml

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)