Skip to content

repodevs/flask-microservices-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FLASK MICROSERVICES

This project is based on testdriven.io Microservices with Docker, Flask and React

Structure

  1. flask-microservices-main Docker Compose files, Nginx, admin scripts
  2. flask-microservices-users Flask App
  3. flask-microservices-client client-side based on ReactJS

How To Run


  1. install dependencies
$ npm install 
  1. add react users service url
$ export REACT_APP_USERS_SERVICE_URL=http://localhost:5555
  1. run it
$ npm start

In the flask-microservices-users run the server

$ source env/bin/activate
$ export APP_SETTINGS=project.config.DevelopmentConfig
$ export DATABASE_URL=postgres://postgres:postgres@localhost:5432/users_dev
$ export DATABASE_TEST_URL=postgres://postgres:postgres@localhost:5432/users_test

## create and seed database
$ python manage.py recreate_db
$ python manage.py seed_db
$ python manage.py runserver -p 5555

Other Command

To Build Docker image React App:

$ docker build -t "test" ./ --build-arg NODE_ENV=development --build-arg REACT_APP_USERS_SERVICE_URL=http://FLASK_SERVER_URL

To run the test image:

$ docker run -d -p 9000:9000 test

To view container's environment:

$ docker exec CONTAINER_ID bash -c 'env'

To stop and remove container:

$ docker stop CONTAINER_ID
$ docker rm CONTAINER_ID

To remove the image:

$ docker rmi test