diff --git a/api/tacticalrmm/tacticalrmm/settings.py b/api/tacticalrmm/tacticalrmm/settings.py index 80029d1d..e7e54868 100644 --- a/api/tacticalrmm/tacticalrmm/settings.py +++ b/api/tacticalrmm/tacticalrmm/settings.py @@ -6,6 +6,8 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SCRIPTS_DIR = "/srv/salt/scripts" +DOCKER_BUILD = False + LOG_DIR = os.path.join(BASE_DIR, "tacticalrmm/private/log") EXE_DIR = os.path.join(BASE_DIR, "tacticalrmm/private/exe") diff --git a/api/tacticalrmm/tacticalrmm/utils.py b/api/tacticalrmm/tacticalrmm/utils.py index 561917b3..ffee9d72 100644 --- a/api/tacticalrmm/tacticalrmm/utils.py +++ b/api/tacticalrmm/tacticalrmm/utils.py @@ -1,6 +1,7 @@ import json import os import subprocess +from tacticalrmm.settings import DOCKER_BUILD import tldextract from django.conf import settings @@ -18,12 +19,17 @@ def reload_nats(): for agent in agents: users.append({"user": agent.agent_id, "password": agent.user.auth_token.key}) - tld = tldextract.extract(settings.ALLOWED_HOSTS[0]) - domain = tld.domain + "." + tld.suffix + if not DOCKER_BUILD: + tld = tldextract.extract(settings.ALLOWED_HOSTS[0]) + domain = tld.domain + "." + tld.suffix + cert_path = f"/etc/letsencrypt/live/{domain}" + else: + cert_path = "/opt/tactical/certs" + config = { "tls": { - "cert_file": f"/etc/letsencrypt/live/{domain}/fullchain.pem", - "key_file": f"/etc/letsencrypt/live/{domain}/privkey.pem", + "cert_file": f"{cert_path}/fullchain.pem", + "key_file": f"{cert_path}/privkey.pem", }, "authorization": {"users": users}, "max_payload": 2048576005, @@ -33,4 +39,5 @@ def reload_nats(): with open(conf, "w") as f: json.dump(config, f) - subprocess.run(["/usr/local/bin/nats-server", "-signal", "reload"]) + if not DOCKER_BUILD: + subprocess.run(["/usr/local/bin/nats-server", "-signal", "reload"]) diff --git a/docker/containers/tactical-frontend/dockerfile b/docker/containers/tactical-frontend/dockerfile index 910083a5..5ba2be88 100644 --- a/docker/containers/tactical-frontend/dockerfile +++ b/docker/containers/tactical-frontend/dockerfile @@ -7,6 +7,9 @@ RUN npm install COPY ./web . +# copy env file to set DOCKER_BUILD to true +RUN echo "DOCKER_BUILD = true" > .env + # modify index.html template to allow injection of js variables at runtime RUN sed -i '/<\/head>/i