Skip to content

jinyoung/multi-tenancy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker exec -it infra-db-1 /bin/sh
psql --username=postgres
CREATE DATABASE tenant1;
CREATE DATABASE tenant2;
\l


http :8082/login username="user" password="baeldung"  #getting token
http :8082/login username="admin" password="baeldung"  #getting token

pg_dump -h localhost -U postgres -d tenant1 -s > ddl.sql

--
-- PostgreSQL database dump
--

-- Dumped from database version 14.1
-- Dumped by pg_dump version 14.1

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: cooking_table; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.cooking_table (
    id bigint NOT NULL,
    order_id bigint,
    status character varying(255)
);


ALTER TABLE public.cooking_table OWNER TO postgres;

--
-- Name: hibernate_sequence; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.hibernate_sequence
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.hibernate_sequence OWNER TO postgres;

--
-- Name: cooking_table cooking_table_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.cooking_table
    ADD CONSTRAINT cooking_table_pkey PRIMARY KEY (id);


--
-- PostgreSQL database dump complete
--

Model

www.msaez.io/#/storming/food-delivery221

Before Running Services

Make sure there is a Kafka server running

cd kafka
docker-compose up
  • Check the Kafka messages:
cd kafka
docker-compose exec -it kafka /bin/bash
cd /bin
./kafka-console-consumer --bootstrap-server localhost:9092 --topic

Run the backend micro-services

See the README.md files inside the each microservices directory:

  • hunger
  • store owner
  • rider

Run API Gateway (Spring Gateway)

cd gateway
mvn spring-boot:run

Test by API

  • hunger
 http :8088/orders id="id" foodId="foodId" options="options" address="address" customerId="customerId" status="status" 
  • store owner
 http :8088/cookings id="id" status="status" orderId="orderId" 
  • rider
 http :8088/deliveries id="id" address="address" orderId="orderId" status="status" 

Run the frontend

cd frontend
npm i
npm run serve

Test by UI

Open a browser to localhost:8088

Required Utilities

  • httpie (alternative for curl / POSTMAN) and network utils
sudo apt-get update
sudo apt-get install net-tools
sudo apt install iputils-ping
pip install httpie
  • kubernetes utilities (kubectl)
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  • aws cli (aws)
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
  • eksctl
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published