added parameter "-p" to the mkdir command to allow creation of parent directories if they not already exist.
2.8 KiB
Installation
As an alternative to the online version, the standalone server of BRouter can also be run on your local desktop.
Install standalone zip (client and server)
-
download and unzip latest standalone archive (
brouter-web-standalone.<version>.zip) from https://github.com/nrenner/brouter-web/releases e.g. for Linux (replace~/opt/with your preferred install directory and0.11.0with latest version):mkdir -p ~/opt/brouter cd ~/opt/brouter wget https://github.com/nrenner/brouter-web/releases/download/0.11.0/brouter-web-standalone.0.11.0.zip unzip brouter-web-standalone.0.11.0.zip -
download one or more rd5 data file(s) from the download directory or the grid map into the
segments4directory
Configure BRouter-Web
In the brouter-web subdirectory:
- copy
config.template.jstoconfig.js - add your API keys (optional)
copykeys.template.jstokeys.jsand edit to add your keys
Run
- start
./run.sh
Running as Docker container (client only)
brouter-web can be run as a Docker container, making it easy for continous deployment or running locally without having to install any build tools.
The Dockerfile builds the application inside a NodeJS container and copies the built application into a
separate Nginx based image. The application runs from a webserver only container serving only static files.
Prerequisites
- Docker installed
- working directory is this repository
config.template.jscopied toconfig.jsand modified with a Brouter server, seeBR.conf.hostkeys.template.jstokeys.jsand add your API keys- Optionally create
profilesdirectory withbrfprofile files and add path toconfig.js: BR.conf.profilesUrl = 'profiles/';
Building Docker image
To build the Docker container run:
docker build -t brouter-web .
This creates a Docker image with the name brouter-web.
Running Docker container
To run the previously build Docker image run:
docker run --rm --name brouter-web \
-p 127.0.0.1:8080:80 \
-v "`pwd`/config.js:/usr/share/nginx/html/config.js" \
-v "`pwd`/keys.js:/usr/share/nginx/html/keys.js" \
-v "`pwd`/profiles:/usr/share/nginx/html/profiles" \
brouter-web
This command does the following:
- Runs a container with the name
brouter-weband removes it automatically after stopping - Binds port 80 of the container to the host interface 127.0.0.1 on port 8080
- Takes the absolute paths of
config.js,keys.jsandprofilesand mounts them inside the container - Uses the image
brouter-webto run as a container
brouter-web should be accessible at http://127.0.0.1:8080.