From 7adfc6aa1d9245aa0ff682ec573777b7fd09f2d2 Mon Sep 17 00:00:00 2001 From: Jakub Filo Date: Mon, 19 Jun 2023 07:41:58 +0000 Subject: [PATCH] Add docker-compose --- docker-compose.yml | 26 ++++++++++++++++++++++++++ env.sample | 30 ++++++++++++++++++++++++++++++ mongo-init.js | 12 ++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 docker-compose.yml create mode 100644 env.sample create mode 100644 mongo-init.js diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..92d7850 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3' + +services: + mongodb: + image: mongo + volumes: + - ./data/db:/data/db + - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro + networks: + - backend + env_file: + - env.sample + + keyserver: + image: git.plantroon.com/aux/keyserver:master + ports: + - "12345:3000" + depends_on: + - mongodb + networks: + - backend + env_file: + - env.sample + +networks: + backend: diff --git a/env.sample b/env.sample new file mode 100644 index 0000000..57dc81e --- /dev/null +++ b/env.sample @@ -0,0 +1,30 @@ +NODE_ENV=production +LOG_LEVEL=debug +PORT=3000 +PAPERTRAIL_HOST='' +PAPERTRAIL_PORT='' + +MONGO_URI=mongodb:27017/keyserver_db +MONGO_USER=keyserver +MONGO_PASS=changeme +MONGO_INITDB_ROOT_USERNAME=keyserver +MONGO_INITDB_ROOT_PASSWORD=changeme +MONGO_INITDB_DATABASE=keyserver_db + +SENDER_NAME=keyserver +SENDER_EMAIL=changeme + +SMTP_HOST=changeme +SMTP_PORT=587 +SMTP_TLS=false + +SMTP_STARTTLS=true +SMTP_PGP='' +SMTP_USER='' +SMTP_PASS='' + +HTTPS_UPGRADE=true +HTTPS_KEY_PIN='' +HTTPS_KEY_PIN_BACKUP='' + +PUBLIC_KEY_PURGE_TIME=30 diff --git a/mongo-init.js b/mongo-init.js new file mode 100644 index 0000000..8a69a33 --- /dev/null +++ b/mongo-init.js @@ -0,0 +1,12 @@ +db.createUser( + { + user: process.env.MONGO_INITDB_ROOT_USERNAME, + pwd: process.env.MONGO_INITDB_ROOT_PASSWORD, + roles: [ + { + role: "readWrite", + db: process.env.MONGO_INITDB_DATABASE + } + ] + } +);