docker-compose up --build
Deploy the project to a kubernetes cluster
kubectl apply -f k8s/db/postgres-pvc.yml
kubectl create configmap fastapi-config --from-env-file=k8s/fastapi/fastapi.env
kubectl apply -f k8s/db/postgres-deployment.yml
kubectl apply -f k8s/fastapi/fastapi-deployment.yml
kubectl apply -f k8s/db/postgres-clip.yml
kubectl apply -f k8s/fastapi/fastapi-clip.yml
kubectl create secret generic pg-user \
--from-literal=PGUSER=< put user name here> \
--from-literal=PGPASSWORD=< put password here>
cd nginx/certs
kubectl create secret generic tls-secret \
--from-file=tls.crt=server.crt \
--from-file=tls.key=server.key\
--from-file=ca.crt=ca_bundle.crt
allow routing. Get the name of your network interface, e.g. eth0 and run
sudo ufw allow in on eth0 && sudo ufw allow out on eth0
sudo ufw default allow routed
apply ingress yml file(s)
kaf k8s/ingress/fastapi-ingress-.yml # for http only
kaf k8s/ingress/fastapi-ingress-ssl.yml # for https
enable improved container support
create personal access token
tag an image
docker build -t ghcr.io/tsadimas/myfastapi:latest -f fastapi.Dockerfile .
cat ~ /github-image-repo.txt | docker login ghcr.io -u tsadimas --password-stdin
docker push ghcr.io/tsadimas/myfastapi:latest
create docker login secret
echo < USER> :< TOKEN> | base64
echo ' {"auths":{"ghcr.io":{"auth":"<AUTH>"}}}' | kubectl create secret generic dockerconfigjson-github-com --type=kubernetes.io/dockerconfigjson --from-file=.dockerconfigjson=/dev/stdin