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/k3dvolk3d cluster create mmo --api-port 6550 -p "1024:80@loadbalancer" --agents 2 --volume /tmp/k3dvol:/k3dvolWhat does it do ?
-poptions maps the nodeport 80 which is the nodeport traefik is listening on to the 1024 port on your machine--volumeoption creates a volume on your machine so that persistent volumes can be retained--agentsadd two workers--api-portis the port of the kubeapi (optional)
k3d kubeconfig get mmo > ~/.kube/configkubectl apply -f .kube/common/namespace
kubectl apply -f .kube/db
kubectl apply -f .kube/api
kubectl apply -f .kube/webappcurl http://localhost:1024kubectl delete deployment -n data dbkubectl get pods -n back
kubectl get pods -n frontThey should not be ready.
kubectl apply -f .kube/db/deployment.ymlkubectl get pods -n back
kubectl get pods -n frontThey should now be ready again. And the data should have been persisted.
k3d cluster rm mmo
sudo rm -rf /tmp/k3dvol