- Listen requests from frontend on port http :8082.
- Decode body from JSON.
- Encode data into YAML.
- Print structure on the screen.
- Send YAML to DB service on port http :8083 path /add.
For testing without Frontend/Backend/Database, see the "test_services" folder:
https://github.com/Kv-062-DevOps/post_conv_jtoy/tree/master/test_services
In your commanline console open the post_conv_jtoy directory and execute:
minikube start
kubectl apply -f kube/demo-namespace.yaml
kubectl apply -f kube/db-kube.yaml
kubectl apply -f kube
(where the "kube" is a directory with Kubernetes YAML files)
If something wrong because it started in random order - just try again
kubectl apply -f kube
Now open the link from command
minikube service front-srv -n demo --url
in your web browser (for example http://172.17.0.2:30808)
More details about running project in the Minikube see README_MINIKUBE.md:
https://github.com/Kv-062-DevOps/post_conv_jtoy/blob/master/README_MINIKUBE.md
It is recommended to use image from DockerHub: https://hub.docker.com/r/nigth/postconv
docker run --rm --network=host -e BACKADDR="127.0.0.1" nigth/postconv
Or if you want to customize ports:
docker run --rm --network=host -e POSTPORT=8082 -e BACKPORT=8083 -e BACKADDR="127.0.0.1" nigth/postconv
Update to the latest image:
docker pull nigth/postconv
Also you can create and use local image:
docker build -t postlocal .
docker run --rm --network=host -e BACKADDR="127.0.0.1" postlocal
Or if you want to customize ports:
docker run --rm --network=host -e POSTPORT=8082 -e BACKPORT=8083 -e BACKADDR="127.0.0.1" postlocal
How to run the whole project with all services see README_DOCKERS.md:
https://github.com/Kv-062-DevOps/post_conv_jtoy/blob/master/README_DOCKERS.md
At first set the environment variables:
- POSTPORT - "Post port" - on which port this service will listen for JSON data from Frontend;
- BACKPORT - "Backend port" - on which port the YAML converted data will be send to the Backend;
- BACKADDR - "Backend address" - IP or DNS name of the Backend without
http://and path (/addor/list).
For example:
POSTPORT=8082
export POSTPORT=8082
BACKPORT=8083
export BACKPORT=8083
BACKADDR="127.0.0.1"
export BACKADDR="127.0.0.1"
echo $POSTPORT
echo $BACKPORT
echo $BACKADDR
go run main.go
(or execute ./main)
Now you can post requests from Frontend and put them into Database.
- front
- get
- post
- back
- load
- create
- db
For Minikube services add "-srv" (example "front-srv"), for deployments add "-dep" (example: "front-dep").
- emp_id
- first_name
- second_name
- types
- experience
- default_salary
- Python frontend: Listen on 8081 JSON from Go GET service; Send JSON to 8082 Go POST service.
- Go POST service: Listen on 8082 JSON from Python frontend; Send YAML to 8083/add Python DB.
- Python Backend: Listen on 8083/add YAML from Go POST service; Send YAML to 8084 Go GET service.
- Go GET service: Listen on 8084 YAML Python DB; Send JSON to 8081 Python frontend.