This application uses a React SPA front-end served by webpack-dev-server. The back-end is powered by Flask and PostgreSQL.
For Docker CE both applications run on and can be accessed at 0.0.0.0:<port>
, if using Docker-Machine, they will run on the IP provided when running docker-machine ip <machine_name>
Please update the .env
file with the proper value for the API_HOST
env variable set under the client
service. This should be the IP of the Flask backend application. Read above for specific IP information
- Run this script using
psql
CLI to setup the database
$ psql
# create database results;
CREATE DATABASE
# \q
-
Install pipenv and related package requirements.
pip install pipenv
pipenv install --python 3.6
-
Create the database.
flask initdb
-
Run the application.
flask run
-
Navigate to the displayed IP.
-
Navigate to the
/client/
directorycd ~/path/to/application/client/
-
Install package dependencies from
package.json
using npmnpm install
-
Run the webpack-dev-server locally (This runs the server on
127.0.0.1:8080
, but will show as0.0.0.0:8080
on Windows and on Linux it WILL run on0.0.0.0:8080
)npm run start-local
The current application can be deployed with Docker in a few commands.
cd ~/path/to/application/
Start here if you DO use docker-machine
docker-machine create -d virtualbox --virtualbox-memory 1024 --virtualbox-cpu-count 1 <machine_name>
docker-machine env <machine_name>
eval "$(docker-machine env <machine_name>)"
...
Start here if you DO NOT use docker-machine
docker-compose up -d
docker-compose run --rm web flask initdb (Only required on first startup of container)
If using docker-machine
you must then access the IP address given by docker-machine ip <machine_name>
directly from your machine along with the appropriate port to access a given service.
All commands against a docker service must be run as docker-compose run [--rm] <service_name> <command>
(--rm to delete the container the command runs in)
- Initialize the database
- Drop the database
- Drop then reinitialize the database
All database data is persisted through volumes
- Run some simple tests against the routes (can be run inside docker as well)
The MIT License (MIT). Please see the license file for more information.