rdempsey / testdriven-app

Microservices with Docker, Flask, and React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Microservices with Docker, Flask, and React

Build Status

This application is an example of a micro-services architecture using Docker, Flask and React from the online course, Microservices with Docker, Flask, and React

Manage the Application

  • Deploy the application: docker-compose -f docker-compose-dev.yml up -d --build
  • Create the database: docker-compose -f docker-compose-dev.yml run users python manage.py recreate-db
  • Seed the database: docker-compose -f docker-compose-dev.yml run users python manage.py seed-db
  • Run the Python tests: docker-compose -f docker-compose-dev.yml run users python manage.py test
  • Run the Python tests with coverage: docker-compose -f docker-compose-dev.yml run users python manage.py cov
  • Run Flake8: docker-compose -f docker-compose-dev.yml run users flake8 project
  • Run the client-side (npm) tests: docker-compose -f docker-compose-dev.yml run client npm test
  • Access the container logs: docker-compose -f docker-compose-dev.yml logs -f
  • Access the Postgres container: docker-compose -f docker-compose-dev.yml exec users-db psql -U postgres

Run a Multi-Stage Docker Build for the Client

docker build -f Dockerfile-prod -t "test" ./ \
  --build-arg NODE_ENV=development \
  --build-arg REACT_APP_USERS_SERVICE_URL=http://127.0.0.1

Running Database Migrations

  • Create a migration repository: docker-compose -f docker-compose-dev.yml run users python manage.py db init
  • Generate an initial migration: docker-compose -f docker-compose-dev.yml run users python manage.py db migrate
  • Apply the migrations to the database: docker-compose -f docker-compose-dev.yml run users python manage.py db upgrade

Access the Application

Working With the Postgres Database

Once you access the Postgres database (see above):

  • Choose the users_dev database: # \c users_dev
  • Describe the users table: # \d+ users
  • Select all of the users: # select * from users;

About

Microservices with Docker, Flask, and React


Languages

Language:Python 61.9%Language:JavaScript 26.5%Language:HTML 8.4%Language:Shell 1.6%Language:Mako 1.3%Language:Dockerfile 0.3%