mirror of
https://github.com/YunoHost-Apps/flohmarkt_ynh.git
synced 2024-09-03 18:36:30 +02:00
check for old db(user), added information
information added about the state of the integration Release candidate for ynh5
This commit is contained in:
parent
f1bfdd1283
commit
9d893b688e
4 changed files with 49 additions and 14 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
To finish your flohmarkt setup you'll need to open its setup URL.
|
||||
|
||||
You can find the setup URL in the logfile __FLOHMARKT_LOGFILE__ if you look for entries like this:
|
||||
You can find the setup URL in flohmarkts logfile in /var/log/flohmarkt… if you look for entries like this:
|
||||
|
||||
```
|
||||
2024-05-06 16:30:24 Flohmarkt is not initialized yet. Please go to
|
||||
|
|
|
@ -7,13 +7,19 @@ flohmarkt expects to install CouchDB from the Apache repository for its use. Ins
|
|||
https://codeberg.org/flohmarkt/flohmarkt_ynh/src/commit/7721103bac61787f31a4b2f2ae695c65d4f26fc9/scripts/install#L9
|
||||
https://codeberg.org/ChriChri/flohmarkt_ynh/issues/9
|
||||
|
||||
## choosing a sender email address
|
||||
|
||||
flohmarkt will send email and you'll be asked for an address used as the sender in these emails. yunohost will try to configure your chosen address as an allowed sender, but for the time being **this will only work if the sender address is not in use otherwise** - e.g. as an alias.
|
||||
|
||||
This [issue](https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/50) contains information about the problem.
|
||||
|
||||
## multiple flohmarkt on the same subdomain
|
||||
|
||||
The installation will allow you to **test** this. The feature is not well tested, yet, and installing multiple productive flohmarkts in the same domain might not work on the fediverse.
|
||||
|
||||
Feedback is more than welcome!
|
||||
|
||||
## No integration in yunohost user database"
|
||||
## No integration in yunohost user database
|
||||
|
||||
flohmarkt mainanins its own user database in CouchDB. Users have to register to flohmarkt to get an account. Registration cannot be restricted to yunohost users.
|
||||
|
||||
|
@ -21,6 +27,8 @@ https://codeberg.org/ChriChri/flohmarkt_ynh/issues/5 .
|
|||
|
||||
## removing
|
||||
|
||||
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
|
||||
|
|
|
@ -40,7 +40,6 @@ flohmarkt_old_install="/opt/flohmarkt"
|
|||
flohmarkt_old_venv_dir="${flohmarkt_old_install}/venv"
|
||||
flohmarkt_old_app_dir="${flohmarkt_old_install}/flohmarkt"
|
||||
flohmarkt_old_log_dir="/var/log/flohmarkt/"
|
||||
flohmarkt_old_logfile="flohmarkt"
|
||||
flohmarkt_old_service="flohmarkt"
|
||||
|
||||
#=================================================
|
||||
|
@ -126,6 +125,8 @@ flohmarkt_ynh_create_couchdb_user() {
|
|||
curl -s -X PUT "http://127.0.0.1:5984/_users/org.couchdb.user:${app}" --user "admin:${password_couchdb_admin}"\
|
||||
-H "Accept: application/json" -H "Content-Type: application/json" \
|
||||
-d "{\"name\": \"${app}\", \"password\": \"${password_couchdb_flohmarkt}\", \"roles\": [], \"type\": \"user\"}"
|
||||
# @@ check answer something like
|
||||
# {"ok":true,"id":"org.couchdb.user:flohmarkt","rev":"35-9865694604ab384388eea0f978a6e728"}
|
||||
}
|
||||
|
||||
flohmarkt_ynh_couchdb_user_permissions() {
|
||||
|
@ -135,14 +136,38 @@ flohmarkt_ynh_couchdb_user_permissions() {
|
|||
|
||||
}
|
||||
|
||||
flohmarkt_ynh_exists_couchdb_user() {
|
||||
if [[ $( curl -sX GET "http://127.0.0.1:5984/_users/org.couchdb.user%3A${app}" \
|
||||
--user "admin:${password_couchdb_admin}" | jq .error ) == '"not_found"' ]]
|
||||
then
|
||||
false
|
||||
else
|
||||
true
|
||||
fi
|
||||
}
|
||||
|
||||
flohmarkt_ynh_exists_couchdb_db() {
|
||||
if [[ $( curl -sX GET "http://127.0.0.1:5984/flohmarkt__22" --user admin:blafasel \
|
||||
| jq .error ) == '"not_found"' ]]
|
||||
then
|
||||
false
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# check whether old couchdb user or database exist before creating the new ones
|
||||
flohmarkt_ynh_check_old_couchdb() {
|
||||
if flohmarkt_ynh_exists_couchdb_user; then
|
||||
ynh_die --ret_code=100 --message="CouchDB user '$app' exists already. Stopping install."
|
||||
elif flohmarkt_ynh_exists_couchdb_db; then
|
||||
ynh_die --ret_code=100 --message="CouchDB database '$app' exists already. Stopping install."
|
||||
fi
|
||||
}
|
||||
|
||||
flohmarkt_ynh_restore_couchdb() {
|
||||
# @@ todo for now we'll make sure dbuser and db do not exist
|
||||
# matrix:
|
||||
# Is there a way to interact with the admin during the scripts/* run?
|
||||
# absolutely not, and it's by design.
|
||||
# at bear minimum if you use the manifest v2 and app helpers, the script should fail.
|
||||
flohmarkt_ynh_delete_couchdb_user || true
|
||||
flohmarkt_ynh_delete_couchdb_db || true
|
||||
flohmarkt_ynh_check_old_couchdb
|
||||
|
||||
flohmarkt_ynh_import_couchdb
|
||||
flohmarkt_ynh_create_couchdb_user
|
||||
|
@ -184,10 +209,6 @@ flohmarkt_ynh_upgrade_path_ynh5() {
|
|||
|
||||
# move logfile directory
|
||||
mkdir -p "$flohmarkt_log_dir"
|
||||
mv ${flohmarkt_old_log_dir}/${flohmarkt_old_logfile}.* "$flohmarkt_log_dir"
|
||||
|
||||
# update settings for above
|
||||
# @@ automatically done? maybe?
|
||||
|
||||
# remove systemd.service - will be generated newly by upgrade
|
||||
# ynh_remove_systemd_config --service="$flohmarkt_old_service"
|
||||
|
|
|
@ -47,13 +47,16 @@ chown root:couchdb /opt/couchdb/etc/local.d/05-flohmarkt.ini
|
|||
chmod 640 /opt/couchdb/etc/local.d/05-flohmarkt.ini
|
||||
|
||||
# restart couchdb to pick up changes
|
||||
ynh_script_progression --message="Starting CouchDB..." --weight=2
|
||||
flohmarkt_ynh_start_couchdb
|
||||
|
||||
# get flohmarkt
|
||||
# suspecting that this deletes all other sources for YNH_APP_ID
|
||||
ynh_script_progression --message="Downloading flohmarkt..." --weight=2
|
||||
ynh_setup_source --dest_dir="$flohmarkt_app_dir"
|
||||
|
||||
# setup python environment for flohmarkt
|
||||
ynh_script_progression --message="Creating python venv..." --weight=2
|
||||
ynh_secure_remove "$flohmarkt_venv_dir"
|
||||
flohmarkt_ynh_create_venv
|
||||
flohmarkt_ynh_venv_requirements
|
||||
|
@ -67,9 +70,12 @@ password_couchdb_flohmarkt=$(ynh_string_random --length=31 --filter='A-Za-z0-9_.
|
|||
ynh_app_setting_set --app=$app --key=password_couchdb_flohmarkt --value="$password_couchdb_flohmarkt"
|
||||
|
||||
# generate flohmarkt.conf
|
||||
ynh_script_progression --message="Adding flohmarkt.conf configuration..." --weight=2
|
||||
ynh_add_config --template="../conf/flohmarkt.conf" --destination="$flohmarkt_app_dir/flohmarkt.conf"
|
||||
|
||||
# setup couchdb
|
||||
ynh_script_progression --message="Setup couchdb database and user for flohmarkt..." --weight=2
|
||||
flohmarkt_ynh_check_old_couchdb
|
||||
(
|
||||
set +o nounset
|
||||
source "$flohmarkt_venv_dir/bin/activate"
|
||||
|
|
Loading…
Add table
Reference in a new issue