Giter VIP home page Giter VIP logo

toy-book-app's Introduction

Deployment setup

Build Images:

# Reviews
gw clean bootBuildImage

# Users
gw clean bootBuildImage

# Catalog
./mvnw clean spring-boot:build-image -DskipTests

# Catalog Finder
gw clean bootBuildImage

# Graphql server
npm run build:docker

Start minikube:

minikube start --driver=docker --mount-string="/home/awest/dev/alecwest/toy-book-app/data:/mnt/postgresql" --mount --disk-size=40000

Apply PV and PVC

kc apply -f postgresql-pv0.yaml
kc apply -f postgresql-pvc0.yaml

Follow steps at https://arctype.com/blog/deploy-postgres-kubernetes/ to deploy a helm chart for postgresql with a persistence volume configured.

> helm install postgresql bitnami/postgresql --set primary.persistence.existingClaim=postgres-claim0 --set volumePermissions.enabled=true


NAME: postgresql
LAST DEPLOYED: Sat Sep 16 06:58:45 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: postgresql
CHART VERSION: 12.11.2
APP VERSION: 15.4.0

** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster:

    postgresql.default.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)

To connect to your database run the following command:

    kubectl run postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:15.4.0-debian-11-r10 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
      --command -- psql --host postgresql -U postgres -d postgres -p 5432

    > NOTE: If you access the container using bash, make sure that you execute "/opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash" in order to avoid the error "psql: local user with ID 1001} does not exist"

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432

WARNING: The configured password will be ignored on new installation in case when previous PostgreSQL release was deleted through the helm command. In that case, old PVC will have an old password, and setting it through helm won't take effect. Deleting persistent volumes (PVs) will

Ensure the database has all the initial database setup for each of users_database, catalog_database, reviews_database

CREATE DATABASE EXAMPLE_DB;
CREATE USER EXAMPLE_USER WITH ENCRYPTED PASSWORD 'Sup3rS3cret';
GRANT ALL PRIVILEGES ON DATABASE EXAMPLE_DB TO EXAMPLE_USER;
\c EXAMPLE_DB postgres
# You are now connected to database "EXAMPLE_DB" as user "postgres".
# *** NEW as of postgres 15 ***
GRANT ALL ON SCHEMA public TO EXAMPLE_USER;

Apply the other deployments

kc apply -f deployment-catalog.yaml
kc apply -f deployment-catalog-finder.yaml
kc apply -f deployment-reviews.yaml
kc apply -f deployment-users.yaml
kc apply -f deployment-graphql.yaml
kc apply -f deployment-frontend.yaml

Notes

  • run minikube service graphql to open graphql in the browser
  • run minikube service frontend to open the frontend in the browser
  • run minikube service graphql --url to just get a url of the service accessible from the host machine
  • run helm delete postgresql to remove

toy-book-app's People

Contributors

alecwest avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.