From 10c563c1e851c33d55e158a409fae3b40a363d5c Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 24 Aug 2023 11:08:39 +0200 Subject: [PATCH] Use a custom Docker image --- images/mongo/Dockerfile | 2 +- unifi.nomad.hcl | 21 +++++---------------- variables.yml | 8 ++++---- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/images/mongo/Dockerfile b/images/mongo/Dockerfile index 71d32b7..5ebb0d9 100644 --- a/images/mongo/Dockerfile +++ b/images/mongo/Dockerfile @@ -10,7 +10,7 @@ RUN set -eux &&\ # Create mongod user with same UID as mongodb in the official image \ groupadd -g 999 mongod &&\ useradd -M -r -g mongod -u 999 -d /var/lib/mongo -s /bin/false -c mongod mongod &&\ - microdnf -y --nodocs --setopt=install_weak_deps=0 install tini mongodb-org-server mongodb-org-shell mongodb-mongosh mongodb-org-tools &&\ + microdnf -y --nodocs --setopt=install_weak_deps=0 install tini mongodb-org-server mongodb-org-shell mongodb-org-tools &&\ microdnf clean all &&\ rm -rf /var/cache/yum/* /var/log/yum/* /var/lib/dnf/history* diff --git a/unifi.nomad.hcl b/unifi.nomad.hcl index b04e8bf..31cf4ec 100644 --- a/unifi.nomad.hcl +++ b/unifi.nomad.hcl @@ -140,10 +140,9 @@ _EOF volumes = [ "local/init-system.properties.sh:/entrypoint.d/10-init-system.properties.sh" ] - work_dir = "/local" mount { - type = "tmpfs" - target = "/opt/unifi/run" + type = "tmpfs" + target = "/opt/unifi/run" readonly = false } } @@ -187,6 +186,7 @@ _EOF task "mongo" { driver = [[ .unifi.mongo.driver | toJSON ]] + user = 999 lifecycle { hook = "prestart" @@ -195,6 +195,7 @@ _EOF config { image = [[ .unifi.mongo.image | toJSON ]] + command = "mongod" args = [ "--config", "/local/mongod.conf" @@ -210,24 +211,12 @@ _EOF volume_mount { volume = "unifi-mongo" - destination = "/data" + destination = "/data/db" } [[ template "common/resources.tpl" .unifi.mongo.resources ]] } - - task "whoami" { - driver = "docker" - config { - image = "traefik/whoami" - args = ["--port", "8787"] - } - resources { - cpu = 10 - memory = 32 - } - } } } diff --git a/variables.yml b/variables.yml index 2263731..2c799e4 100644 --- a/variables.yml +++ b/variables.yml @@ -42,8 +42,8 @@ unifi: traefik: entrypoints: - unifi-portal - middlewares: - - ip-guests@file + middlewares: [] + # - ip-guests@file stun: traefik: @@ -58,11 +58,11 @@ unifi: memory: 15 mongo: - image: mongo:3.6 + image: danielberteaud/mongo:3.6 driver: docker resources: cpu: 100 - memory: 384 + memory: 256 volume: type: csi source: unifi-mongo