From f72ea3f348a862e2e32e06f1b372fb0ecbe5f932 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 3 Aug 2026 16:59:10 +0000 Subject: [PATCH] feat: default nginx config on host, editable --- sources/python/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sources/python/main.py b/sources/python/main.py index 2fbb331..d59913e 100644 --- a/sources/python/main.py +++ b/sources/python/main.py @@ -57,6 +57,21 @@ def deploy_container(name, token, cloud, port, upstream_ip, upstream_port, label host_dir = f"{BASE}/{name}" os.makedirs(f"{host_dir}/etc", exist_ok=True) os.makedirs(f"{host_dir}/nginx", exist_ok=True) + # Write default nginx config if not exists + nginx_conf = f"{host_dir}/nginx/nginx.conf" + if not os.path.exists(nginx_conf): + with open(nginx_conf, "w") as f: + f.write(f"""load_module /opt/wallarm/modules/nginx_v1.26.3_s0ff5dffff/ngx_http_wallarm_module.so; +events {{ worker_connections 10240; }} +http {{ + wallarm_mode {mode}; + server {{ + listen {port}; + location /wallarm-status {{ wallarm_status on; }} + location / {{ proxy_pass http://{upstream_ip}:{upstream_port}; }} + }} +}} +""") # Run container monitoring_port = int(port) + 10