Skip to content

krypton-org/krypton-docker

Repository files navigation

krypton-docker

Docker Image CI Docker Cloud Build Status Docker Image Version (latest by date)

Quick Start

Docker Compose

Compose files for various use cases are available in the compose folder. For example to run the simple.yml file:

docker-compose -f compose/simple.yml up
curl localhost:5000
# {"errors":[{"message":"Must provide query string.","type":"BadRequestError"}]}

Docker

Example setup with a single Krypton Authentication instance:

docker network create krypton-auth-net

docker run \
    --detach \
    --name krypton-auth-db \
    --network krypton-auth-net \
    mongo

docker run \
    --detach \
    --name krypton-auth \
    --network krypton-auth-net \
    --env MONGODB_URI="mongodb://krypton-auth-db:27017/users" \
    --publish 5000:5000 \
    kryptonorg/krypton-auth

Test the service:

curl localhost:5000
# {"errors":[{"message":"Must provide query string.","type":"BadRequestError"}]}

To cleanup:

docker rm -f krypton-auth
docker rm -f krypton-auth-db
docker network rm krypton-auth-net

Configuration

To specify the configuration, bind a local directory to /krypton-vol:

docker run -d -e "MONGODB_URI=..." -p 5000:5000 -v /my/dir:/krypton-vol kryptonorg/krypton-auth

Inside this local directory create a file named krypton.config.js. There you can set the different properties of Krypton. Here is an example:

module.exports = {
    host: 'https://service-public-adress.com',
    mailFrom: '"Foo Bar" <donotreply@foobar.com>',
    nodemailerConfig: {
        host: 'smtp.example.email',
        port: 465,
        secure: true,
        auth: {
            user: 'FooBar',
            pass: 'F@@8aR'
        }
    }
}

This configuration file can also be in JSON format, just name it krypton.config.json. The above configuration becomes:

{
    "host": "https://service-public-adress.com",
    "mailFrom": "\"Foo Bar\" <donotreply@foobar.com>",
    "nodemailerConfig": {
        "host": "smtp.example.email",
        "port": 465,
        "secure": true,
        "auth": {
            "user": "FooBar",
            "pass": "F@@8aR"
        }
    }
}

Environement Variables

Name Default Description
MONGODB_URI - MongoDB URI (mongodb://host:port/database)
ALLOWED_ORIGINS - (all by default) A space separated list of URLs allowed for CORS (http://example1.com http://example2.com)

Build

git clone git@github.com:krypton-org/krypton-docker.git
cd krypton-docker
docker build -t kryptonorg/krypton-auth .

An automated build is setup on Docker Hub with the following rules:

  • Branch masterkryptonorg/krypton-auth:latest
  • Tag /^[0-9.]+$/kryptonorg/krypton-auth:{sourceref} (e.g. 1.2.0kryptonorg/krypton-auth:1.2.0)

About

Official Docker Image of Krypton Authentication.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors