1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/funkwhale_ynh.git synced 2024-09-03 18:36:24 +02:00

Upgrade to 0.18.3

Upgrade to 0.18.3
This commit is contained in:
Jean-Baptiste 2019-06-26 22:43:32 +02:00 committed by GitHub
commit 99bae16efc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 239 additions and 120 deletions

View file

@ -1,12 +1,21 @@
# Funkwhale
A modern, convivial and free music server on YunoHost
[![Integration level](https://dash.yunohost.org/integration/funkwhale.svg)](https://dash.yunohost.org/appci/app/funkwhale)
[![Install Funkwhale with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=funkwhale)
[![Install funkwhale with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=funkwhale)
> *This package allow 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.*
## Overview
A modern, convivial and free music server on YunoHost
Installation requires a dedicated domain for now. I hope subpath installation will be possible in the future.
**Shipped version:** 0.18.2 (this is an Alpha version!)
**Shipped version:** 0.18.3 (this is an Alpha version!)
## Screenshots
![](https://funkwhale.audio/assets/images/home-overlay.jpg)
## Admin
@ -31,6 +40,14 @@ The admin interface is accessible with the address: your.domain.fr/api/admin
* to be added:
* [ ] Store files in HOME, see https://github.com/YunoHost-Apps/funkwhale_ynh/issues/15
## YunoHost specific features
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/funkwhale%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/funkwhale/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/funkwhale%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/funkwhale/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/funkwhale%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/funkwhale/)
## Links
* Report a bug about this package: https://github.com/YunoHost-Apps/funkwhale_ynh
@ -38,3 +55,18 @@ The admin interface is accessible with the address: your.domain.fr/api/admin
* Documentation: https://docs.funkwhale.audio
* Funkwhale website: https://funkwhale.audio/
* YunoHost website: https://yunohost.org/
---
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.
```
sudo yunohost app install https://github.com/YunoHost-Apps/funkwhale_ynh/tree/testing --debug
or
sudo yunohost app upgrade funkwhale -u https://github.com/YunoHost-Apps/funkwhale_ynh/tree/testing --debug
```

View file

@ -16,8 +16,6 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=80a5044d13a6782063fee2d7fb7a01832a6aa767
upgrade=1 from_commit=806bcb0f320d8e3e28711a9ae1d2b175b95c65ce
backup_restore=1
multi_instance=1
incorrect_path=0

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/0.18.2/download?job=build_front
SOURCE_SUM=cec96c574c7de95a94380bde3ab5f26d61b78018821bc012f80ef62caf3b2448
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/0.18.3/download?job=build_front
SOURCE_SUM=2c3306c3d3ee16aa1965ec6ad6c8f7c92af46bb29be84dc114f4eeaec695adfe
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/archive/0.18.2/funkwhale-0.18.2.tar.bz2
SOURCE_SUM=a4ae89e7f92ed4d047849ce36db86690d9114ec48226225e7b6db35c1cc1f936
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/archive/0.18.3/funkwhale-0.18.3.tar.gz
SOURCE_SUM=c94556d31677088b3113bc43cd328ba2055e253bfd20171777007b803e5c6481
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.bz2
SOURCE_IN_SUBDIR=true

View file

@ -2,19 +2,19 @@
"name": "Funkwhale",
"id": "funkwhale",
"packaging_format": 1,
"requirements": {
"yunohost": ">= 3.3.0"
},
"description": {
"en": "A modern, convivial and free music server"
},
"version": "0.18.2~ynh1",
"version": "0.18.3~ynh2",
"url": "https://funkwhale.audio",
"license": "BSD-3-Clause",
"license": "AGPL-3.0-or-later",
"maintainer": {
"name": "Jean-Baptiste Holcroft",
"email": "jean-baptiste@holcroft.fr"
},
"requirements": {
"yunohost": ">= 3.5"
},
"multi_instance": true,
"services": [
"nginx"
@ -25,26 +25,26 @@
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain"
"en": "Choose a domain for funkwhale"
},
"example": "domain.fr"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Should Funkwhale be publicly accessible?"
},
"default": "0"
"example": "example.com"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user for Funkwhale"
"en": "Choose an admin user"
},
"example": "jibec"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?"
},
"default": true
}
]
}
}
}

View file

@ -1,5 +1,20 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="build-essential curl ffmpeg \
libjpeg-dev libmagic-dev libpq-dev postgresql postgresql-contrib python3-dev virtualenv \
redis-server libldap2-dev libsasl2-dev \
`# add arm support` \
zlib1g-dev libffi-dev libssl-dev"
#=================================================
# PERSONAL HELPERS
#=================================================
# funkwhale needs edits to the domain config file
# this function removes funkwhale specifics
funkwhale_nginx_domain_cleaning() {
@ -35,6 +50,10 @@ map \$http_upgrade \$connection_upgrade {
mv "$tempFile" "$nginxConf"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
#
# Redis HELPERS
@ -208,4 +227,4 @@ 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
}
}

View file

@ -6,24 +6,24 @@
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -31,12 +31,12 @@ final_path=$(ynh_app_setting_get "$app" final_path)
domain=$(ynh_app_setting_get "$app" domain)
db_name=$(ynh_app_setting_get "$app" db_name)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_print_info "Backing up the main app directory..."
backup_core_only=$(ynh_app_setting_get "$app" backup_core_only)
# If backup_core_only have any value in the settings.yml file, do not backup the data directory
@ -51,13 +51,15 @@ fi
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.conf"
#=================================================
# BACKUP THE PostgreSQL DATABASE
# BACKUP THE POSTGRESQL DATABASE
#=================================================
ynh_print_info "Backing up the PostgreSQL database..."
ynh_psql_dump_db "$db_name" > db.sql
@ -66,8 +68,15 @@ ynh_psql_dump_db "$db_name" > db.sql
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_print_info "Backing up systemd configuration..."
ynh_backup "/etc/systemd/system/$app-beat.service"
ynh_backup "/etc/systemd/system/$app-server.service"
ynh_backup "/etc/systemd/system/$app-worker.service"
ynh_backup "/etc/systemd/system/$app.target"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -27,27 +30,21 @@ admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info "Validating installation parameters..."
final_path="/var/www/$app"
test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path "$path_url")
test ! "$path_url" != "/" || ynh_die 'The path should be "/" for now...'
# Check web path availability
ynh_webpath_available "$domain" "$path_url"
# Register (book) web path
ynh_webpath_register "$app" "$domain" "$path_url"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info "Storing installation settings..."
ynh_app_setting_set "$app" domain "$domain"
ynh_app_setting_set "$app" path "$path_url"
@ -59,6 +56,7 @@ ynh_app_setting_set "$app" admin "$admin"
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_print_info "Configuring firewall..."
# Find a free port
port=$(ynh_find_port 5000)
@ -68,16 +66,14 @@ ynh_app_setting_set "$app" port "$port"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies..."
ynh_install_app_dependencies build-essential curl ffmpeg \
libjpeg-dev libmagic-dev libpq-dev postgresql postgresql-contrib python3-dev virtualenv \
redis-server libldap2-dev libsasl2-dev \
`# add arm support` \
zlib1g-dev libffi-dev libssl-dev
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A PostgreSQL DATABASE
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_print_info "Creating a PostgreSQL database..."
ynh_psql_test_if_first_run
@ -88,13 +84,12 @@ ynh_app_setting_set "$app" db_name "$db_name"
ynh_app_setting_set "$app" psqlpwd "$db_pwd"
# Initialize database and store postgres password for upgrade
ynh_psql_create_db "$db_name" "$db_user" "$db_pwd"
systemctl reload postgresql
ynh_psql_setup_db --db_name="$db_name" --db_user="$db_user" --db_pwd="$db_pwd"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Setting up source files..."
ynh_app_setting_set "$app" final_path "$final_path"
# Download, check integrity, uncompress and patch the source from app.src
@ -109,6 +104,7 @@ ynh_setup_source "$final_path/code" "app-frontend"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Configuring nginx web server..."
# add funkwhale specifics at the beginning of the domain configuration
funkwhale_nginx_domain_configure
@ -119,6 +115,7 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Configuring system user..."
# Create a system user
ynh_system_user_create "$app" "$final_path"
@ -175,7 +172,7 @@ chmod +x "$loadfile"
ynh_replace_string "__FINALPATH__" "$final_path" "$loadfile"
#=================================================
# MODIFY THE CONFIG FILE
# CONFIGURE ADMIN USER
#=================================================
admin_mail=$(ynh_user_get_info "$admin" "mail")
@ -187,9 +184,9 @@ admin_mail=$(ynh_user_get_info "$admin" "mail")
cd "$final_path/code/"
# needed for enabling the 'unaccent' extension
ynh_psql_execute_as_root "ALTER USER $db_user WITH SUPERUSER;"
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name"
python api/manage.py migrate
ynh_psql_execute_as_root "ALTER USER $db_user WITH NOSUPERUSER;"
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name"
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('$admin', '$admin_mail', 'funkwhale') " | python api/manage.py shell
python api/manage.py collectstatic
)
@ -197,7 +194,7 @@ admin_mail=$(ynh_user_get_info "$admin" "mail")
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info "Configuring a systemd service..."
cp ../conf/funkwhale.target "/etc/systemd/system/$app.target"
ynh_replace_string "__APP__" "$app" "/etc/systemd/system/$app.target"
@ -206,8 +203,6 @@ ynh_add_systemd_config "$app-server" "funkwhale-server.service"
ynh_add_systemd_config "$app-worker" "funkwhale-worker.service"
ynh_add_systemd_config "$app-beat" "funkwhale-beat.service"
systemctl restart "$app".target
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -226,7 +221,6 @@ chown -R "$app": "/var/log/$app"
ynh_add_fail2ban_config "/var/log/nginx/$domain-access.log" "<HOST>.* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" 5
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
@ -238,6 +232,7 @@ yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Configuring SSOwat..."
# Make app public if necessary
if [ "$is_public" -eq 1 ]
@ -249,6 +244,21 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
systemctl start "$app-server" "$app-worker" "$app-beat"
systemctl reload nginx
#=================================================
# START SERVICES
#=================================================
ynh_print_info "Start Services..."
ynh_systemd_action --action=start --service_name=${app}-beat --log_path=systemd --line_match="celery beat process"
ynh_systemd_action --action=start --service_name=${app}-server --log_path=systemd --line_match="Listening on TCP address"
ynh_systemd_action --action=start --service_name=${app}-worker --log_path=systemd --line_match="celery worker"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Installation of $app completed"

View file

@ -12,14 +12,15 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
port=$(ynh_app_setting_get $app port)
db_name=$(ynh_app_setting_get $app db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get $app final_path)
port=$(ynh_app_setting_get $app port)
redis_db=$(ynh_app_setting_get $app redis_db)
#=================================================
@ -29,19 +30,19 @@ redis_db=$(ynh_app_setting_get $app redis_db)
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status | grep -q "$app-server"
if yunohost service status "$app-server" >/dev/null 2>&1
then
echo "Remove $app-server service"
yunohost service remove "$app-server"
fi
if yunohost service status | grep -q "$app-worker"
if yunohost service status "$app-worker" >/dev/null 2>&1
then
echo "Remove $app-worker service"
yunohost service remove "$app-worker"
fi
if yunohost service status | grep -q "$app-beat"
if yunohost service status "$app-beat" >/dev/null 2>&1
then
echo "Remove $app-beat service"
yunohost service remove "$app-beat"
@ -50,8 +51,11 @@ fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info "Stopping and removing the systemd service"
systemctl stop "$app".target
ynh_systemd_action --action=stop --service_name=${app}-beat --log_path=systemd --line_match="Stopped Funkwhale"
ynh_systemd_action --action=stop --service_name=${app}-server --log_path=systemd --line_match="Stopped Funkwhale"
ynh_systemd_action --action=stop --service_name=${app}-worker --log_path=systemd --line_match="Stopped Funkwhale"
# Remove the dedicated systemd config
ynh_remove_systemd_config "$app-server"
@ -61,15 +65,20 @@ ynh_remove_systemd_config "$app-beat"
ynh_secure_remove "/etc/systemd/system/$app.target"
#=================================================
# REMOVE THE PostgreSQL DATABASE
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_print_info "Removing the PostgreSQL database"
ynh_psql_execute_as_root "\connect $db_name
SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_name';"
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db "$db_name" "$app"
ynh_psql_remove_db --db_name="$db_name" --db_user="$app"
#=================================================
# REMOVE THE Redis DATABASE
# REMOVE THE REDIS DATABASE
#=================================================
ynh_print_info "Removing the Redis database"
# Remove a database if it exists, along with the associated user
ynh_redis_remove_db "$redis_db"
@ -77,6 +86,7 @@ ynh_redis_remove_db "$redis_db"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies"
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -84,6 +94,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info "Removing app main directory"
# Remove the app directory securely
ynh_secure_remove "$final_path"
@ -93,6 +104,7 @@ ynh_secure_remove "/var/log/$app"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info "Removing nginx web server configuration"
# remove domain specific configuration
funkwhale_nginx_domain_cleaning
@ -106,8 +118,8 @@ ynh_remove_nginx_config
if yunohost firewall list | grep -q "\- $port$"
then
echo "Close port $port"
yunohost firewall disallow TCP $port 2>&1
ynh_print_info "Closing port $port"
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
@ -121,6 +133,13 @@ ynh_remove_fail2ban_config
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing the dedicated system user"
# Delete a system user
ynh_system_user_delete "$app"
ynh_system_user_delete "$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Removal of $app completed"

View file

@ -6,24 +6,24 @@
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading settings..."
app=$YNH_APP_INSTANCE_NAME
@ -34,10 +34,10 @@ db_name=$(ynh_app_setting_get "$app" db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info "Validating restoration parameters..."
ynh_webpath_available "$domain" "$path_url" \
|| ynh_die "Path not available: ${domain}${path_url}"
@ -56,6 +56,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info "Restoring the app main directory..."
backup_core_only=$(ynh_app_setting_get "$app" backup_core_only)
@ -85,30 +86,11 @@ fi
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info "Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create "$app"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_install_app_dependencies build-essential curl ffmpeg \
libjpeg-dev libmagic-dev libpq-dev postgresql postgresql-contrib python3-dev virtualenv \
redis-server libldap2-dev libsasl2-dev \
`# add arm support` \
zlib1g-dev libffi-dev libssl-dev
#=================================================
# RESTORE THE PostgreSQL DATABASE
#=================================================
ynh_psql_test_if_first_run
ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd"
ynh_psql_execute_file_as_root ./db.sql "$db_name"
#=================================================
# RESTORE USER RIGHTS
#=================================================
@ -120,9 +102,29 @@ chmod -R 755 "$final_path/code/front/dist/"
mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_print_info "Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_print_info "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"
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_print_info "Restoring the systemd configuration..."
ynh_restore_file "/etc/systemd/system/$app-beat.service"
ynh_restore_file "/etc/systemd/system/$app-server.service"
@ -132,7 +134,6 @@ ynh_restore_file "/etc/systemd/system/$app.target"
systemctl enable "$app-beat.service"
systemctl enable "$app-server.service"
systemctl enable "$app-worker.service"
systemctl restart "$app.target"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
@ -145,7 +146,23 @@ yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
#=================================================
# START SERVICES
#=================================================
ynh_print_info "Start Services..."
ynh_systemd_action --action=start --service_name=${app}-beat --log_path=systemd --line_match="celery beat process"
ynh_systemd_action --action=start --service_name=${app}-server --log_path=systemd --line_match="Listening on TCP address"
ynh_systemd_action --action=start --service_name=${app}-worker --log_path=systemd --line_match="celery worker"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Restoration completed for $app"

View file

@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -29,6 +30,7 @@ code_migration=$(ynh_app_setting_get "$app" code_migration)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info "Ensuring downward compatibility..."
# If redis_db doesn't exist, create it
if [ -z "$redis_db" ]; then
@ -53,6 +55,7 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info "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" backup_core_only 1
@ -61,6 +64,7 @@ ynh_app_setting_set "$app" backup_core_only 1
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_clean_check_starting
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -69,10 +73,11 @@ ynh_abort_if_errors
#=================================================
# STOP SERVICES
#=================================================
ynh_print_info "Stopping $app services..."
systemctl stop "$app-beat.service"
systemctl stop "$app-server.service"
systemctl stop "$app-worker.service"
ynh_systemd_action --action=stop --service_name=${app}-beat --log_path=systemd --line_match="Stopped Funkwhale"
ynh_systemd_action --action=stop --service_name=${app}-server --log_path=systemd --line_match="Stopped Funkwhale"
ynh_systemd_action --action=stop --service_name=${app}-worker --log_path=systemd --line_match="Stopped Funkwhale"
#=================================================
# CHECK THE PATH
@ -96,6 +101,7 @@ fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Upgrading source files..."
ynh_app_setting_set "$app" final_path "$final_path"
# Download, check integrity, uncompress and patch the source from app.src
@ -110,6 +116,7 @@ ynh_setup_source "$final_path/code" "app-frontend"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Upgrading nginx web server configuration..."
# remove domain specific configuration
funkwhale_nginx_domain_cleaning
@ -120,23 +127,21 @@ funkwhale_nginx_domain_configure
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_print_info "Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Making sure dedicated system user exists..."
# Create a system user
# Create a dedicated user (if not existing)
ynh_system_user_create "$app"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_install_app_dependencies build-essential curl ffmpeg \
libjpeg-dev libmagic-dev libpq-dev postgresql postgresql-contrib python3-dev virtualenv \
redis-server libldap2-dev libsasl2-dev \
`# add arm support` \
zlib1g-dev libffi-dev libssl-dev
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -202,9 +207,9 @@ ynh_replace_string "__FINALPATH__" "$final_path" "$loadfile"
cd "$final_path/code"
# needed for enabling the 'unaccent' extension
ynh_psql_execute_as_root "ALTER USER $db_user WITH SUPERUSER;"
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name"
python api/manage.py migrate
ynh_psql_execute_as_root "ALTER USER $db_user WITH NOSUPERUSER;"
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name"
python api/manage.py collectstatic --clear --noinput
@ -224,6 +229,7 @@ ynh_replace_string "__FINALPATH__" "$final_path" "$loadfile"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info "Upgrading systemd configuration..."
cp ../conf/funkwhale.target "/etc/systemd/system/$app.target"
ynh_replace_string "__APP__" "$app" "/etc/systemd/system/$app.target"
@ -233,8 +239,6 @@ ynh_add_systemd_config "$app-server" "funkwhale-server.service"
ynh_add_systemd_config "$app-worker" "funkwhale-worker.service"
ynh_add_systemd_config "$app-beat" "funkwhale-beat.service"
systemctl restart "$app".target
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -256,6 +260,7 @@ ynh_add_fail2ban_config "/var/log/nginx/$domain-access.log" "<HOST>.* \"POST /ap
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Upgrading SSOwat configuration..."
# Make app public if necessary
if [ "$is_public" -eq 1 ]
@ -267,6 +272,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
@ -277,7 +283,16 @@ systemctl reload nginx
ynh_app_setting_set "$app" code_migration 2
#=================================================
# RESTART Funkwhale
# START SERVICES
#=================================================
ynh_print_info "Start Services..."
ynh_systemd_action --action=start --service_name=${app}-beat --log_path=systemd --line_match="celery beat process"
ynh_systemd_action --action=start --service_name=${app}-server --log_path=systemd --line_match="Listening on TCP address"
ynh_systemd_action --action=start --service_name=${app}-worker --log_path=systemd --line_match="celery worker"
#=================================================
# END OF SCRIPT
#=================================================
systemctl restart "$app.target"
ynh_print_info "Upgrade of $app completed"