mirror of
https://github.com/YunoHost-Apps/flohmarkt_ynh.git
synced 2024-09-03 18:36:30 +02:00
Merge branch 'testing' of https://github.com/YunoHost-Apps/flohmarkt_ynh into testing
This commit is contained in:
commit
27920e6cfc
7 changed files with 54 additions and 62 deletions
|
@ -1,5 +1,3 @@
|
|||
[chttpd]
|
||||
; prevent non admin users to be able to access the list of all databases
|
||||
admin_only_all_dbs = true
|
||||
|
||||
; port = __##PORT_COUCHDB__
|
||||
|
|
|
@ -10,7 +10,6 @@ UseHttps = 0
|
|||
Host = 127.0.0.1
|
||||
User = __APP__
|
||||
Password = __PASSWORD_COUCHDB_FLOHMARKT__
|
||||
# Port = __##PORT_COUCHDB__
|
||||
Port = 5984
|
||||
Database = __APP__
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ Group=__APP__
|
|||
WorkingDirectory=__FLOHMARKT_APP_DIR__
|
||||
Environment="VENV_DIR=__FLOHMARKT_VENV_DIR__"
|
||||
ExecStart=/bin/bash -c "__FLOHMARKT_VENV_DIR__/bin/uvicorn --host 127.0.0.1 --port __PORT__ flohmarkt.web:start 2>&1 | /usr/bin/ts '%%Y-%%m-%%d %%H:%%M:%%S'"
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
# nicer logfile naming https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/38
|
||||
StandardOutput=append:__FLOHMARKT_LOGFILE__
|
||||
StandardError=inherit
|
||||
|
|
|
@ -53,14 +53,49 @@ flohmarkt_ynh_set_permission() {
|
|||
chmod g-w,o-rwx -R "$flohmarkt_install"
|
||||
}
|
||||
|
||||
# start flohmarkt service
|
||||
flohmarkt_ynh_start_service() {
|
||||
ynh_systemd_action --service_name=$flohmarkt_filename --action="start" \
|
||||
--line_match='INFO: *Application startup complete.' --log_path="$flohmarkt_logfile" \
|
||||
--timeout=30
|
||||
}
|
||||
|
||||
# stop flohmarkt service
|
||||
flohmarkt_ynh_stop_service() {
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
ynh_systemd_action --service_name=$flohmarkt_filename --action="stop"
|
||||
}
|
||||
|
||||
# start couchdb and wait for success
|
||||
flohmarkt_ynh_start_couchdb() {
|
||||
ynh_systemd_action --service_name=couchdb --action="start" --timeout=30 \
|
||||
--log_path="/var/log/couchdb/couchdb.log" \
|
||||
--line_match='Apache CouchDB has started on http://127.0.0.1'
|
||||
}
|
||||
|
||||
# stop couchdb
|
||||
flohmarkt_ynh_stop_couchdb() {
|
||||
ynh_systemd_action --service_name=couchdb --action="stop" --timeout=30 \
|
||||
--log_path="/var/log/couchdb/couchdb.log" \
|
||||
--line_match='SIGTERM received - shutting down'
|
||||
}
|
||||
|
||||
# install or upgrade couchdb
|
||||
flohmarkt_ynh_up_inst_couchdb() {
|
||||
echo "\
|
||||
couchdb couchdb/mode select standalone
|
||||
couchdb couchdb/mode seen true
|
||||
couchdb couchdb/bindaddress string 127.0.0.1
|
||||
couchdb couchdb/bindaddress seen true
|
||||
couchdb couchdb/cookie string $couchdb_magic_cookie
|
||||
couchdb couchdb/adminpass password $password_couchdb_admin
|
||||
couchdb couchdb/adminpass seen true
|
||||
couchdb couchdb/adminpass_again password $password_couchdb_admin
|
||||
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
||||
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
||||
ynh_install_extra_app_dependencies \
|
||||
--repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \
|
||||
--key="https://couchdb.apache.org/repo/keys.asc" \
|
||||
--package="couchdb"
|
||||
}
|
||||
|
||||
# create venv
|
||||
|
|
|
@ -33,22 +33,11 @@ ynh_script_progression --message="Installing CouchDB..." --weight=60
|
|||
couchdb_magic_cookie=$(ynh_string_random --length=23 --filter='A-Za-z0-9_')
|
||||
ynh_app_setting_set --app=$app --key=couchdb_magic_cookie --value="$couchdb_magic_cookie"
|
||||
|
||||
echo "\
|
||||
couchdb couchdb/mode select standalone
|
||||
couchdb couchdb/mode seen true
|
||||
couchdb couchdb/bindaddress string 127.0.0.1
|
||||
couchdb couchdb/bindaddress seen true
|
||||
couchdb couchdb/cookie string $couchdb_magic_cookie
|
||||
couchdb couchdb/adminpass password $password_couchdb_admin
|
||||
couchdb couchdb/adminpass seen true
|
||||
couchdb couchdb/adminpass_again password $password_couchdb_admin
|
||||
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
||||
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
||||
# update couchdb dpkg
|
||||
flohmarkt_ynh_up_inst_couchdb
|
||||
|
||||
ynh_install_extra_app_dependencies \
|
||||
--repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \
|
||||
--key="https://couchdb.apache.org/repo/keys.asc" \
|
||||
--package="couchdb"
|
||||
# stop couchdb
|
||||
flohmarkt_ynh_stop_couchdb
|
||||
|
||||
# add couchdb configuration
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=2
|
||||
|
@ -58,8 +47,7 @@ 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
|
||||
systemctl restart couchdb
|
||||
systemctl status couchdb
|
||||
flohmarkt_ynh_start_couchdb
|
||||
|
||||
# get flohmarkt
|
||||
# suspecting that this deletes all other sources for YNH_APP_ID
|
||||
|
|
|
@ -10,26 +10,8 @@ ynh_restore_file --origin_path="/var/lib/couchdb"
|
|||
|
||||
# reinstall couchdb
|
||||
ynh_script_progression --message="Reinstalling couchdb..." --weight=40
|
||||
|
||||
echo "\
|
||||
couchdb couchdb/mode select standalone
|
||||
couchdb couchdb/mode seen true
|
||||
couchdb couchdb/bindaddress string 127.0.0.1
|
||||
couchdb couchdb/bindaddress seen true
|
||||
couchdb couchdb/cookie string $couchdb_magic_cookie
|
||||
couchdb couchdb/adminpass password $password_couchdb_admin
|
||||
couchdb couchdb/adminpass seen true
|
||||
couchdb couchdb/adminpass_again password $password_couchdb_admin
|
||||
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
||||
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
||||
|
||||
ynh_install_extra_app_dependencies \
|
||||
--repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \
|
||||
--key="https://couchdb.apache.org/repo/keys.asc" \
|
||||
--package="couchdb"
|
||||
|
||||
# stop couchdb
|
||||
systemctl stop couchdb
|
||||
flohmarkt_ynh_up_inst_couchdb
|
||||
flohmarkt_ynh_stop_couchdb
|
||||
|
||||
# add couchdb configuration
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=2
|
||||
|
@ -38,8 +20,7 @@ chown root:couchdb /opt/couchdb/etc/local.d/05-flohmarkt.ini
|
|||
chmod 640 /opt/couchdb/etc/local.d/05-flohmarkt.ini
|
||||
|
||||
# start couchdb
|
||||
systemctl start couchdb
|
||||
systemctl status couchdb
|
||||
flohmarkt_ynh_start_couchdb
|
||||
|
||||
# RESTORE THE APP MAIN DIR
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=10
|
||||
|
|
|
@ -17,7 +17,7 @@ ynh_script_progression --message="Stopping flohmarkt and CouchDB..." --weight=5
|
|||
# stop flohmarkt
|
||||
flohmarkt_ynh_stop_service
|
||||
# stop couchdb
|
||||
ynh_systemd_action --service_name=couchdb --action="stop"
|
||||
flohmarkt_ynh_stop_couchdb
|
||||
|
||||
# Upgrade ynh4 → ynh5, change of paths and filenames
|
||||
# https://matrix.to/#/!PauySEslPVuJCJCwlZ:matrix.org/$auU_rSL6MACt9wkyFGlCQbO8ivFlU0ztYW74TimZdcM?via=matrix.org&via=aria-net.org&via=sans-nuage.fr
|
||||
|
@ -30,21 +30,11 @@ fi
|
|||
|
||||
# upgrade couchdb
|
||||
ynh_script_progression --message="Upgrading CouchDB..." --weight=50
|
||||
echo "\
|
||||
couchdb couchdb/mode select standalone
|
||||
couchdb couchdb/mode seen true
|
||||
couchdb couchdb/bindaddress string 127.0.0.1
|
||||
couchdb couchdb/bindaddress seen true
|
||||
couchdb couchdb/cookie string $couchdb_magic_cookie
|
||||
couchdb couchdb/adminpass password $password_couchdb_admin
|
||||
couchdb couchdb/adminpass seen true
|
||||
couchdb couchdb/adminpass_again password $password_couchdb_admin
|
||||
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
||||
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
||||
ynh_install_extra_app_dependencies \
|
||||
--repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \
|
||||
--key="https://couchdb.apache.org/repo/keys.asc" \
|
||||
--package="couchdb"
|
||||
flohmarkt_ynh_up_inst_couchdb
|
||||
|
||||
# stop couchdb
|
||||
ynh_script_progression --message="Stop couchdb before updating configuration file..." --weight=1
|
||||
flohmarkt_ynh_stop_couchdb
|
||||
|
||||
# upgrade couchdb config
|
||||
ynh_script_progression --message="Updating couchdb configuration file..." --weight=1
|
||||
|
@ -52,10 +42,9 @@ ynh_add_config --template="../conf/05-flohmarkt.ini" --destination="/opt/couchdb
|
|||
chown root:couchdb /opt/couchdb/etc/local.d/05-flohmarkt.ini
|
||||
chmod 640 /opt/couchdb/etc/local.d/05-flohmarkt.ini
|
||||
|
||||
# start couchdb to pick up changes
|
||||
# start couchdb
|
||||
ynh_script_progression --message="Starting couchdb..." --weight=1
|
||||
ynh_systemd_action --service_name=couchdb --action="start"
|
||||
systemctl status couchdb
|
||||
flohmarkt_ynh_start_couchdb
|
||||
|
||||
# install upgrade for flohmarkt
|
||||
ynh_script_progression --message="Upgrading flohmarkt..." --weight=4
|
||||
|
|
Loading…
Reference in a new issue