feat: default nginx config on host, editable
This commit is contained in:
parent
3d8b85d918
commit
f72ea3f348
1 changed files with 15 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue