mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-24 10:17:15 +08:00
delete proxys when uninstall
This commit is contained in:
parent
4a27d5d4f9
commit
6f62502488
@ -10,7 +10,7 @@ COPY static ./static
|
|||||||
COPY requirements.txt main.py ./
|
COPY requirements.txt main.py ./
|
||||||
RUN apt update
|
RUN apt update
|
||||||
|
|
||||||
# Install supervisord
|
# Install supervisords
|
||||||
RUN apt install -y supervisor
|
RUN apt install -y supervisor
|
||||||
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
COPY config/cmd.sh /cmd.sh
|
COPY config/cmd.sh /cmd.sh
|
||||||
|
@ -152,13 +152,14 @@ def uninstall_app(app_id):
|
|||||||
delete_app_failedjob(app_id)
|
delete_app_failedjob(app_id)
|
||||||
else:
|
else:
|
||||||
raise CommandException(const.ERROR_CLIENT_PARAM_NOTEXIST, "AppID is not exist", "")
|
raise CommandException(const.ERROR_CLIENT_PARAM_NOTEXIST, "AppID is not exist", "")
|
||||||
# Force to delete
|
# Force to delete docker compose
|
||||||
try:
|
try:
|
||||||
cmd = " sudo rm -rf /data/apps/" + customer_name
|
cmd = " sudo rm -rf /data/apps/" + customer_name
|
||||||
shell_execute.execute_command_output_all(cmd)
|
shell_execute.execute_command_output_all(cmd)
|
||||||
except CommandException as ce:
|
except CommandException as ce:
|
||||||
myLogger.info_logger("Delete app compose exception")
|
myLogger.info_logger("Delete app compose exception")
|
||||||
|
# Delete proxy config when uninstall app
|
||||||
|
app_proxy_delete(app_id)
|
||||||
|
|
||||||
def check_app(app_name, customer_name, app_version):
|
def check_app(app_name, customer_name, app_version):
|
||||||
message = ""
|
message = ""
|
||||||
@ -543,6 +544,29 @@ def app_domain_list(app_id):
|
|||||||
myLogger.info_logger(ret)
|
myLogger.info_logger(ret)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def app_proxy_delete(app_id):
|
||||||
|
|
||||||
|
customer_name = app_id.split('_')[1]
|
||||||
|
proxy_host = None
|
||||||
|
token = get_token()
|
||||||
|
url = "http://172.17.0.1:9092/api/nginx/proxy-hosts"
|
||||||
|
headers = {
|
||||||
|
'Authorization': token,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
response = requests.get(url, headers=headers)
|
||||||
|
|
||||||
|
for proxy in response.json():
|
||||||
|
portainer_name = proxy["forward_host"]
|
||||||
|
if customer_name == portainer_name:
|
||||||
|
proxy_id = proxy["id"]
|
||||||
|
token = get_token()
|
||||||
|
url = "http://172.17.0.1:9092/api/nginx/proxy-hosts/" + str(proxy_id)
|
||||||
|
headers = {
|
||||||
|
'Authorization': token,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
response = requests.delete(url, headers=headers)
|
||||||
|
|
||||||
def app_domain_delete(app_id, domain):
|
def app_domain_delete(app_id, domain):
|
||||||
code, message = docker.check_app_id(app_id)
|
code, message = docker.check_app_id(app_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user