Deploy an app into your personal cloud
rhazn
Posted on September 17, 2019
As the final step in this long series of blogposts we are going to deploy a simple webapp in a docker container to my personal cloud. For context here is the personal cloud setup with Traefik/Let's Encrypt (Run a personal cloud with Traefik, Let's encrypt and Zookeeper).
In previous blogposts I also described how I built the app (Build a PWA in docker).
App deployment
The deployment runs the docker container. If you follow my personal cloud setup make sure to use more than one replica as the nature of preemtive VMs means one replica might randomly get shut down.
Note that the image will be set and updated by gitlab ci as described here: (Deploy to google kubernetes engine using gitlab ci).
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: ???-app
spec:
replicas: 3
template:
metadata:
labels:
app: ???-app
spec:
terminationGracePeriodSeconds: 60
containers:
- name: ???-app
image: "eu.gcr.io/???/app:latest"
The service and traefik ingress
apiVersion: v1
kind: Service
metadata:
name: ???-app
spec:
selector:
app: ???-app
ports:
- name: web
port: 80
targetPort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ???-app
annotations:
kubernetes.io/ingress.class: traefik
traefik.frontend.passHostHeader: "false"
traefik.frontend.priority: "1"
spec:
rules:
- host: app.???.com
http:
paths:
- path: /
backend:
serviceName: ???-app
servicePort: web
Updating the traefik config
Updating the traefik config is important so traefik requests a new HTTPS certificate for the app from Let's encrypt. You will need to add this line to the traefik toml file that is described here (Run a personal cloud with Traefik, Let's encrypt and Zookeeper):
[[acme.domains]]
main = "app.???.com"
DNS
Now you can just point the A record of your domain to the traefik external IP and the rest will automatically be handled by your personal cloud :).
About Me
I am a full stack developer and digital product enthusiast, I am available for freelance work and always looking for the next exciting project :).
You can reach me online at https://heltweg.org.
Posted on September 17, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.