Implementation of API Pen and Paper DM Helper
git clone [email protected]:xome/PenAndPaperDmHelperBackendSpringPostgres.git
cd PenAndPaperDmHelperBackendSpringPostgresNeeds local docker daemon for Testcontainers
mvn testDefine local directory for database files and password for connection:
Unix:
printf "PATH_TO_DB=/path/to/persist/postgres/data\n" > .env
printf "DB_PASSWORD=changeit\n" >> .env
printf "DB_USER=dmhelper\n" >> .env
printf "DB_URL=db\n" >> .env
printf "DB_NAME=dmhelper\n" >> .env
printf "DB_PORT=5432\n" >> .env
printf "APP_PORT=8080\n" >> .envWindows Powershell:
echo "PATH_TO_DB=//drive/path/to/persist/postgres/data`nDB_PASSWORD=changeit`nDB_USER=dmhelper`nDB_URL=db`nDB_NAME=dmhelper`nDB_PORT=5432`nAPP_PORT=8080`n`" > .envBuild images:
docker compose buildRun:
docker-compose up -dVerify that app is running:
curl -X PUT localhost:8080/adventure/Testadventure
curl localhost:8080/adventuresBuild images:
docker compose buildCreate Secrets for DB:
kubectl create secret generic pen-and-paper-dm-helper-db-user \
--from-literal=db_user=dmhelper \
--from-literal=db_password=dmhelperCreate Pods, Services and ConfigMap:
cd .k8s
kubectl apply -f '*.yaml'Then choose either single pod:
kubectl apply -f app/app-pod.yamlOr ReplicaSet:
kubectl apply -f app/app-rs.yamlOr Deployment:
kubectl apply -f app/app-deploy.yamlVerify that app is running:
PNP_BACKEND_PORT=$(kubectl get service pen-and-paper-dm-helper-service \
-o jsonpath='{.spec.ports[0].nodePort}')
curl -X PUT localhost:$PNP_BACKEND_PORT/adventure/Testadventure
curl localhost:$PNP_BACKEND_PORT/adventures