This project is based on testdriven.io Microservices with Docker, Flask and React
- flask-microservices-main Docker Compose files, Nginx, admin scripts
- flask-microservices-users Flask App
- flask-microservices-client client-side based on ReactJS
- install dependencies
$ npm install
- add react users service url
$ export REACT_APP_USERS_SERVICE_URL=http://localhost:5555
- 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
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