Git Product home page Git Product logo

docker-scaffolding's Introduction

Template Project

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. Docker uses "containers", which are 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:

  1. Install Docker: https://www.docker.com/products/overview

    If possible, use the native docker setup for your platform:

    If you need to use an earlier version...

    On Windows:

    • Get the docker toolbox for windows 10 home or earlier: https://docs.docker.com/toolbox/toolbox_install_windows/
    • Make sure virtualization is enabled (enter BIOS menu, adjust as needed)
    • Create a docker machine. A good name for the machine is the name of the github repo you'll be using it with, eg. "internal-displacement". For windows 10 home and earlier use docker-machine create --driver virtualbox MACHINENAME Use other drivers as necessary (https://docs.docker.com/engine/getstarted-voting-app/node-setup/)
    • Setup the machine's environment variables: docker-machine env MACHINENAME
    • Finally, activate the machine. The last statement should tell you how but in powershell: docker-machine env MACHINENAME | invoke-expression

    On MacOS

    • Install VirtualBox: https://www.virtualbox.org/
    • Create a docker machine. A good name for the machine is the name of the github repo you'll be using it with, eg. "internal-displacement". docker-machine create MACHINENAME
    • Set up your environment so that the docker commands can access this docker machine: docker-machine env MACHINENAME
  2. 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.

  3. 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
  1. To stop all of the running services, use CTRL+C.

  2. Data stored in the database will be preserved from run to run.

  3. Code put in source/python will be available to both Conda and the Flask server

  4. If you add something to requirements.txt or packages.json use docker-compose up --build to pick up the new dependencies

docker-scaffolding's People

Contributors

murrietta avatar wanderingstar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-scaffolding's Issues

pywintypes.error, setting up on windows 10

Hi @WanderingStar, Thank you for putting this together, I'm really excited to use it. I have a problem when running docker-compile up in the docker-scaffolding directory. Here is the whole error:
Traceback (most recent call last): File "docker-compose", line 3, in <module> File "compose\cli\main.py", line 64, in main File "compose\cli\main.py", line 116, in perform_command File "compose\cli\main.py", line 876, in up File "compose\project.py", line 385, in up File "compose\project.py", line 590, in warn_for_swarm_mode File "site-packages\docker\api\daemon.py", line 73, in info File "site-packages\docker\utils\decorators.py", line 47, in inner File "site-packages\docker\api\client.py", line 183, in _get File "site-packages\requests\sessions.py", line 488, in get File "site-packages\requests\sessions.py", line 475, in request File "site-packages\requests\sessions.py", line 596, in send File "site-packages\requests\adapters.py", line 423, in send File "site-packages\requests\packages\urllib3\connectionpool.py", line 595, in urlopen File "site-packages\requests\packages\urllib3\connectionpool.py", line 363, in _make_request File "httplib.py", line 1042, in request File "httplib.py", line 1082, in _send_request File "httplib.py", line 1038, in endheaders File "httplib.py", line 882, in _send_output File "httplib.py", line 844, in send File "site-packages\docker\transport\npipeconn.py", line 31, in connect File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped File "site-packages\docker\transport\npipesocket.py", line 50, in connect pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.') Failed to execute script docker-compose

I'm going to try to figure out why it throws an error at line 3 (postgres) but thought I'd bring this up. Thanks again for your hard work!

Michael

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.