-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edits in docker and docker-compose to enable an easier and more custo…
…mizable deployment
- Loading branch information
1 parent
3b1d601
commit 22330a8
Showing
9 changed files
with
71 additions
and
98,635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,52 @@ | ||
FROM maven:3-jdk-8 | ||
FROM openjdk:8-jdk | ||
|
||
# This will supress any download for dependencies and plugins or upload messages which would clutter the console log. | ||
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work. | ||
ENV MAVEN_OPTS="-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" | ||
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used | ||
# when running from the command line. | ||
# `installAtEnd` and `deployAtEnd`are only effective with recent version of the corresponding plugins. | ||
ENV MAVEN_CLI_OPTS="--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true" | ||
|
||
ARG APP_CONFIG=docker/conf/app.config.sample | ||
ARG OSM_FILE=docker/data/heidelberg.osm.gz | ||
ARG JAVA_OPTS | ||
ARG CATALINA_OPTS | ||
|
||
# Install required deps | ||
RUN apt-get update -qq | ||
RUN apt-get install -qq -y locales wget nano maven | ||
|
||
RUN mkdir -p /ors-core/build | ||
# Set the locale | ||
RUN locale-gen en_US.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
COPY .git /ors-core/.git | ||
RUN mkdir /ors-core | ||
# Copy ors sources | ||
COPY openrouteservice /ors-core/openrouteservice | ||
COPY $APP_CONFIG /ors-core/openrouteservice/WebContent/WEB-INF/app.config | ||
|
||
# Copy osm data file, config and cache if provided (ors will download otherwise) | ||
COPY $OSM_FILE /ors-core/data/osm_file.pbf | ||
COPY $APP_CONFIG /ors-core/openrouteservice/src/main/resources/app.config | ||
|
||
WORKDIR /ors-core | ||
|
||
# Build and install openrouteservice | ||
RUN mvn -f ./openrouteservice/pom.xml package -DskipTests | ||
# Build openrouteservice | ||
RUN mvn -q -f ./openrouteservice/pom.xml package -DskipTests | ||
|
||
# Install tomcat | ||
RUN mkdir /usr/local/tomcat | ||
RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz -O /tmp/tomcat.tar.gz | ||
|
||
RUN cd /tmp && tar xvfz tomcat.tar.gz | ||
RUN cp -R /tmp/apache-tomcat-8.0.32/* /usr/local/tomcat/ | ||
|
||
# Add tomcat custom settings if provided | ||
RUN touch /usr/local/tomcat/bin/setenv.sh | ||
RUN echo "CATALINA_OPTS=\"$CATALINA_OPTS\"" >> /usr/local/tomcat/bin/setenv.sh | ||
RUN echo "JAVA_OPTS=\"$JAVA_OPTS\"" >> /usr/local/tomcat/bin/setenv.sh | ||
|
||
# Copy ors app into tomcat webapps | ||
RUN cp /ors-core/openrouteservice/target/*.war /usr/local/tomcat/webapps/ors.war | ||
|
||
# Start the container | ||
EXPOSE 8080 | ||
CMD /usr/local/tomcat/bin/catalina.sh run | ||
|
||
CMD ORS_VER=$(mvn -f ./openrouteservice/pom.xml -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec) && cp /ors-core/openrouteservice/target/openrouteservice-$ORS_VER.war /ors-core/build/ors.war |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,25 @@ | ||
# Install and run openrouteservice with docker | ||
|
||
Installing the openrouteservice backend service with **Docker** is quite straightforward. Please note that the [Dockerfile](../Dockerfile) located in the repository root directory is merely for building the [WAR file](https://www.wikiwand.com/en/WAR_(file_format)). | ||
Installing the openrouteservice backend service with **Docker** is quite straightforward. | ||
|
||
## Short version | ||
|
||
Please clone the repository (downloading the archive and running docker is currently not supported) and run the following command within this `docker/` directory: | ||
Please clone the repository and run the following command within this `docker/` directory: | ||
|
||
```bash | ||
sudo docker-compose up -d | ||
docker-compose up -d | ||
``` | ||
|
||
This will: | ||
|
||
1. Build and test the openrouteservice core from the local codebase with the `docker/conf/app.config.sample` as the config file and the OpenStreetMap dataset for Heidelberg under `docker/data/` as sample data. | ||
2. Generate the built `ors.war` file and expose it to `docker/build/` directory. | ||
3. Launch the openrouteservice service on port `8080` within a tomcat container. | ||
|
||
By default the service status is queryable via the `http://localhost:8080/ors/health` endpoint. When the service is ready, you will be able to request `http://localhost:8080/ors/status` for further information on the running services. If you use the default dataset you will be able to request `http://localhost:8080/ors/routes?profile=foot-walking&coordinates=8.676581,49.418204|8.692803,49.409465` for test purposes. | ||
|
||
## Long version | ||
|
||
### WAR file building | ||
|
||
For building the WAR file only, either run | ||
|
||
```bash | ||
docker run -v /Users/user/build:/ors-core/build giscience/openrouteservice | ||
``` | ||
|
||
or | ||
|
||
```bash | ||
docker-compose up ors-build | ||
``` | ||
|
||
If everything goes fine, the built `ors.war` archive can be found under the shared host directory, e.g. `/Users/user/build` for the above `docker run` command or `./build/` for the `docker-compose` command. | ||
|
||
### Run openrouteservice | ||
|
||
No matter whether the WAR file has been built or not, simply run: | ||
|
||
```bash | ||
sudo docker-compose up | ||
``` | ||
1. Build the openrouteservice [war file](https://www.wikiwand.com/en/WAR_(file_format)) from the local codebase with the `docker/conf/app.config.sample` as the config file and the OpenStreetMap dataset for Heidelberg under `docker/data/` as sample data. | ||
2. Launch the openrouteservice service on port `8080` within a tomcat container. | ||
|
||
will take care of all steps with the sample Heidelberg dataset. | ||
By default the service status is queryable via the `http://localhost:8080/ors/health` endpoint. When the service is ready, you will be able to request `http://localhost:8080/ors/status` for further information on the running services. | ||
If you use the default dataset you will be able to request `http://localhost:8080/ors/routes?profile=foot-walking&coordinates=8.676581,49.418204|8.692803,49.409465` for test purposes. | ||
|
||
### Run with your own OpenStreetMap dataset | ||
## Run with your own OpenStreetMap dataset | ||
|
||
Prepare the OSM dataset (formats supported are `.osm`, `.osm.gz`, `.osm.zip` and `.pbf`) in the `docker/data/` directory. Adapt your own `app.config` (check the sample with detailed comments [here](../openrouteservice/WebContent/WEB-INF/app.config.sample) for reference) and change the `APP_CONFIG` variable in `docker-compose.yml` to let it point to your customized `app.config`. Then, run `docker-compose up`. | ||
Save your OSM dataset (formats supported are `.osm`, `.osm.gz`, `.osm.zip` and `.pbf`) in the `docker/data/` directory and then adapt `docker-compose.yml`. | ||
Afterwards run `docker-compose up -d` (if you want to rebuild graphs with a new OSM file first of all delete the contents of the `docker/graphs` folder and restart the service with `docker-compose up -d`). | ||
|
||
It should be mentioned that if your dataset is very large, please adjust the `-Xmx` parameter of `JAVA_OPTS` in `docker-compose.yml`. According to our experience, this should be at least `180g` for the whole globe if you are planning to use 3 or more modes of transport. | ||
It should be mentioned that if your dataset is very large, please adjust the `-Xmx` parameter of `JAVA_OPTS` in `docker-compose.yml`. | ||
According to our experience, this should be at least `180g` for the whole globe if you are planning to use 3 or more modes of transport at the same time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.