This is a simple http node server with EJS templates.
Environment :
API_URL
: base url to the api
Simple golang http server using gin which connects to a postgresql database.
It also runs migrations at start if configured so.
Environment :
PG_USER
: Username of the user in the postgresql databasePG_PASSWORD
: Password of the user in the postgresql databasePG_HOSTNAME
: Hostname of the machine running postgresqlPG_DATABASE
: Name of the database to connect toENV
: Mode to run the api in. Possible values :dev
: runs migrations and start http servermigrate
: runs migrations and exit
- Docker Engine
- Docker Compose as standalone binaries
git clone https://github.com/do3-2023/mmo-kube
cd mmo-kube
# start the application
docker compose up -d
# access it
curl http://localhost:8080/
cd webapp # or api
# build it
docker build -t "$IMAGE_NAME:$TAG"
# push it
docker push "$IMAGE_NAME:$TAG"
mkdir /tmp/k3dvol
k3d cluster create mmo --api-port 6550 -p "1024:80@loadbalancer" --agents 2 --volume /tmp/k3dvol:/k3dvol
What does it do ?
-p
options maps the nodeport 80 which is the nodeport traefik is listening on to the 1024 port on your machine--volume
option creates a volume on your machine so that persistent volumes can be retained--agents
add two workers--api-port
is the port of the kubeapi (optional)
k3d kubeconfig get mmo > ~/.kube/config
kubectl apply -f .kube/common/namespace
kubectl apply -f .kube/db
kubectl apply -f .kube/api
kubectl apply -f .kube/webapp
curl http://localhost:1024
kubectl delete deployment -n data db
kubectl get pods -n back
kubectl get pods -n front
They should not be ready.
kubectl apply -f .kube/db/deployment.yml
kubectl get pods -n back
kubectl get pods -n front
They should now be ready again. And the data should have been persisted.
k3d cluster rm mmo
sudo rm -rf /tmp/k3dvol