Multiple changes:

- Stop ignoring static index file
- Automatically pull flutter artifacts from Launchpad
- Allow nginx to list files in directories
This commit is contained in:
2026-02-10 16:23:41 +01:00
parent f1c539519e
commit 2dc1a39e0b
4 changed files with 72 additions and 6 deletions
+6 -4
View File
@@ -17,13 +17,12 @@ from charmlibs import apt, pathops
logger = logging.getLogger(__name__)
CONFIG_FILE = pathops.LocalPath("/etc/nginx/nginx.conf")
PID_FILE = pathops.LocalPath("/usr/local/nginx/logs/nginx.pid")
# Get the charm directory dynamically
CHARM_DIR = Path(__file__).parent.parent
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."""
@@ -39,6 +38,7 @@ http {{
listen 80;
root '{STATIC_SOURCE_DIR}';
location / {{
autoindex on;
try_files $uri $uri/ @external;
}}
location @external {{
@@ -54,7 +54,9 @@ def install() -> None:
"""Install nginx apt package."""
apt.update()
apt.add_package("nginx", "1.18.0-6ubuntu14.7")
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."""