Setup Authenticate's database

Install PostgreSQL DB

Download postgres via docker


    docker pull postgres
    

Haventec can be run with or without SSL to PostgreSQL

Create and run a PostgreSQL container (non-SSL)


    docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres
    

Alternatively the PostgreSQL container can be started with SSL.

Create a self signed certificate for the container


            openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req
            openssl rsa -in privkey.pem -passin pass:abcd -out server.key
            openssl req -x509 -in server.req -text -key server.key -out server.crt
    

Create and run a PostgreSQL container with SSL enabled


    docker run --name postgres \
        -p 5432:5432 \
        -e POSTGRES_PASSWORD=password \
        -v postgres:/var/lib/postgresql/data \
        -v $PWD/server.crt:/var/lib/postgresql/data/server.crt \
        -v $PWD/server.key:/var/lib/postgresql/data/server.key \
        -d postgres -c ssl=on
    

Connect to the DB via docker to create the user and the DB


    docker run -it --rm --link postgres:postgres postgres psql -h postgres -U postgres
    

Note: If SSL is enabled psql will connect over SSL by default

Create DB schemas and DB user

Create two PostgreSQL DB schemas, one for Haventec Authenticate and another one for Haventec Console.


    CREATE DATABASE htauthenticate;
    CREATE DATABASE htconsole;
    

Create users and make them the owner of the created DB schemas.


    CREATE USER haventec WITH LOGIN PASSWORD 'yourPassword';
    ALTER DATABASE htauthenticate OWNER TO haventec;
    ALTER DATABASE htconsole OWNER TO haventec;
    

You can use a different USER and DATABASE name but remember to update your configuration with your new values.

Next steps

Install Authenticate