Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yonathanguez/to_do_8200ac
Fullstack Development Exercise
https://github.com/yonathanguez/to_do_8200ac
Last synced: about 1 month ago
JSON representation
Fullstack Development Exercise
- Host: GitHub
- URL: https://github.com/yonathanguez/to_do_8200ac
- Owner: YonathanGuez
- License: mit
- Created: 2021-03-10T14:15:38.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-03T12:24:53.000Z (about 1 year ago)
- Last Synced: 2023-10-03T21:57:44.525Z (about 1 year ago)
- Language: JavaScript
- Size: 981 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# to_do_8200AC
Devops/Fullstack Development Exercise
Training development : Nodejs / React / SQL
Training containerization: docker / docker-compose / KubernetesDocker-Compose (DEV and PROD) Full-Stack App ReactJS / NodeJS / PostgreSQL / Nginx :
In this project i build a simple website TODOLIST in ReactJS with a server Nodejs and Database PostgresSQLI build some docker-compose for Development and Production
(I add in production a Proxy server Nginx and Database Mongodb in Backup )## Environment:
Windows 10
Docker version 20.10.5
Docker Engine version: 19.03.5## Test on docker-compose
### Install PRODUCTION PostgreSQL React Node Nginx and Backup MongoDB:
```
docker-compose -f docker-compose.prod.yml up
```### Install DEVELOPMENT PostgreSQL React Node :
Save the file and run Docker Compose from the same directory:
```
docker-compose up -d
```In this version we have Backend frontend and Postgress
### Check The WebSite :
With Chrome of other Browser:
```
http://IP_DOCKER:3000
```Example with Windows 10 :
docker is configured to use the default machine with IP 192.168.99.100```
http://192.168.99.100:3000
```### Debug Container:
Check Log:
```
docker logs -f
```Stop Container:
```
docker stop $(docker ps -a -q)
```Delete all containers:
```
docker rm -f $(docker ps -a -q)
```Remove all volume:
```
docker volume rm $(docker volume ls -q)
```Build Test Dockerfile.prod only:
```
docker build -f Dockerfile.prod -t test .
```Run Test Dockerfile.prod only:
```
docker run -d --name test1 -p 80:80 test
```Enter in my container:
```
docker exec -it mycron
```## Dev: With Backup Mongodb :
For this step i think to export my data in CSV
and after that import the CSV to MONGODBWe need to build a cron for this step that will do it each minute
```
docker-compose -f docker-compose.dev.yml up
```### Build Cron in Docker:
/backup:
```
docker build -t cron .
```run and check logs in same time :
```
docker run -it --name cron cron
```## Test Production with docker-compose
we use environment variable for nginx :
```
docker-compose -f docker-compose.prod.nginx.yml up
```## Test Production with kubernetes:
### Deployment DataBase postgres :
For this example we will deploy a database with a volume in the local windows
so i did 2 volumes one for stock all database the second for give him the script for build the db automatic like database test (we do a clean db at each lifecycle )#### 1) config volume in your local on windows:
line 31 you need to change the path were you want to put the db, for me i choose c:/tmp (this folder must be empty for beginning)
```
path: '/run/desktop/mnt/host/c/tmp/'
```line 60 you need to indicate where is you file ini/test-prod.sql project for build your db ,for me i choose C:\Users\YONATHAN\Desktop\projects\to_do_8200AC\init\test-prod.sql
```
path: '/run/desktop/mnt/host/c/Users/YONATHAN/Desktop/projects/to_do_8200AC/init'
```#### 2) Deploy:
```
kubectl apply -f ./server/postgres-deployment.yml
```check if everything it s okay :
```
kubectl get all
kubectl logs pod/NAME_POD_POSTGRES
```you can check also if you have some new folder in the c:/tmp
### Deployment server :
#### 1) before to deploy a put all my image in my private register local :
```
docker build -t localhost:5000/to_do_8200ac-todo-api:latest -f Dockerfile.prod .
```push in register
```
docker push localhost:5000/to_do_8200ac-todo-api:latest
```#### 2) deployment
```
kubectl apply -f ./server/deployment.yml
```the api will connect to the db with the service build by the deployment postgres
You can check that with :
```
http://127.0.0.1:4000/api/client
```result:
{"tasks":[],"status":"success","message":"all Tasks"}### Deployment client :
#### 1) before to deploy a put all my image in my private register local :
```
docker build -t localhost:5000/to_do_8200ac-web-app:latest -f Dockerfile.prod .
```push in register
```
docker push localhost:5000/to_do_8200ac-web-app:latest
```#### 2) deployment
```
kubectl apply -f ./client/deployment.yml
```the client will connect to the api with call of api/client (nginx do the proxypass to the api server) :
```
location /api/client {
proxy_pass http://create-todo-api-service:4000;
...
```we can check all the connection with playing on the site :
google:```
http://127.0.0.1:31000/
```