setup update scripts

Signed-off-by: philippe lhardy <philippe.lhardy@astrolabe.coop>
This commit is contained in:
2025-08-18 09:43:07 +02:00
parent 38af3fc7dd
commit 204658df0c
3 changed files with 33 additions and 21 deletions

View File

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

View File

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

View File

@@ -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 <<EOF
@@ -25,5 +18,6 @@ ALTER DATABASE ${database_name} OWNER TO $username;
GRANT ALL PRIVILEGES ON DATABASE ${database_name} TO $username;
GRANT ALL PRIVILEGES ON SCHEMA public TO $username;
EOF
} | sudo -u postgres psql -f -
} | pipeto sudo -u postgres psql -f -
log_info "created database ${database_name} with user $username"