mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
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:
parent
c38814b1bc
commit
ecaede79ee
@ -490,9 +490,8 @@ def is_package_manager_busy():
|
|||||||
|
|
||||||
|
|
||||||
def podman_run(network_name: str, subnet: str, bridge_ip: str, host_port: str,
|
def podman_run(network_name: str, subnet: str, bridge_ip: str, host_port: str,
|
||||||
container_port: str, container_ip: str, volume_name: str,
|
container_port: str, container_ip: str, container_name: str,
|
||||||
container_name: str, image_name: str,
|
image_name: str, extra_run_options: list[str] | None = None,
|
||||||
extra_run_options: list[str] | None = None,
|
|
||||||
extra_network_options: list[str] | None = None):
|
extra_network_options: list[str] | None = None):
|
||||||
"""Remove, recreate and run a podman container."""
|
"""Remove, recreate and run a podman container."""
|
||||||
try:
|
try:
|
||||||
@ -513,8 +512,8 @@ def podman_run(network_name: str, subnet: str, bridge_ip: str, host_port: str,
|
|||||||
|
|
||||||
args = [
|
args = [
|
||||||
'podman', 'run', '--detach', '--network', network_name, '--ip',
|
'podman', 'run', '--detach', '--network', network_name, '--ip',
|
||||||
container_ip, '--volume', f'{volume_name}:/var/www/html', '--name',
|
container_ip, '--name', container_name, '--restart', 'unless-stopped',
|
||||||
container_name, '--restart', 'unless-stopped', '--quiet'
|
'--quiet'
|
||||||
]
|
]
|
||||||
# Only listen on localhost. This is to prevent exposing the host port to
|
# Only listen on localhost. This is to prevent exposing the host port to
|
||||||
# the internet.
|
# the internet.
|
||||||
|
|||||||
@ -50,10 +50,10 @@ def setup():
|
|||||||
action_utils.podman_run(
|
action_utils.podman_run(
|
||||||
network_name=NETWORK_NAME, subnet='172.16.16.0/24',
|
network_name=NETWORK_NAME, subnet='172.16.16.0/24',
|
||||||
bridge_ip=BRIDGE_IP, host_port='8181', container_port='80',
|
bridge_ip=BRIDGE_IP, host_port='8181', container_port='80',
|
||||||
container_ip=CONTAINER_IP, volume_name=VOLUME_NAME,
|
container_ip=CONTAINER_IP, container_name=CONTAINER_NAME,
|
||||||
container_name=CONTAINER_NAME, image_name=IMAGE_NAME,
|
image_name=IMAGE_NAME, extra_run_options=[
|
||||||
extra_run_options=[
|
|
||||||
'--volume=/run/mysqld/mysqld.sock:/run/mysqld/mysqld.sock',
|
'--volume=/run/mysqld/mysqld.sock:/run/mysqld/mysqld.sock',
|
||||||
|
f'--volume={VOLUME_NAME}:/var/www/html',
|
||||||
f'--env=TRUSTED_PROXIES={BRIDGE_IP}',
|
f'--env=TRUSTED_PROXIES={BRIDGE_IP}',
|
||||||
'--env=OVERWRITEWEBROOT=/nextcloud'
|
'--env=OVERWRITEWEBROOT=/nextcloud'
|
||||||
])
|
])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user