mirror of
https://github.com/YunoHost-Apps/flohmarkt_ynh.git
synced 2024-09-03 18:36:30 +02:00
moved initialize_couchdb into _common.sh
and replaced it in install and upgrade by a function call
This commit is contained in:
parent
58ef9c10a4
commit
e1ec0e97e1
4 changed files with 19 additions and 47 deletions
|
@ -120,6 +120,22 @@ flohmarkt_ynh_up_inst_couchdb() {
|
||||||
--package="couchdb"
|
--package="couchdb"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# (re)initialise database during install and upgrade
|
||||||
|
flohmarkt_ynh_initialize_couchdb() {
|
||||||
|
# run in a sub shell to not source the venv activate to the rest of the script
|
||||||
|
(
|
||||||
|
set +o nounset
|
||||||
|
source "$flohmarkt_venv_dir/bin/activate"
|
||||||
|
set -o nounset
|
||||||
|
# change directory to where flohmarkt.conf is located
|
||||||
|
cd $flohmarkt_app_dir
|
||||||
|
# initialize_couchdb seems to re-try on connect problems endlessly blocking the yunohost api
|
||||||
|
# give it 45 seconds to finish and then fail
|
||||||
|
# https://codeberg.org/ChriChri/flohmarkt_ynh/issues/13
|
||||||
|
timeout 45 python3 initialize_couchdb.py $password_couchdb_admin
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
flohmarkt_ynh_dump_couchdb() {
|
flohmarkt_ynh_dump_couchdb() {
|
||||||
../settings/scripts/couchdb-dump/couchdb-dump.sh -b -H 127.0.0.1 -d "${app}" \
|
../settings/scripts/couchdb-dump/couchdb-dump.sh -b -H 127.0.0.1 -d "${app}" \
|
||||||
-q -u admin -p "${password_couchdb_admin}" -f "${YNH_CWD}/${app}.json"
|
-q -u admin -p "${password_couchdb_admin}" -f "${YNH_CWD}/${app}.json"
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# MODIFY URL IN NGINX CONF
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# END OF SCRIPT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
|
|
@ -17,7 +17,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# INITIALIZE AND STORE SETTINGS
|
# INITIALIZE AND STORE SETTINGS
|
||||||
# todo: do we need to store the password un-encrypted somewhere on the system?
|
# TODO: do we need to store the password un-encrypted somewhere on the system?
|
||||||
# → there's no way to get the admin password later if sometimes in the future deleting
|
# → there's no way to get the admin password later if sometimes in the future deleting
|
||||||
# the app will delete its specific database only (instead of the whole couchdb server as
|
# the app will delete its specific database only (instead of the whole couchdb server as
|
||||||
# of now in the earliest versions of the integration).
|
# of now in the earliest versions of the integration).
|
||||||
|
@ -76,16 +76,7 @@ ynh_add_config --template="../conf/flohmarkt.conf" --destination="$flohmarkt_app
|
||||||
# setup couchdb
|
# setup couchdb
|
||||||
ynh_script_progression --message="Setup couchdb database and user for flohmarkt..." --weight=2
|
ynh_script_progression --message="Setup couchdb database and user for flohmarkt..." --weight=2
|
||||||
flohmarkt_ynh_check_old_couchdb
|
flohmarkt_ynh_check_old_couchdb
|
||||||
(
|
flohmarkt_ynh_initialize_couchdb
|
||||||
set +o nounset
|
|
||||||
source "$flohmarkt_venv_dir/bin/activate"
|
|
||||||
set -o nounset
|
|
||||||
cd "$flohmarkt_app_dir"
|
|
||||||
# initialize_couchdb seems to re-try on connect problems endlessly blocking the yunohost api
|
|
||||||
# give it 45 seconds to finish and then fail
|
|
||||||
# https://codeberg.org/ChriChri/flohmarkt_ynh/issues/13
|
|
||||||
timeout 45 python3 initialize_couchdb.py $password_couchdb_admin
|
|
||||||
)
|
|
||||||
|
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=2
|
ynh_script_progression --message="Configuring log rotation..." --weight=2
|
||||||
|
|
|
@ -59,17 +59,7 @@ ynh_script_progression --message="Upgrading flohmarkt configuration..." --weight
|
||||||
ynh_add_config --template="../conf/flohmarkt.conf" --destination="$flohmarkt_app_dir/flohmarkt.conf"
|
ynh_add_config --template="../conf/flohmarkt.conf" --destination="$flohmarkt_app_dir/flohmarkt.conf"
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrading flohmarkt couchdb..." --weight=10
|
ynh_script_progression --message="Upgrading flohmarkt couchdb..." --weight=10
|
||||||
# run initialize_couchdb.py
|
flohmarkt_ynh_initialize_couchdb
|
||||||
(
|
|
||||||
set +o nounset
|
|
||||||
source "$flohmarkt_venv_dir/bin/activate"
|
|
||||||
set -o nounset
|
|
||||||
cd "$flohmarkt_app_dir"
|
|
||||||
# initialize_couchdb seems to re-try on connect problems endlessly blocking the yunohost api
|
|
||||||
# give it 45 seconds to finish and then fail
|
|
||||||
# https://codeberg.org/ChriChri/flohmarkt_ynh/issues/13
|
|
||||||
timeout 45 python3 initialize_couchdb.py $password_couchdb_admin $password_couchdb_flohmarkt
|
|
||||||
)
|
|
||||||
|
|
||||||
# set file permissions for install dir
|
# set file permissions for install dir
|
||||||
flohmarkt_ynh_set_permission
|
flohmarkt_ynh_set_permission
|
||||||
|
|
Loading…
Reference in a new issue