1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flohmarkt_ynh.git synced 2024-09-03 18:36:30 +02:00
Chris Vogel 2024-05-30 08:50:08 +02:00
parent ac1e1798ff
commit 58ef9c10a4
5 changed files with 23 additions and 29 deletions

View file

@ -18,10 +18,4 @@ More about development of **flohmarkt**s yunohost integration can be found in [D
## removing this app ## removing this app
Removing a flohmarkt instance will **delete all of its data** for the time being. If you remove a flohmarkt **we strongly suggest to make a backup** beforehand. This [issue](https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/29) describes how we'll handle `remove` with and without `--purge` in the future.
**Warning:** This might break any existing installation of couchdb (there's an couchdb app to install just couchdb and expose its port via nginx reverse-proxy and possibly other software installing a couchdb). This could happen if you installed the couchdb app after you installed flohmarkt.
https://codeberg.org/flohmarkt/flohmarkt_ynh/src/commit/7721103bac61787f31a4b2f2ae695c65d4f26fc9/scripts/remove#L44
When installing flohmarkt on a a domain and letting it talk to other ActivityPub instances it will propagate a key associated to your domain. If you remove your flohmarkt from that domain and loose that key other instances might not want to talk to you anymore after you installed flohmarkt again on the same domain generating a new key. When installing flohmarkt on a a domain and letting it talk to other ActivityPub instances it will propagate a key associated to your domain. If you remove your flohmarkt from that domain and loose that key other instances might not want to talk to you anymore after you installed flohmarkt again on the same domain generating a new key.

View file

@ -52,9 +52,7 @@ flohmarkt_old_service="flohmarkt"
# otherwise not needed TODO delete after development of the two is done # otherwise not needed TODO delete after development of the two is done
flohmarkt_debug=0 flohmarkt_debug=0
flohmarkt_print_debug() { flohmarkt_print_debug() {
set +x
if [[ $flohmarkt_debug -eq 1 ]]; then echo "flohmarkt_debug: $*" >&2; fi if [[ $flohmarkt_debug -eq 1 ]]; then echo "flohmarkt_debug: $*" >&2; fi
set -x
} }
# source own development version of ynh_handle_getopts_args and ynh_local_curl # source own development version of ynh_handle_getopts_args and ynh_local_curl
source ynh_handle_getopts_args source ynh_handle_getopts_args
@ -135,9 +133,9 @@ flohmarkt_ynh_import_couchdb() {
flohmarkt_ynh_delete_couchdb_user() { flohmarkt_ynh_delete_couchdb_user() {
local couchdb_user_revision=$( ynh_local_curl -n -m GET -u admin -p "$password_couchdb_admin" \ local couchdb_user_revision=$( ynh_local_curl -n -m GET -u admin -p "$password_couchdb_admin" \
"http://localhost:5984/_users/org.couchdb.user%3A${app}" | jq -r ._rev ) "http://127.0.0.1:5984/_users/org.couchdb.user%3A${app}" | jq -r ._rev )
ynh_local_curl -n -m DELETE -u admin -p ${password_couchdb_admin} -l '"ok":true' \ ynh_local_curl -n -m DELETE -u admin -p ${password_couchdb_admin} -l '"ok":true' \
"http://localhost:5984/_users/org.couchdb.user%3A${app}?rev=${couchdb_user_revision}" "http://127.0.0.1:5984/_users/org.couchdb.user%3A${app}?rev=${couchdb_user_revision}"
} }
flohmarkt_ynh_create_couchdb_user() { flohmarkt_ynh_create_couchdb_user() {

View file

@ -21,30 +21,31 @@ ynh_script_progression --message="Stopping $app..." --weight=2
yunohost service stop $flohmarkt_filename yunohost service stop $flohmarkt_filename
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $flohmarkt_filename >/dev/null if ynh_exec_warn_less yunohost service status $flohmarkt_filename >/dev/null; then
then
ynh_script_progression --message="Removing $app service integration..." --weight=2 ynh_script_progression --message="Removing $app service integration..." --weight=2
ynh_remove_systemd_config --service=$flohmarkt_filename ynh_remove_systemd_config --service=$flohmarkt_filename
yunohost service remove $flohmarkt_filename yunohost service remove $flohmarkt_filename
fi fi
# https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/12 # remove DB user for this instance - a new install will create a new user and permissions
ynh_script_progression --message="Removing database and database user..." --weight=2 ynh_script_progression --message="Removing couchdb user..." --weight=2
# remove DB
flohmarkt_ynh_delete_couchdb_db
# remove DB user for this instance:
flohmarkt_ynh_delete_couchdb_user flohmarkt_ynh_delete_couchdb_user
if [[ $YNH_APP_PURGE -eq 1 ]]; then
ynh_script_progression --message="Purging couchdb database ..." --weight=2
# remove DB
flohmarkt_ynh_delete_couchdb_db
# remove logfiles directory
ynh_script_progression --message="Purging logfiles..." --weight=2
ynh_secure_remove --file="${flohmarkt_log_dir}"
else
ynh_script_progression --message="Purge not selected - not deleting couchdb and logfiles..." --weight=1
fi
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_script_progression --message="Removing logrotate configuration..." --weight=2 ynh_script_progression --message="Removing logrotate configuration..." --weight=2
ynh_remove_logrotate ynh_remove_logrotate
# remove logfiles directory
# https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/29
# can only remove a subdir or one file
ynh_script_progression --message="Removing logfiles..." --weight=2
ynh_secure_remove --file="${flohmarkt_log_dir}"
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_script_progression --message="Removing nginx configuration..." --weight=2 ynh_script_progression --message="Removing nginx configuration..." --weight=2
ynh_remove_nginx_config ynh_remove_nginx_config
@ -53,13 +54,8 @@ ynh_remove_nginx_config
ynh_script_progression --message="Removing fail2ban configuration..." --weight=2 ynh_script_progression --message="Removing fail2ban configuration..." --weight=2
ynh_remove_fail2ban_config ynh_remove_fail2ban_config
# Remove home
# https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/29
ynh_script_progression --message="Removing data directory..." --weight=2
ynh_secure_remove --file=$data_dir
# remove systemd service # remove systemd service
ynh_script_progression --message="Removing data directory..." --weight=2 ynh_script_progression --message="Removing systemd.service directory..." --weight=2
ynh_remove_systemd_config ynh_remove_systemd_config
# remove symlinks # remove symlinks

View file

@ -1,4 +1,7 @@
#!/bin/bash
# Redisgn of ynh_handle_getopts_args for flohmarkt to be tested as `flohmarkt_ynh_handle_getopts_args` # Redisgn of ynh_handle_getopts_args for flohmarkt to be tested as `flohmarkt_ynh_handle_getopts_args`
# https://github.com/YunoHost/yunohost/pull/1856
# Internal helper design to allow helpers to use getopts to manage their arguments # Internal helper design to allow helpers to use getopts to manage their arguments
# #
# [internal] # [internal]

View file

@ -1,4 +1,7 @@
#!/bin/bash
# local copy of ynh_local_curl() to test some improvement # local copy of ynh_local_curl() to test some improvement
# https://github.com/YunoHost/yunohost/pull/1857
# https://github.com/YunoHost/issues/issues/2396 # https://github.com/YunoHost/issues/issues/2396
# https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/51 # https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/51
ynh_local_curl() { ynh_local_curl() {