This is a project template that creates a Docker environment with useful containers for the Data For Democracy project.
Docker is a technology that allows you to package up all of the dependencies for a project in a portable way. It's like virtual environments, but extending to the whole OS, not just Python packages.
This template sets up a Node webapp server, Flask webapp server, a Conda environment running Jupyter,
and Postgres and MongoDB databases that they can talk to. The idea is that you'll delete the pieces
that you don't intend to use (remove them from docker-compose.yml
and delete the directories), and
customize the ones you do.
To get started:
-
Install Docker: https://www.docker.com/products/overview
-
In this directory, run
docker-compose up
This will take a while the first time you do it, because it's downloading all of the dependencies for all of the subparts of the project. It should be much faster after the first time. -
In the output, you should see lines like these, telling you where to connect:
conda_1 | Copy/paste this URL into your browser when you connect for the first time,
conda_1 | to login with a token:
conda_1 | http://localhost:5002/?token=9c010637753fdf9646eb75a3d6b36b0a5e5464e5b5d32df3
flask_1 | * Running on http://0.0.0.0:5001/ (Press CTRL+C to quit)
node_1 | Running on http://localhost:5003
-
To stop all of the running services, use CTRL+C.
-
Data stored in the database will be preserved from run to run.
-
Code put in source/python will be available to both Conda and the Flask server
-
If you add something to
requirements.txt
orpackages.json
usedocker-compose up --build
to pick up the new dependencies