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 #86 from YunoHost-Apps/testing

This commit is contained in:
Éric Gaspar 2022-05-23 20:45:03 +02:00 committed by GitHub
commit 3210d5803f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 757 additions and 523 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

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.4.0~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.4.0~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.4.0/ampache-5.4.0_all_php8.0.zip
SOURCE_SUM=d37f9130d2d39d8f936c7ccb2e96711e9e1da53b55d53792f017e5ee5aa12bd1
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.4.0~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

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

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,9 @@ 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
secret_key=$(ynh_string_random --length=24)
app=$YNH_APP_INSTANCE_NAME
@ -45,7 +46,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 +61,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 +71,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 +85,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
phpversion=$(ynh_app_setting_get --app=$app --key=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 +144,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 +158,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 +180,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
#=================================================