mirror of
https://github.com/YunoHost-Apps/funkwhale_ynh.git
synced 2024-09-03 18:36:24 +02:00
Apply example_ynh
This commit is contained in:
parent
2010081fe4
commit
9d704e47d3
4 changed files with 50 additions and 44 deletions
|
@ -24,7 +24,7 @@
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=0
|
incorrect_path=0
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=1
|
change_url=0
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=cda@rootkey.co.uk
|
Email=cda@rootkey.co.uk
|
||||||
Notification=all
|
Notification=all
|
||||||
|
|
|
@ -134,6 +134,34 @@ ynh_add_nginx_config "datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# ADD A CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a config file..."
|
||||||
|
|
||||||
|
key=$(ynh_string_random --length=45 | base64)
|
||||||
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
|
|
||||||
|
ynh_app_setting_set --app=$app --key=key --value=$key
|
||||||
|
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/env.prod" --destination="$final_path/config/.env"
|
||||||
|
|
||||||
|
chmod 400 "$final_path/config/.env"
|
||||||
|
chown $app:$app "$final_path/config/.env"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring a systemd service..."
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/funkwhale.target" --destination="/etc/systemd/system/$app.target"
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
ynh_add_systemd_config --service="${app}-server" --template="funkwhale-server.service" --others_var="datadir"
|
||||||
|
ynh_add_systemd_config --service="${app}-worker" --template="funkwhale-worker.service" --others_var="datadir"
|
||||||
|
ynh_add_systemd_config --service="${app}-beat" --template="funkwhale-beat.service" --others_var="datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL PYTHON DEPENDENCIES
|
# INSTALL PYTHON DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -148,20 +176,6 @@ pushd $final_path
|
||||||
pip install -r api/requirements.txt
|
pip install -r api/requirements.txt
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MODIFY THE CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Modifying a config file..."
|
|
||||||
|
|
||||||
key=$(ynh_string_random --length=45 | base64)
|
|
||||||
redis_db=$(ynh_redis_get_free_db)
|
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=key --value=$key
|
|
||||||
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/env.prod" --destination="$final_path/config/.env"
|
|
||||||
chmod 600 $final_path/config/.env
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILDING FUNKWHALE
|
# BUILDING FUNKWHALE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -179,18 +193,6 @@ pushd $final_path
|
||||||
echo "yes" | python api/manage.py collectstatic
|
echo "yes" | python api/manage.py collectstatic
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/funkwhale.target" --destination="/etc/systemd/system/$app.target"
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_add_systemd_config --service="${app}-server" --template="funkwhale-server.service" --others_var="datadir"
|
|
||||||
ynh_add_systemd_config --service="${app}-worker" --template="funkwhale-worker.service" --others_var="datadir"
|
|
||||||
ynh_add_systemd_config --service="${app}-beat" --template="funkwhale-beat.service" --others_var="datadir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -75,6 +75,22 @@ chown -R root:$app "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# RESTORE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring various files..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||||
|
|
||||||
|
mkdir -p $datadir
|
||||||
|
pushd $datadir
|
||||||
|
mkdir -p static media music
|
||||||
|
popd
|
||||||
|
|
||||||
|
chmod 750 "$datadir"
|
||||||
|
chmod -R o-rwx "$datadir"
|
||||||
|
chown -R root:$app "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -124,20 +140,6 @@ ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="sys
|
||||||
ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Application startup complete"
|
ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Application startup complete"
|
||||||
ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled"
|
ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring various files..."
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
|
||||||
|
|
||||||
mkdir -p $datadir
|
|
||||||
pushd $datadir
|
|
||||||
mkdir -p static media music
|
|
||||||
popd
|
|
||||||
|
|
||||||
chown -R $app: $datadir
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -183,12 +183,14 @@ pushd $final_path
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY THE CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modifying a config file..."
|
ynh_script_progression --message="Updating a config file..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/env.prod" --destination="$final_path/config/.env"
|
ynh_add_config --template="../conf/env.prod" --destination="$final_path/config/.env"
|
||||||
chmod 600 $final_path/config/.env
|
|
||||||
|
chmod 400 "$final_path/config/.env"
|
||||||
|
chown $app:$app "$final_path/config/.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE FUNKWHALE
|
# UPGRADE FUNKWHALE
|
||||||
|
|
Loading…
Add table
Reference in a new issue