Add ingress to the charm

This commit is contained in:
2026-02-19 10:49:43 +01:00
parent 2dc1a39e0b
commit 8cdde18478
7 changed files with 1136 additions and 4 deletions
+3 -1
View File
@@ -24,6 +24,7 @@ STATIC_SOURCE_DIR = CHARM_DIR / "src" / "static"
CONFIG_FILE = pathops.LocalPath("/etc/nginx/nginx.conf")
PID_FILE = pathops.LocalPath(CHARM_DIR / "nginx.pid")
def ensure_config() -> bool:
"""Ensure that nginx is configured. Return True if any changes were made."""
config = f"""\
@@ -53,11 +54,12 @@ http {{
def install() -> None:
"""Install nginx apt package."""
apt.update()
apt.add_package("nginx", "1.18.0-6ubuntu14.7")
apt.add_package("nginx", "1.18.0-6ubuntu14.8")
subprocess.check_output(["service", "nginx", "stop"])
os.remove("/etc/nginx/nginx.conf")
os.unlink("/etc/nginx/sites-enabled/default")
def is_installed() -> bool:
"""Check if nginx is installed."""
return shutil.which("nginx") is not None