mirror of
https://github.com/YunoHost-Apps/funkwhale_ynh.git
synced 2024-09-03 18:36:24 +02:00
parent
5fe8d54599
commit
85ac964ebc
12 changed files with 148 additions and 262 deletions
15
README.md
15
README.md
|
@ -1,17 +1,17 @@
|
|||
# Funkwhale
|
||||
# Funkwhale for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/funkwhale)
|
||||
[](https://dash.yunohost.org/appci/app/funkwhale)  
|
||||
[](https://install-app.yunohost.org/?app=funkwhale)
|
||||
|
||||
> *This package allows you to install Funkwhale quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
|
||||
## Overview
|
||||
A modern, convivial and free music server on YunoHost
|
||||
|
||||
Installation requires a dedicated domain or subdomain. Installing in a subpath is not supported by the upstream project due to dependency requirements.
|
||||
|
||||
**Shipped version:** 0.21.1
|
||||
**Shipped version:** 1.0
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
@ -48,9 +48,8 @@ The admin interface is accessible at the address: your.domain.fr/api/admin
|
|||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/funkwhale/)
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/funkwhale/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/funkwhale/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/funkwhale/)
|
||||
|
||||
## Links
|
||||
|
||||
|
@ -62,10 +61,8 @@ The admin interface is accessible at the address: your.domain.fr/api/admin
|
|||
|
||||
---
|
||||
|
||||
Developers info
|
||||
----------------
|
||||
## Developers info
|
||||
|
||||
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/funkwhale_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
|
|
|
@ -22,28 +22,11 @@
|
|||
incorrect_path=0
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
;;; Levels
|
||||
|
||||
;;; Options
|
||||
Email=cda@rootkey.co.uk
|
||||
Notification=all
|
||||
;;; Upgrade options
|
||||
; commit=80a5044d13a6782063fee2d7fb7a01832a6aa767
|
||||
name=Upgrade from 0.16.3
|
||||
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
|
||||
; commit=806bcb0f320d8e3e28711a9ae1d2b175b95c65ce
|
||||
name=Upgrade from 0.17.0~ynh2
|
||||
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
|
||||
; commit=99bae16efca321ce50ba9a98c62996169195e0ba
|
||||
name=Upgrade from 0.18.3
|
||||
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
|
||||
; commit=4d4bf0981e2d3a00eaae6b19bd54344fe55d6530
|
||||
name=Upgrade from 0.19.1
|
||||
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
|
||||
; commit=4d4bf0981e2d3a00eaae6b19bd54344fe55d6530
|
||||
name=Upgrade from 0.20.1
|
||||
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
|
||||
; commit=18dd9d6a59ad1f0d03dc634b20e805b5c4f6c6e9
|
||||
name=Upgrade from 0.21
|
||||
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
|
||||
|
||||
name=Upgrade to 0.19.1 and fix channels-redis bug
|
||||
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/0.21.1/download?job=build_front
|
||||
SOURCE_SUM=94888623d44da2d5c774827e206ce4981a810b54043d7f4b2cfd04b37052718a
|
||||
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/1.0/download?job=build_front
|
||||
SOURCE_SUM=f062d7485325a78f08afaf2c641d8616e983d82d11dfc1e656cbc09a113c4202
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=false
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/archive/0.21.1/funkwhale-0.21.1.tar.gz
|
||||
SOURCE_SUM=94239023d52f1327941a28d0bec7c0eebe991f80b5ea25257485c7d27320957a
|
||||
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/archive/1.0/funkwhale-1.0.tar.gz
|
||||
SOURCE_SUM=c305ad352b739f0665c775922ab657991fa3c4c6830bf93210e98659a08f37d5
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.bz2
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"description": {
|
||||
"en": "A modern, convivial and free music server"
|
||||
},
|
||||
"version": "0.21.1~ynh1",
|
||||
"version": "0.1.0.1~ynh1",
|
||||
"url": "https://funkwhale.audio",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
|
@ -17,7 +17,7 @@
|
|||
"email": "jean-baptiste@holcroft.fr"
|
||||
}],
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.6"
|
||||
"yunohost": ">= 4.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -53,4 +53,4 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -125,72 +125,3 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
|||
# Send the email to the recipients
|
||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# fail2ban helpers
|
||||
# taken from https://github.com/YunoHost-Apps/shaarli_ynh
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated fail2ban config (jail and filter conf files)
|
||||
#
|
||||
# usage: ynh_add_fail2ban_config log_file filter [max_retry [ports]]
|
||||
# | arg: log_file - Log file to be checked by fail2ban
|
||||
# | arg: failregex - Failregex to be looked for by fail2ban
|
||||
# | arg: max_retry - Maximum number of retries allowed before banning IP address - default: 3
|
||||
# | arg: ports - Ports blocked for a banned IP address - default: http,https
|
||||
ynh_add_fail2ban_config () {
|
||||
local logpath
|
||||
local failregex
|
||||
local max_retry
|
||||
local ports
|
||||
|
||||
logpath=$1
|
||||
failregex=$2
|
||||
max_retry=${3:-3}
|
||||
ports=${4:-http,https}
|
||||
|
||||
test -n "$logpath" || ynh_die --message="ynh_add_fail2ban_config expects a logfile path as first argument and received nothing."
|
||||
test -n "$failregex" || ynh_die --message="ynh_add_fail2ban_config expects a failure regex as second argument and received nothing."
|
||||
|
||||
finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf"
|
||||
finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1
|
||||
ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1
|
||||
|
||||
sudo tee "$finalfail2banjailconf" <<EOF
|
||||
[$app]
|
||||
enabled = true
|
||||
port = $ports
|
||||
filter = $app
|
||||
logpath = $logpath
|
||||
maxretry = $max_retry
|
||||
EOF
|
||||
|
||||
sudo tee "$finalfail2banfilterconf" <<EOF
|
||||
[INCLUDES]
|
||||
before = common.conf
|
||||
[Definition]
|
||||
failregex = $failregex
|
||||
ignoreregex =
|
||||
EOF
|
||||
|
||||
ynh_store_file_checksum "$finalfail2banjailconf"
|
||||
ynh_store_file_checksum "$finalfail2banfilterconf"
|
||||
|
||||
systemctl restart fail2ban
|
||||
local fail2ban_error="$(journalctl -u fail2ban | tail -n50 | grep "WARNING.*$app.*")"
|
||||
if [ -n "$fail2ban_error" ]
|
||||
then
|
||||
echo "[ERR] Fail2ban failed to load the jail for $app" >&2
|
||||
echo "WARNING${fail2ban_error#*WARNING}" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
# Remove the dedicated fail2ban config (jail and filter conf files)
|
||||
#
|
||||
# usage: ynh_remove_fail2ban_config
|
||||
ynh_remove_fail2ban_config () {
|
||||
ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf"
|
||||
systemctl reload fail2ban
|
||||
}
|
||||
|
|
|
@ -32,11 +32,13 @@ domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
|||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the main app directory..."
|
||||
|
||||
backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only)
|
||||
# If backup_core_only have any value in the settings.yml file, do not backup the data directory
|
||||
|
@ -51,7 +53,6 @@ fi
|
|||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up nginx web server configuration..."
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.conf"
|
||||
|
@ -68,7 +69,6 @@ ynh_psql_dump_db --database="$db_name" > db.sql
|
|||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up systemd configuration..."
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-beat.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-server.service"
|
||||
|
|
|
@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Validating installation parameters..."
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
final_path="/var/www/$app"
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
@ -44,7 +44,7 @@ ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url"
|
|||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_print_info --message="Storing installation settings..."
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
||||
ynh_app_setting_set --app="$app" --key=path --value="$path_url"
|
||||
|
@ -56,7 +56,7 @@ ynh_app_setting_set --app="$app" --key=admin --value="$admin"
|
|||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring firewall..."
|
||||
ynh_script_progression --message="Configuring firewall..."
|
||||
|
||||
# Find a free port
|
||||
port=$(ynh_find_port --port=5000)
|
||||
|
@ -66,14 +66,14 @@ ynh_app_setting_set --app="$app" --key=port --value="$port"
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Installing dependencies..."
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Creating a PostgreSQL database..."
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..."
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
|
||||
|
@ -89,7 +89,7 @@ ynh_psql_setup_db --db_name="$db_name" --db_user="$db_user" --db_pwd="$db_pwd"
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info --message="Setting up source files..."
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
|
@ -104,7 +104,7 @@ ynh_setup_source --dest_dir="$final_path/code" --source_id="app-frontend"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring nginx web server..."
|
||||
ynh_script_progression --message="Configuring nginx web server..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
@ -112,7 +112,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring system user..."
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username="$app" --home_dir="$final_path"
|
||||
|
@ -179,7 +179,7 @@ admin_mail=$(ynh_user_get_info --username="$admin" --key="mail")
|
|||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring a systemd service..."
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
|
||||
cp ../conf/funkwhale.target "/etc/systemd/system/$app.target"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/systemd/system/$app.target"
|
||||
|
@ -212,14 +212,14 @@ chown -R "$app": "/var/log/$app"
|
|||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add "$app-server" --log "/var/log/$app/server.log"
|
||||
yunohost service add "$app-worker" --log "/var/log/$app/worker.log"
|
||||
yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
|
||||
yunohost service add "$app-server" --log="/var/log/$app/server.log"
|
||||
yunohost service add "$app-worker" --log="/var/log/$app/worker.log"
|
||||
yunohost service add "$app-beat" --log="/var/log/$app/beat.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --action="start" --service_name="${app}-beat"
|
||||
ynh_systemd_action --action="start" --service_name="${app}-server"
|
||||
|
@ -228,7 +228,7 @@ ynh_systemd_action --action="start" --service_name="${app}-worker"
|
|||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring fail2ban..."
|
||||
ynh_script_progression --message="Configuring Fail2Ban..."
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST>.* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" --max_retry=5
|
||||
|
@ -236,7 +236,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring SSOwat..."
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ "$is_public" -eq 1 ]
|
||||
|
@ -248,7 +248,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -256,4 +256,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Installation of $app completed"
|
||||
ynh_script_progression --message="Installation of $app completed"
|
||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -32,26 +32,26 @@ redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
|
|||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
if yunohost service status "$app-server" >/dev/null 2>&1
|
||||
then
|
||||
ynh_print_info --message="Remove $app-server service"
|
||||
ynh_script_progression --message="Remove $app-server service"
|
||||
yunohost service remove "$app-server"
|
||||
fi
|
||||
|
||||
if yunohost service status "$app-worker" >/dev/null 2>&1
|
||||
then
|
||||
ynh_print_info --message="Remove $app-worker service"
|
||||
ynh_script_progression --message="Remove $app-worker service"
|
||||
yunohost service remove "$app-worker"
|
||||
fi
|
||||
|
||||
if yunohost service status "$app-beat" >/dev/null 2>&1
|
||||
then
|
||||
ynh_print_info --message="Remove $app-beat service"
|
||||
ynh_script_progression --message="Remove $app-beat service"
|
||||
yunohost service remove "$app-beat"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Stopping and removing the systemd service"
|
||||
ynh_script_progression --message="Stopping and removing the systemd service"
|
||||
|
||||
ynh_systemd_action --action="stop" --service_name="${app}-beat"
|
||||
ynh_systemd_action --action="stop" --service_name="${app}-server"
|
||||
|
@ -67,7 +67,7 @@ ynh_secure_remove --file="/etc/systemd/system/$app.target"
|
|||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the PostgreSQL database"
|
||||
ynh_script_progression --message="Removing the PostgreSQL database"
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_name="$db_name" --db_user="$db_user"
|
||||
|
@ -75,7 +75,7 @@ ynh_psql_remove_db --db_name="$db_name" --db_user="$db_user"
|
|||
#=================================================
|
||||
# REMOVE THE REDIS DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the Redis database"
|
||||
ynh_script_progression --message="Removing the Redis database"
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_redis_remove_db "$redis_db"
|
||||
|
@ -83,7 +83,7 @@ ynh_redis_remove_db "$redis_db"
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing dependencies"
|
||||
ynh_script_progression --message="Removing dependencies"
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
@ -91,7 +91,7 @@ ynh_remove_app_dependencies
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing app main directory"
|
||||
ynh_script_progression --message="Removing app main directory"
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
@ -101,25 +101,15 @@ ynh_secure_remove --file="/var/log/$app"
|
|||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing nginx web server configuration"
|
||||
ynh_script_progression --message="Removing NGINX web server configuration"
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_print_info --message="Closing port $port"
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing fail2ban configuration..."
|
||||
ynh_script_progression --message="Removing Fail2Ban configuration..."
|
||||
|
||||
ynh_remove_fail2ban_config
|
||||
|
||||
|
@ -128,7 +118,7 @@ ynh_remove_fail2ban_config
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the dedicated system user"
|
||||
ynh_script_progression --message="Removing the dedicated system user"
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username="$app"
|
||||
|
@ -137,4 +127,4 @@ ynh_system_user_delete --username="$app"
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Removal of $app completed"
|
||||
ynh_script_progression --message="Removal of $app completed"
|
||||
|
|
|
@ -23,7 +23,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading settings..."
|
||||
ynh_script_progression --message="Loading settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -37,7 +37,7 @@ db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_print_info --message="Validating restoration parameters..."
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
ynh_webpath_available --domain="$domain" --path_url="$path_url" \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
|
@ -56,7 +56,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.conf"
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info --message="Restoring the app main directory..."
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only)
|
||||
|
||||
|
@ -86,7 +86,7 @@ fi
|
|||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info --message="Recreating the dedicated system user..."
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username="$app" --home_dir="$final_path"
|
||||
|
@ -107,7 +107,7 @@ chown -R "$app": "/var/log/$app"
|
|||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Reinstalling dependencies..."
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
@ -115,7 +115,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Restoring the PostgreSQL database..."
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
|
||||
|
@ -124,29 +124,29 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
|||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info --message="Restoring the systemd configuration..."
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-beat.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-server.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-worker.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.target"
|
||||
|
||||
systemctl enable "$app-beat.service"
|
||||
systemctl enable "$app-server.service"
|
||||
systemctl enable "$app-worker.service"
|
||||
systemctl enable "$app-beat.service" --quiet
|
||||
systemctl enable "$app-server.service" --quiet
|
||||
systemctl enable "$app-worker.service" --quiet
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add "$app-server" --log "/var/log/$app/server.log"
|
||||
yunohost service add "$app-worker" --log "/var/log/$app/worker.log"
|
||||
yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
|
||||
yunohost service add "$app-server" --log="/var/log/$app/server.log"
|
||||
yunohost service add "$app-worker" --log="/var/log/$app/worker.log"
|
||||
yunohost service add "$app-beat" --log="/var/log/$app/beat.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --action="start" --service_name="${app}-beat"
|
||||
ynh_systemd_action --action="start" --service_name="${app}-server"
|
||||
|
@ -157,7 +157,7 @@ ynh_systemd_action --action="start" --service_name="${app}-worker"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -165,4 +165,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Restoration completed for $app"
|
||||
ynh_script_progression --message="Restoration completed for $app"
|
||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -30,7 +30,7 @@ code_migration=$(ynh_app_setting_get --app="$app" --key=code_migration)
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_print_info --message="Ensuring downward compatibility..."
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# If redis_db doesn't exist, create it
|
||||
if [ -z "$redis_db" ]; then
|
||||
|
@ -55,7 +55,7 @@ fi
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Inform the backup/restore process that it should not save the data directory
|
||||
ynh_app_setting_set --app="$app" --key=backup_core_only --value=1
|
||||
|
@ -74,35 +74,18 @@ ynh_abort_if_errors
|
|||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path "$path_url")
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# see 0.20.0: https://docs.funkwhale.audio/changelog.html#automatically-load-env-file
|
||||
loadfile="$final_path/code/load_env"
|
||||
if [ -e "$loadfile" ] ; then
|
||||
ynh_secure_remove --file="$loadfile"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
echo "Close port $port"
|
||||
yunohost firewall disallow TCP $port 2>&1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Stopping a systemd service..."
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --action="stop" --service_name="${app}-beat"
|
||||
ynh_systemd_action --action="stop" --service_name="${app}-server"
|
||||
|
@ -111,7 +94,7 @@ ynh_systemd_action --action="stop" --service_name="${app}-worker"
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading source files..."
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
|
@ -126,22 +109,22 @@ ynh_setup_source --dest_dir="$final_path/code" --source_id="app-frontend"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading nginx web server configuration..."
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading dependencies..."
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info --message="Making sure dedicated system user exists..."
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username="$app" --home_dir="$final_path"
|
||||
|
@ -206,16 +189,22 @@ ynh_replace_string --match_string="__KEY__" --replace_string="$key"
|
|||
python api/manage.py collectstatic --clear --noinput
|
||||
|
||||
# https://code.eliotberriot.com/funkwhale/funkwhale/tags/0.16 # users-now-have-an-activitypub-actor-manual-action-required
|
||||
python api/manage.py script create_actors --no-input
|
||||
# python api/manage.py script create_actors --no-input
|
||||
# https://code.eliotberriot.com/funkwhale/funkwhale/tags/0.16 #image-thumbnails-manual-action-required
|
||||
python api/manage.py script create_image_variations --no-input
|
||||
# python api/manage.py script create_image_variations --no-input
|
||||
|
||||
# https://docs.funkwhale.audio/upgrading/0.17.html#upgrade-instructions
|
||||
python api/manage.py script migrate_to_user_libraries --no-input
|
||||
# python api/manage.py script migrate_to_user_libraries --no-input
|
||||
|
||||
# Delete pre 0.17 federated tracks [manual action suggested]
|
||||
# https://dev.funkwhale.audio/funkwhale/funkwhale/tags/0.18
|
||||
python api/manage.py script delete_pre_017_federated_uploads --no-input
|
||||
# python api/manage.py script delete_pre_017_federated_uploads --no-input
|
||||
|
||||
# Delete the original thumbnails and generate new ones for
|
||||
# higher quality images
|
||||
# https://docs.funkwhale.audio/changelog.html#increased-quality-of-jpeg-thumbnails-manual-action-required
|
||||
ynh_secure_remove "$final_path/media/__sized__"
|
||||
python api/manage.py fw media generate-thumbnails
|
||||
)
|
||||
|
||||
#=================================================
|
||||
|
@ -228,7 +217,7 @@ ynh_store_file_checksum --file="$configfile"
|
|||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading systemd configuration..."
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
|
||||
cp ../conf/funkwhale.target "/etc/systemd/system/$app.target"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/systemd/system/$app.target"
|
||||
|
@ -243,7 +232,7 @@ ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.servic
|
|||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
#=================================================
|
||||
ynh_print_info --message="Reconfiguring fail2ban..."
|
||||
ynh_script_progression --message="Reconfiguring Fail2Ban..."
|
||||
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST>.* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" --max_retry=5
|
||||
|
||||
|
@ -257,10 +246,18 @@ chmod -R 755 "$final_path/code/front/dist/"
|
|||
mkdir -p "/var/log/$app"
|
||||
chown -R "$app": "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add "$app-server" --log="/var/log/$app/server.log"
|
||||
yunohost service add "$app-worker" --log="/var/log/$app/worker.log"
|
||||
yunohost service add "$app-beat" --log="/var/log/$app/beat.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading SSOwat configuration..."
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ "$is_public" -eq 1 ]
|
||||
|
@ -272,7 +269,7 @@ fi
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --action="start" --service_name="${app}-beat"
|
||||
ynh_systemd_action --action="start" --service_name="${app}-server"
|
||||
|
@ -281,7 +278,7 @@ ynh_systemd_action --action="start" --service_name="${app}-worker"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -295,4 +292,4 @@ ynh_app_setting_set --app="$app" --key=code_migration --value=2
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Upgrade of $app completed"
|
||||
ynh_script_progression --message="Upgrade of $app completed"
|
||||
|
|
|
@ -1,86 +1,74 @@
|
|||
# Bleeding edge Django
|
||||
django>=3.0.5,<3.1; python_version > '3.5'
|
||||
django>=2.2.12,<3; python_version < '3.6'
|
||||
setuptools>=36
|
||||
django~=3.0.8
|
||||
setuptools>=49
|
||||
# Configuration
|
||||
django-environ>=0.4,<0.5
|
||||
django-environ~=0.4
|
||||
|
||||
# Images
|
||||
Pillow>=6.2,<7
|
||||
Pillow~=7.0
|
||||
|
||||
# For user registration, either via email or social
|
||||
# Well-built with regular release cycles!
|
||||
django-allauth>=0.41,<0.42
|
||||
django-allauth~=0.42
|
||||
|
||||
|
||||
# Python-PostgreSQL Database Adapter
|
||||
psycopg2-binary>=2.8,<=2.9
|
||||
psycopg2-binary~=2.8
|
||||
|
||||
# Time zones support
|
||||
pytz==2019.3
|
||||
pytz==2020.1
|
||||
|
||||
# Redis support
|
||||
django-redis>=4.11,<4.12
|
||||
redis>=3.4,<3.5
|
||||
kombu>=4.5,<4.6
|
||||
django-redis~=4.12
|
||||
redis~=3.5
|
||||
kombu~=4.6
|
||||
|
||||
celery>=4.3,<4.4
|
||||
celery~=4.4
|
||||
|
||||
|
||||
# Your custom requirements go here
|
||||
django-cors-headers>=3.2,<3.3
|
||||
musicbrainzngs==0.6
|
||||
djangorestframework>=3.11,<3.12
|
||||
djangorestframework-jwt>=1.11,<1.12
|
||||
arrow>=0.15.5,<0.16
|
||||
persisting-theory>=0.2,<0.3
|
||||
django-versatileimagefield>=2.0,<2.1
|
||||
django-filter>=2.1,<2.2
|
||||
django-rest-auth>=0.9,<0.10
|
||||
# XXX: remove when we drop support for python 3.5
|
||||
ipython>=7.10,<8; python_version > '3.5'
|
||||
ipython>=7,<7.10; python_version < '3.6'
|
||||
mutagen>=1.44,<1.45
|
||||
django-cors-headers~=3.4
|
||||
musicbrainzngs~=0.7.1
|
||||
djangorestframework~=3.11
|
||||
djangorestframework-jwt~=1.11
|
||||
arrow~=0.15.5
|
||||
persisting-theory~=0.2
|
||||
django-versatileimagefield~=2.0
|
||||
django-filter~=2.3
|
||||
django-rest-auth~=0.9
|
||||
ipython~=7.10
|
||||
mutagen~=1.45
|
||||
|
||||
pymemoize==1.0.3
|
||||
pymemoize~=1.0
|
||||
|
||||
django-dynamic-preferences>=1.8.1,<1.9
|
||||
raven>=6.10,<7
|
||||
python-magic==0.4.15
|
||||
channels>=2.4,<2.5
|
||||
# XXX: remove when we drop support for python 3.5
|
||||
channels_redis==2.2.1; python_version < '3.6'
|
||||
channels_redis>=2.3.2,<2.4; python_version > '3.5'
|
||||
uvicorn==0.8.6; python_version < '3.6'
|
||||
uvicorn>=0.11.3,<0.12; python_version > '3.5'
|
||||
gunicorn>=20.0.4,<20.1
|
||||
django-dynamic-preferences~=1.10
|
||||
raven~=6.10
|
||||
python-magic~=0.4
|
||||
channels~=2.4
|
||||
channels_redis~=3.0
|
||||
uvicorn[standard]~=0.12
|
||||
gunicorn~=20.0
|
||||
|
||||
cryptography>=2.8,<3
|
||||
cryptography~=2.9
|
||||
# requests-http-signature==0.0.3
|
||||
# clone until the branch is merged and released upstream
|
||||
git+https://github.com/EliotBerriot/requests-http-signature.git@signature-header-support
|
||||
django-cleanup>=4,<4.1
|
||||
requests>=2.22<2.23
|
||||
pyOpenSSL>=19<20
|
||||
django-cleanup~=5.0
|
||||
requests~=2.24
|
||||
pyOpenSSL~=19.1
|
||||
|
||||
# for LDAP authentication
|
||||
python-ldap>=3.2.0,<3.3
|
||||
django-auth-ldap>=2.1.0,<2.2
|
||||
python-ldap~=3.3
|
||||
django-auth-ldap~=2.2
|
||||
|
||||
pydub>=0.23.1,<0.24
|
||||
pyld==1.0.4
|
||||
aiohttp>=3.6,<3.7
|
||||
autobahn>=19.3.3
|
||||
pydub~=0.24
|
||||
pyld~=1.0
|
||||
aiohttp~=3.6
|
||||
|
||||
django-oauth-toolkit==1.2
|
||||
django-storages>=1.9.1,<1.10
|
||||
boto3<3
|
||||
unicode-slugify==0.1.3
|
||||
django-cacheops==4.2
|
||||
django-oauth-toolkit~=1.3
|
||||
django-storages~=1.9
|
||||
boto3~=1.14
|
||||
unicode-slugify~=0.1
|
||||
django-cacheops~=5.0
|
||||
|
||||
click>=7,<8
|
||||
service_identity==18.1.0
|
||||
markdown>=3.2,<4
|
||||
bleach>=3,<4
|
||||
click~=7.1
|
||||
service_identity~=18.1
|
||||
markdown~=3.2
|
||||
bleach~=3.1
|
||||
feedparser==6.0.0b3
|
||||
watchdog==0.10.2
|
||||
watchdog~=0.10
|
Loading…
Add table
Reference in a new issue