1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ampache_ynh.git synced 2024-09-03 18:15:55 +02:00

Merge pull request #83 from YunoHost-Apps/5.0.0

Upgrade package
This commit is contained in:
Éric Gaspar 2022-05-19 07:07:04 +02:00 committed by GitHub
commit 7904921b57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 687 additions and 507 deletions

View file

@ -1,51 +1,38 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Ampache for YunoHost
[![Integration level](https://dash.yunohost.org/integration/ampache.svg)](https://dash.yunohost.org/appci/app/ampache) ![](https://ci-apps.yunohost.org/ci/badges/ampache.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ampache.maintain.svg)
[![Install Ampache with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ampache)
> *This package allow you to install Ampache 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.*
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Ampache quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
[Ampache](http://ampache.org) for the love of music. A web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device.
**Shipped version:** 4.4.2
## Screenshots
![](http://ampache.org/img/previews/visualizer.jpg)
## Demo
* [YunoHost demo](https://demo.yunohost.org/ampache/)
* [Official demo](http://ampache.org/demo.html)
## Configuration
## Documentation
* Official documentation: https://github.com/ampache/ampache/wiki
* YunoHost documentation: https://yunohost.org/en/app_ampache
## YunoHost specific features
In addition to Ampache core features, the following are made available with
this package:
###features
* Config for high quality streaming with high bandwith
* Quick loading for mobile devices with potential low bandwith
* Integrate with YunoHost users - same username and password
* Allow one user to be the administrator (set at the installation)
#### Multi-users support
**Shipped version:** 5.3.3~ynh1
* Ampache is connect to Yunohost LDAP
* No auto SSO yet
**Demo:** https://ampache.org/demo.html
#### Supported architectures
## Screenshots
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/ampache.svg)](https://ci-apps.yunohost.org/ci/apps/ampache/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/ampache.svg)](https://ci-apps-arm.yunohost.org/ci/apps/ampache/)
![](./doc/screenshots/visualizer.png)
## Disclaimers / important information
## Limitations
@ -78,18 +65,17 @@ this package:
* Full list of existings clients : https://github.com/ampache/ampache/wiki/Clients
## Links
## Documentation and resources
* Report a bug: https://github.com/YunoHost-Apps/ampache_ynh/issues
* Ampache website: http://ampache.org/
* Ampache repository: https://github.com/ampache/ampache
* YunoHost website: https://yunohost.org/
* Official app website: http://ampache.org
* Official admin documentation: https://github.com/ampache/ampache/wiki
* Upstream app code repository: https://github.com/ampache/ampache
* YunoHost documentation for this app: https://yunohost.org/app_ampache
* Report a bug: https://github.com/YunoHost-Apps/ampache_ynh/issues
---
## Developer info
## Developers infos
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/ampache_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/ampache_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
@ -97,3 +83,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/ampache_ynh/tree/test
or
sudo yunohost app upgrade ampache -u https://github.com/YunoHost-Apps/ampache_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

83
README_fr.md Normal file
View file

@ -0,0 +1,83 @@
# Ampache pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/ampache.svg)](https://dash.yunohost.org/appci/app/ampache) ![](https://ci-apps.yunohost.org/ci/badges/ampache.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ampache.maintain.svg)
[![Installer Ampache avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ampache)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Ampache rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
[Ampache](http://ampache.org) for the love of music. A web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device.
###features
* Config for high quality streaming with high bandwith
* Quick loading for mobile devices with potential low bandwith
* Integrate with YunoHost users - same username and password
* Allow one user to be the administrator (set at the installation)
**Version incluse :** 5.3.3~ynh1
**Démo :** https://ampache.org/demo.html
## Captures d'écran
![](./doc/screenshots/visualizer.png)
## Avertissements / informations importantes
## Limitations
* Also, the SSO authentication not fully working from user panel, we have to work about this. In fact, it can disrupt external Ampache clients like Subsonic.
## Additionnal informations
### Getting started
* **Add your first catalog to load music files**
* Go to *Admin panel* ![](https://raw.githubusercontent.com/ampache/ampache/develop/themes/reborn/images/icons/icon_admin.png)
* Click on *Add a Catalog*
* Fill up fields and click *Add Calalog*
* Next, enjoy :)
* **Update a catalog for load new music files**
* Go to *Admin panel* ![](https://raw.githubusercontent.com/ampache/ampache/develop/themes/reborn/images/icons/icon_admin.png)
* Click on *Show Catalogs*
* Select *Update* in *Actions* list and click *Go*
* **Change interface Language**
* Go to *Preferences panel* ![](https://raw.githubusercontent.com/ampache/ampache/develop/themes/reborn/images/icons/icon_edit.png)
* Click on *Interface*
* Change *Language* field
### Ampache on mobile devices
* [For Android](https://play.google.com/store/apps/details?id=com.antoniotari.reactiveampacheapp)
* [For iOS](http://iampache.com/)
* Full list of existings clients : https://github.com/ampache/ampache/wiki/Clients
## Documentations et ressources
* Site officiel de l'app : http://ampache.org
* Documentation officielle de l'admin : https://github.com/ampache/ampache/wiki
* Dépôt de code officiel de l'app : https://github.com/ampache/ampache
* Documentation YunoHost pour cette app : https://yunohost.org/app_ampache
* Signaler un bug : https://github.com/YunoHost-Apps/ampache_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/ampache_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/ampache_ynh/tree/testing --debug
ou
sudo yunohost app upgrade ampache -u https://github.com/YunoHost-Apps/ampache_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,9 +1,9 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/ampache" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
path="/ampache"
admin="john"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
SOURCE_URL=https://github.com/ampache/ampache/archive/4.4.2.tar.gz
SOURCE_SUM=fadf5c9f9b6d59904979f3e109b7935c48fc2b8c04640a0503723cf31674bc99
SOURCE_URL=https://github.com/ampache/ampache/releases/download/5.3.3/ampache-5.3.3_all_php8.0.zip
SOURCE_SUM=c2cc99ba7d59e5fadf264cdf40f37af66393d93ec176f5151bf32799599e72fd
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -2,12 +2,7 @@
location __PATH__/ {
# Path to source
alias __FINALPATH__/;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
alias __FINALPATH__/public/;
rewrite ^__PATH__/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/player/(.*)/name/(.*)$ __PATH__/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&player=$7&name=$8 last;
rewrite ^__PATH__/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/bitrate/([0-9]+)/player/(.*)/name/(.*)$ __PATH__/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&bitrate=$7player=$8&name=$9 last;

BIN
doc/.DS_Store vendored Normal file

Binary file not shown.

8
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,8 @@
[Ampache](http://ampache.org) for the love of music. A web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device.
###features
* Config for high quality streaming with high bandwith
* Quick loading for mobile devices with potential low bandwith
* Integrate with YunoHost users - same username and password
* Allow one user to be the administrator (set at the installation)

30
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,30 @@
## Limitations
* Also, the SSO authentication not fully working from user panel, we have to work about this. In fact, it can disrupt external Ampache clients like Subsonic.
## Additionnal informations
### Getting started
* **Add your first catalog to load music files**
* Go to *Admin panel* ![](https://raw.githubusercontent.com/ampache/ampache/develop/themes/reborn/images/icons/icon_admin.png)
* Click on *Add a Catalog*
* Fill up fields and click *Add Calalog*
* Next, enjoy :)
* **Update a catalog for load new music files**
* Go to *Admin panel* ![](https://raw.githubusercontent.com/ampache/ampache/develop/themes/reborn/images/icons/icon_admin.png)
* Click on *Show Catalogs*
* Select *Update* in *Actions* list and click *Go*
* **Change interface Language**
* Go to *Preferences panel* ![](https://raw.githubusercontent.com/ampache/ampache/develop/themes/reborn/images/icons/icon_edit.png)
* Click on *Interface*
* Change *Language* field
### Ampache on mobile devices
* [For Android](https://play.google.com/store/apps/details?id=com.antoniotari.reactiveampacheapp)
* [For iOS](http://iampache.com/)
* Full list of existings clients : https://github.com/ampache/ampache/wiki/Clients

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -6,28 +6,34 @@
"en": "Web based audio/video streaming application",
"fr": "Application de streaming audio et vidéo"
},
"version": "4.4.2~ynh1",
"version": "5.3.3~ynh1",
"url": "http://ampache.org",
"upstream": {
"license": "AGPL-3.0",
"website": "http://ampache.org",
"demo": "https://ampache.org/demo.html",
"admindoc": "https://github.com/ampache/ampache/wiki",
"code": "https://github.com/ampache/ampache"
},
"license": "AGPL-3.0",
"maintainer": {
"name": "aymhce",
"email": "aymhce@gmail.com"
},
"requirements": {
"yunohost": ">= 4.1.7"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services" : [
"nginx",
"php7.3-fpm",
"php8.0-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"example": "domain.org"
"type": "domain"
},
{
"name": "path",
@ -37,8 +43,7 @@
},
{
"name": "admin",
"type": "user",
"example": "homer"
"type": "user"
},
{
"name": "is_public",

View file

@ -4,102 +4,18 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="libav-tools|ffmpeg"
YNH_PHP_VERSION="8.0"
YNH_PHP_VERSION="7.3"
# Composer version
YNH_COMPOSER_VERSION="2.3.5"
extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-simplexml php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-ldap"
pkg_dependencies="libav-tools|ffmpeg php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-simplexml php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-ldap"
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
# Declare the actual composer version to use.
# A packager willing to use another version of composer can override the variable into its _common.sh.
YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
# Execute a command with Composer
#
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
# Declare an array to define the options of this helper.
local legacy_args=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
# | arg: -c, --composerversion - Composer version to install
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vwa
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
local phpversion
local workdir
local install_args
local composerversion
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer."
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# Install or update the main directory yunohost.multimedia
#
# usage: ynh_multimedia_build_main_dir
ynh_multimedia_build_main_dir () {
local ynh_media_release="v1.2"
local checksum="806a827ba1902d6911095602a9221181"
# Download yunohost.multimedia scripts
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1
# Check the control sum
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|| ynh_die "Corrupt source"
# Check if the package acl is installed. Or install it.
ynh_package_is_installed 'acl' \
|| ynh_package_install acl
# Extract
mkdir yunohost.multimedia-master
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
./yunohost.multimedia-master/script/ynh_media_build.sh
}

View file

@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -49,7 +50,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE

View file

@ -22,8 +22,10 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin_ampache=$YNH_APP_ARG_ADMIN
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
phpversion=$YNH_PHP_VERSION
secret_key=$(ynh_string_random --length=24)
app=$YNH_APP_INSTANCE_NAME
@ -45,7 +47,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin_ampache
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
#=================================================
# STANDARD MODIFICATIONS
@ -59,7 +62,7 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..."
ynh_script_progression --message="Creating a MySQL database..." --weight=1
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
@ -69,10 +72,10 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -83,49 +86,54 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=low --footprint=low
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
#=================================================
# SPECIFIC SETUP
#=================================================
# CONFIGURE AMPACHE
#=================================================
ynh_script_progression --message="Preconfiguring Ampache..." --weight=2
secret_key=$(ynh_string_random --length=24)
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
ynh_script_progression --message="Preconfiguring $app..." --weight=2
ynh_add_config --template="../conf/ampache.cfg.php" --destination="$final_path/config/ampache.cfg.php"
chmod 600 "$final_path/config/ampache.cfg.php"
chown $app: "$final_path/config/ampache.cfg.php"
#=================================================
# LOAD DEFAULT DATABASE
#=================================================
ynh_script_progression --message="Loading default database..."
ynh_script_progression --message="Loading default database..." --weight=2
# Load default ampache database
ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$app < "$final_path/sql/ampache.sql"
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name < "$final_path/resources/sql/ampache.sql"
#=================================================
# INSTALL AMPACHE WITH COMPOSER
#=================================================
ynh_script_progression --message="Installing ampache with Composer..." --weight=45
ynh_script_progression --message="Installing $app with Composer..." --weight=45
# Install composer
ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --install_args="--prefer-source --no-dev"
ynh_install_composer --install_args="--ignore-platform-req=ext-intl"
#=================================================
# INSTALL MULTIMEDIA DIRECTORIES
@ -137,7 +145,7 @@ ynh_multimedia_build_main_dir
#=================================================
# PRE CONFIGURE AMPACHE
#=================================================
ynh_script_progression --message="Configuring Ampache..." --weight=5
ynh_script_progression --message="Configuring $app..." --weight=5
# Set the app as temporarily public for curl call
ynh_permission_update --permission="main" --add="visitors"
@ -151,30 +159,19 @@ sleep 1
#=================================================
# LOAD ADMIN DATABASE
#=================================================
ynh_script_progression --message="Loading admin database..."
ynh_script_progression --message="Loading admin database..." --weight=2
cp ../conf/admin.sql /tmp/
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin_ampache" --target_file=/tmp/admin.sql
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file=/tmp/admin.sql
ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$app < /tmp/admin.sql
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name < /tmp/admin.sql
ynh_secure_remove --file=/tmp/admin.sql
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to ampache directory
chown -R $app:$app $final_path
chmod 600 $final_path/config/ampache.cfg.php
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
ynh_script_progression --message="Configuring permissions..." --weight=1
if [ $is_public -eq 0 ]
then
@ -184,7 +181,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -52,7 +52,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
@ -60,7 +60,7 @@ ynh_remove_nginx_config
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated php-fpm config
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================

View file

@ -28,16 +28,14 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
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}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@ -48,42 +46,25 @@ ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE USER RIGHTS
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring user rights..."
ynh_script_progression --message="Restoring the app main directory..." --weight=3
# Restore permissions on app files
chown -R $app:$app $final_path
chmod 600 $final_path/config/ampache.cfg.php
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..."
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
ynh_restore_file --origin_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
@ -92,6 +73,13 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=30
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
@ -108,7 +96,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -25,14 +25,28 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
phpversion=$YNH_PHP_VERSION
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=20
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -64,27 +78,13 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=20
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -98,6 +98,10 @@ then
ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -119,7 +123,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=low --footprint=low
#=================================================
# SPECIFIC UPGRADE
@ -132,6 +136,8 @@ then
ynh_script_progression --message="Upgrading Ampache configuration..."
ynh_add_config --template="../conf/ampache.cfg.php" --destination="$final_path/config/ampache.cfg.php"
chmod 600 "$final_path/config/ampache.cfg.php"
chown $app:$app "$final_path/config/ampache.cfg.php"
#=================================================
# UPDATE AMPACHE WITH COMPOSER
@ -139,7 +145,7 @@ then
ynh_script_progression --message="Upgrading ampache with Composer..." --weight=30
# Install composer
ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --install_args="--prefer-source --no-dev"
ynh_install_composer --install_args="--ignore-platform-req=ext-intl"
ynh_composer_exec --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --commands="config discard-changes true"
fi
@ -171,17 +177,6 @@ then
sleep 1
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R $app:$app $final_path
chmod 600 $final_path/config/ampache.cfg.php
#=================================================
# SETUP SSOWAT
#=================================================