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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-04-01 20:08:26 -07:00 committed by James Valleroy
parent c38814b1bc
commit ecaede79ee
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 7 additions and 8 deletions

View File

@ -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.

View File

@ -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'
])