Show / Hide Table of Contents
Edit on GitHub

Using an external database on Docker - Signer

The standard Docker compose file for Signer includes an internal service for the database (Microsoft SQL Server).

For production environments, there may be concerns about running the database on Docker. If you prefer, follow the steps on this article to use an external database.

Stop the stack:

docker stack rm signer

Edit the Docker compose file:

nano signer-stack.yml

Make the following changes:

  • Section volumes: remove item sql
  • Section services:
    • Remove entire service sql
    • Service signer
      • On section environment, add the following items:
        • SQL_HOST: hostname of the database server
        • SQL_PORT (optional): port of the database server (if omitted port 1433 is assumed)
        • SQL_DATABASE: name of the database to use
        • SQL_USER: username to authenticate on the database server
      • Remove section depends_on

The password should be added as the secret signer_sql_password:

echo 'MyPassword' | docker secret create signer_sql_password -

Deploy the stack with the new configurations:

docker stack deploy -c signer-stack.yml signer

Custom connection string

The method above uses the provided host, database, user and password file to build a connection string with the following format:

Data Source=HOST;Initial Catalog=DATABASE;User ID=USER;Password=PASSWORD

On certain scenarios the connection string might be more complex, for instance if the database is mirrored. On such cases, follow the steps below to use a custom connection string.

Edit the Docker compose file:

nano signer-stack.yml

Make the following changes:

  • Section volumes: remove item sql
  • Section secrets: remove item signer_sql_password
  • Section services:
    • Remove entire service sql
    • Service signer
      • On section secrets, remove item signer_sql_password
      • On section environment, remove all items starting with SQL_
      • Remove section depends_on

Edit the Signer configuration file:

nano signer.json

Add the ConnectionStrings section to the file, with a single item named DefaultConnection:

{
    "ConnectionStrings": {
        "DefaultConnection": "YOUR-CUSTOM-CONNECTION-STRING"
    },

    "Application": ...
}

See also

  • Installing Signer on Docker
  • Enabling SSL on Docker
  • Checking the system logs on Docker
  • Persistent data (backup considerations)
  • Using a stack with GrantID
Back to top Copyright © 2015-2020 Lacuna Software