From e4db71ec6045b0fa5ed22bd8e14fe5beb35efcf3 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Tue, 23 May 2023 13:45:28 +0800 Subject: [PATCH] add domain when APP_URL not in .env --- appmanage/Dockerfile | 2 +- appmanage/api/service/manage.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/appmanage/Dockerfile b/appmanage/Dockerfile index ef28a3a5..d6cf741e 100644 --- a/appmanage/Dockerfile +++ b/appmanage/Dockerfile @@ -10,7 +10,7 @@ COPY static ./static COPY requirements.txt main.py ./ RUN apt update -# Install supervisord +# Install supervisords RUN apt install -y supervisor COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY config/cmd.sh /cmd.sh diff --git a/appmanage/api/service/manage.py b/appmanage/api/service/manage.py index 500c0b5d..fba8b8c4 100644 --- a/appmanage/api/service/manage.py +++ b/appmanage/api/service/manage.py @@ -1050,6 +1050,13 @@ def set_domain(domain, app_id): if "APP_URL_REPLACE=true" in app_url: myLogger.info_logger("need up") shell_execute.execute_command_output_all("cd /data/apps/" + customer_name + " && docker compose up -d") + else: + myLogger.info_logger("APP_URL is not exist") + if domain == "": + ip_result = shell_execute.execute_command_output_all("cat /data/apps/stackhub/docker/w9appmanage/public_ip") + domain = ip_result["result"].rstrip('\n') + cmd = "echo APP_URL=" + domain + " >> /data/apps/" + customer_name +"/.env" + shell_execute.execute_command_output_all(cmd) myLogger.info_logger("set_domain success") def get_container_port(container_name):