From ecaede79eec93a6addab0c82d26b995b4998f646 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 1 Apr 2024 20:08:26 -0700 Subject: [PATCH] action_utils, nextcloud: Make podman util more generic It is unlikely that other containers will need the same volume with path for /var/www/html. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/action_utils.py | 9 ++++----- plinth/modules/nextcloud/privileged.py | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/plinth/action_utils.py b/plinth/action_utils.py index c4d39e582..ac6e617bc 100644 --- a/plinth/action_utils.py +++ b/plinth/action_utils.py @@ -490,9 +490,8 @@ def is_package_manager_busy(): def podman_run(network_name: str, subnet: str, bridge_ip: str, host_port: str, - container_port: str, container_ip: str, volume_name: str, - container_name: str, image_name: str, - extra_run_options: list[str] | None = None, + container_port: str, container_ip: str, container_name: str, + image_name: str, extra_run_options: list[str] | None = None, extra_network_options: list[str] | None = None): """Remove, recreate and run a podman container.""" try: @@ -513,8 +512,8 @@ def podman_run(network_name: str, subnet: str, bridge_ip: str, host_port: str, args = [ 'podman', 'run', '--detach', '--network', network_name, '--ip', - container_ip, '--volume', f'{volume_name}:/var/www/html', '--name', - container_name, '--restart', 'unless-stopped', '--quiet' + container_ip, '--name', container_name, '--restart', 'unless-stopped', + '--quiet' ] # Only listen on localhost. This is to prevent exposing the host port to # the internet. diff --git a/plinth/modules/nextcloud/privileged.py b/plinth/modules/nextcloud/privileged.py index 808a10709..6bb04cf48 100644 --- a/plinth/modules/nextcloud/privileged.py +++ b/plinth/modules/nextcloud/privileged.py @@ -50,10 +50,10 @@ def setup(): action_utils.podman_run( network_name=NETWORK_NAME, subnet='172.16.16.0/24', bridge_ip=BRIDGE_IP, host_port='8181', container_port='80', - container_ip=CONTAINER_IP, volume_name=VOLUME_NAME, - container_name=CONTAINER_NAME, image_name=IMAGE_NAME, - extra_run_options=[ + container_ip=CONTAINER_IP, container_name=CONTAINER_NAME, + image_name=IMAGE_NAME, extra_run_options=[ '--volume=/run/mysqld/mysqld.sock:/run/mysqld/mysqld.sock', + f'--volume={VOLUME_NAME}:/var/www/html', f'--env=TRUSTED_PROXIES={BRIDGE_IP}', '--env=OVERWRITEWEBROOT=/nextcloud' ])