- Install the stable community edition of Docker. Install the version that corresponds to your operating system from this page. Make sure the docker app is running. You should see a whale icon in your toolbar. If you are not on a Mac, see the docker-compose installation page for information on how to set this up on your operating system.
- Get the docker image:
- Pull them from docker hub
- The docker image contains sensitive data and thus, it cannot be pulled freely. Contact me ([email protected]) if you think that you need this image. If approved, I will grant your docker hub account access to this repository.
- Next, login to docker at the command line with the command
docker login
, and enter your information. - You can start the service by running:
cd PolicyBrain/distributed && docker-compose up -d
This will pull the required images, configure them, and run them in a detached state. Remove the-d
flag to run them in the foreground.
- Build them locally
This may be useful if you do not have access to the sensitive data. With
this process, you can run PolicyBrain using only non-sensitive data.
- go to the
distributed
directory. - run
export PB_VERSION='type current PolicyBrain version here' docker build -t distributed:$PB_VERSION ./ docker build -t celery:$PB_VERSION --file Dockerfile.celery ./ docker build -t flask:$PB_VERSION --file Dockerfile.flask
- go to the
- Depending on your system you may have to tweak the Docker memory and CPU usage limits. I find that I can do most runs with RAM set around 8 GB and CPU at 1 or 2. Your mileage may vary. Some of the more memory intensive runs such as Tax-Calculator simulations with the CPS file require RAM up to 12 or 13 GB when using docker. You may have problems doing those runs locally. Adjust these parameters by clicking the docker icon in the toolbar, selecting preferences, and click the "Advanced" icon. Make sure to click "Apply & Restart" so that the adjustments will go into effect.
- Build worker node images:
make dist-build -e TAG=$TAG
- Build webapp image:
make webapp-build -e TAG=$TAG
- Push worker node images:
make dist-push -e TAG=$TAG
- Push webapp image:
make webapp-push -e TAG=$TAG -e VERSION=$VERSION
- Release webapp image:
make webapp-release -e VERSION=$VERSION
Note:
TAG
refers to the GitHub release version or local branchVERSION
refers to the app type, either test (test
) or production (prod
)- The OSPC token is not required if the PUF is not required
-
View logs Get Container ID:
docker ps
Follow log of service with that ID:docker logs -f CONTAINER_ID
-
View CPU and memory usage:
docker stats
-
Experiment within the
distributed
containerdocker run -it opensourcepolicycenter/distributed
-
More to come...