diff --git a/nextcloud_devenv/Makefile b/nextcloud_devenv/Makefile index dd98b67..61e059e 100644 --- a/nextcloud_devenv/Makefile +++ b/nextcloud_devenv/Makefile @@ -1,9 +1,12 @@ -.PHONY: all build_deploy build deploy +.PHONY: all build_deploy build deploy runpodman all: build_deploy +runpodman: + ./runpodman.sh + build_deploy: build ./deploy_poll.sh diff --git a/nextcloud_devenv/runpodman.sh b/nextcloud_devenv/runpodman.sh index 26819d4..0f44dac 100755 --- a/nextcloud_devenv/runpodman.sh +++ b/nextcloud_devenv/runpodman.sh @@ -4,6 +4,8 @@ source lib/metascript.sh enforcedir polls exists +log_warn "No check is done to verify if container is already started" + defaultmetainit $@ podman=podman @@ -14,14 +16,21 @@ container_name=$nextcloud_image rel_bind_folder=bind_folder bind_folder=$(pwd)/$rel_bind_folder -#lazzy detection base on first local ip -declare -a possible_hosts=($(ip a | grep 192.168.1 |awk '{ gsub("/24","",$2); print $2 ; }')) -hosts_n=${#possible_hosts[@]} -if (( hosts_n > 1 )) -then - log_warn "multiple hosts $hosts_n" -fi -listen_host=${possible_hosts[0]} +# if wanting to expose nextcloud on host address +detect_expose_address() +{ + #lazzy detection base on first local ip + declare -a possible_hosts=($(ip a | grep 192.168.1 |awk '{ gsub("/24","",$2); print $2 ; }')) + hosts_n=${#possible_hosts[@]} + if (( hosts_n > 1 )) + then + log_warn "multiple hosts $hosts_n" + fi + listen_host=${possible_hosts[0]} +} + +# detect_expose_address +listen_host=127.0.0.1 log_info "liston on $listen_host" declare -a podman_args @@ -70,6 +79,12 @@ done # with root ... podman_args+=(--mount type=bind,source=$(pwd)/polls,target=/root/polls) +# network bridge slirp4netns (not pasta) and allow_host_loopback) +# podman_args+=(--network=slirp4netns:allow_host_loopback=true) + +# pasta +podman_args+=(--network=pasta:--map-host-loopback=10.1.1.13) + if [[ -n $detach ]] then podman_args+=(-d) @@ -83,7 +98,7 @@ then sudo cp $config_php config.php sudo chown $(id -u):$(id -g) config.php - php patch_config.php "$listen_host:$host_free_port" | sudo tee ${bind_folder}/config/config.php + php patch_config.php "$listen_host:$host_free_port" | sudo tee ${bind_folder}/config/config.php >/dev/null else log_info "no config/php, first install ?" fi diff --git a/nextcloud_devenv/setupdatabase.sh b/nextcloud_devenv/setupdatabase.sh index 442a35f..cf37b46 100755 --- a/nextcloud_devenv/setupdatabase.sh +++ b/nextcloud_devenv/setupdatabase.sh @@ -2,20 +2,13 @@ source lib/metascript.sh +defaultmetainit $@ + log_info "assume postgres is already installed localy" log_info "https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/linux_database_configuration.html#requirements" -query_password "database password :" password - -if [[ -z $password ]] -then - log_error "Missing password" - exit 1 -fi - -database_name=nextcloud_dev -username=nextcloud_dev +source config_db_query.sh { cat <