Skip to content

Commit

Permalink
Docker-compose configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
abyrd committed Oct 9, 2020
1 parent 21b95d1 commit b6bd3c8
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Dockerfile
@@ -1,9 +1,16 @@
# Build with:
# docker build . --build-arg r5version=$(gradle -q printVersion | head -n1)
# or
# docker build . --build-arg r5version=$(cat build/version.txt)
# We could instead run the Gradle build and/or fetch version information
# using run actions within the Dockerfile
FROM openjdk:11
ARG r5version
ENV R5_VERSION=$r5version
ENV JVM_HEAP_GB=2
WORKDIR /r5
COPY build/libs/r5-${R5_VERSION}-all.jar .
COPY analysis.properties.template analysis.properties
# Use a configuration that connects to the database on another host (container)
COPY analysis.properties.docker analysis.properties
EXPOSE 7070
CMD java -Xmx${JVM_HEAP_GB}g -cp r5-${R5_VERSION}-all.jar com.conveyal.analysis.BackendMain
17 changes: 17 additions & 0 deletions analysis.properties.docker
@@ -0,0 +1,17 @@
# When running in docker, we reference services running on other containers
# The database is given the hostname mongo by the docker-compose links section
database-uri=mongodb://mongo:27017
database-name=analysis
frontend-url=https://ui:3000
bundle-bucket=analysis-local-bundles
grid-bucket=analysis-local-grids
results-bucket=analysis-local-results
resources-bucket=analysis-local-resources
seamless-census-bucket=lodes-data-2014
seamless-census-region=us-east-1
offline=true
server-port=7070
local-cache=cache
light-threads=3
heavy-threads=3
max-workers=8
42 changes: 42 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,42 @@
# Usage:
# docker-compose build --build-arg r5version=$(cat build/version.txt)
# docker-compose up
version: '3'
services:
r5:
container_name: r5
build: .
# image: ghcr.io/conveyal/r5:latest
depends_on:
- mongo
links:
- mongo
ports:
- "7070:7070"
# TODO volumes for backend cache directory
ui:
container_name: ui
depends_on:
- mongo
# build: ../analysis-ui
# image: ghcr.io/conveyal/analysis-ui:latest
image: 037a38bb2cdf
ports:
- "3000:3000"
links:
- r5
- mongo
# Map in a config file with mapbox keys, telling the UI to contact host (container) r5
volumes:
- ./ui-env:/ui/.env.local:ro
mongo:
container_name: mongo
image: mongo
restart: always
volumes:
- mongo-volume:/data/db:rw
ports:
- "27017:27017"

volumes:
mongo-volume:

0 comments on commit b6bd3c8

Please sign in to comment.