Builds a container containing Digiprime and Negotiation Engine.
It also starts a MongoDB server that both applications use. Authentication is handled by Keycloak which is started as well.
An automated build of the container exists on
Docker Hub. To use this replace
digiprime
with norlen/digiprime:latest
in the commands below.
Get the source, the submodules must be cloned as well for the build to be valid.
git clone --recurse-submodules https://github.com/LarsHajdronKolajder/digiprime-container
cd digiprime-container
docker build . -t digiprime # Build container
Instructions to start a development build exist here, currently production
builds are not supported. To use the pre-built image replace digiprime
with
norlen/digiprime:latest
. If the image has been pulled before run
docker image rm norlen/digiprime:latest
to clear it.
The most basic way to run is
docker run -p 3000:3000 \
--env MAPBOX_TOKEN=<your token> \
digiprime
Runs Digiprime which is avaiable at http://localhost:3000
.
To instead run a more complete build with image uploading support, data persistance, and a custom keycloak admin user run
docker run -p 3000:3000 \
--env MAPBOX_TOKEN=<your token> \
--env CLOUDINARY_CLOUD_NAME=<your info> \
--env CLOUDINARY_KEY=<your info> \
--env CLOUDINARY_SECRET=<your info> \
--env APIKEY=<project_api_key> \
-v mongodb_data:/data/db \
digiprime
Get in contact with me to get the keys to run a proper version.
This starts the Digiprime server on http://localhost:3000
.
Required environment variables:
MAPBOX_TOKEN
: Mapbox API key.SECRET
: Key to encrypt cookies. Default value isthisshouldbeabettersecret
so this should be set to another value for the server to be secure. The way it is set up is that it accepts a comma separated list of secrets, where the first one is used to sign new cookies. This allows for rolling updates of secrets, examplenew,old
. See express-session for more information.CLOUDINARY_CLOUD_NAME
: Cloudinary cloud name.CLOUDINARY_KEY
: Cloudinary API key.CLOUDINARY_SECRET
: Cloudinary secret.
Configurable values:
BASE_URL
: If the application is served on a subpath, this controls which one, default:""
.NODE_ENV
: defaults todevelopment
, can optionally be set toproduction
to hide debug information such as stack traces.AUTH_BASE_URL
: default path to the auth server.
For completeness, the other environent variables are shown here but they should not be changed.
DB_URL
: Database URL for Digiprime, can be set to use another database.PORT
: Port to launch Digiprime. However, the image only exposes port3000
so leave this alone.DATABASE_URL
: Database URL for Negotiation Engine, can be set to use another database.
To keep data between runs docker volumes should be used.
To persist MongoDB mount /data/db
which is where Mongo stores the data.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.