1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/facette_ynh.git synced 2024-09-03 18:36:02 +02:00
This commit is contained in:
ericgaspar 2020-11-06 10:49:55 +01:00
parent bef9ef08fc
commit e01c1b5a99
No known key found for this signature in database
GPG key ID: 574F281483054D44
8 changed files with 255 additions and 184 deletions

View file

@ -1,18 +1,71 @@
# Facette app for YunoHost
This app work only on x64 for the moment
- [Yunohost project](https://yunohost.org)
- [Facette app website](https://facette.io/)
# Facette for YunoHost
[![Integration level](https://dash.yunohost.org/integration/facette.svg)](https://dash.yunohost.org/appci/app/facette) ![](https://ci-apps.yunohost.org/ci/badges/facette.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facette.maintain.svg)
[![Install Facette with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=facette)
![](https://camo.githubusercontent.com/61b8691be6738cbb8f74636fdfdadea50a4a9741/68747470733a2f2f666163657474652e696f2f6173736574732f696d616765732f7373686f742d76696577312e706e67)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Facette 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
Navidrome is an open source web-based music collection server and streamer. It gives you freedom to listen to your music collection from any browser or mobile device.
**Shipped version:** 0.37.0
**Upgrade this package:**
`sudo yunohost app upgrade --verbose example -u https://github.com/YunoHost-Apps/facette_ynh`
## Screenshots
![](https://facette.io/assets/images/sshot-view1.png)
## Demo
* [Official demo](https://demo.navidrome.org/app/#/login)
## Configuration
#### Where are stored your music files
Your music files are stored by default in your shared [multimedia folder](https://github.com/YunoHost-Apps/yunohost.multimedia) `/home/yunohost.multimedia/share/Music`. This folder is accessible from Nextcloud with *External Storages* enabled. This will allow you to easily upload your music files to the server.
You can configure an alternative path to you music files by editing the path `MusicFolder = "/home/yunohost.multimedia/share/Music"` in this file `/var/lib/navidrome/navidrome.toml` using the [documentation](https://www.navidrome.org/docs/usage/configuration-options/).
#### Client player
You must activate *public site* if you want to connect a client player to Navidrome.
## Documentation
* Official documentation: https://www.navidrome.org/docs/
* YunoHost documentation: https://yunohost.org/#/app_facette
## YunoHost specific features
#### Multi-user support
* Is LDAP supported? **No**
* Can the app be used by multiple users? **Yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/facette%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/facette/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/facette%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/facette/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/facette_ynh/issues
* App website: https://facette.io/
* Upstream app repository: https://github.com/facette/facette
* YunoHost website: https://yunohost.org/
---
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/facette_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/facette_ynh/tree/testing --debug
or
sudo yunohost app upgrade facette -u https://github.com/YunoHost-Apps/facette_ynh/tree/testing --debug
```

View file

@ -21,18 +21,8 @@
port_already_use=1
change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4:
Level 4=0
# Level 5:
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options
Email=
Notification=none

View file

@ -1,5 +1,5 @@
SOURCE_URL=url of app's source
SOURCE_SUM=sha256 checksum
SOURCE_URL=https://github.com/facette/facette/releases/download/0.5.1/facette_0.5.1_linux_amd64.tar.gz
SOURCE_SUM=152d8889da545733f25ea197208f1edd7c07cfee063b44b3ac55b61d61d361e4
SOURCE_SUM_PRG=sha256
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

80
conf/facette.yaml Normal file
View file

@ -0,0 +1,80 @@
---
logger:
### File
file:
# Logging level (error, warning, notice, info or debug)
level: info
# Log file path (uses stdout if left empty or set to "-")
path:
### Syslog
#syslog:
# # Logging level (error, warning, notice, info or debug)
# level: info
# # Syslog facility name
# facility: daemon
# # Syslog tag
# tag: facette
# # Syslog address (defaults to local Syslog if left empty)
# address:
# # Network transport for Syslog instance (used if address is specified)
# transport: udp
http:
listen: localhost:12003
# or
#listen: unix:/var/run/facette.sock?mode=0644&user=facette&group=facette
# Timeout before forcefully shutdown remaining connections (in seconds)
#graceful_timeout: 30
# Root path behind which the service is located
#base_path: /
# Allow/Prevent modifications through API calls
read_only: false
# Enable and serve UI assets
enable_ui: true
# Expose/Hide version and build information via/from the API
expose_version: true
storage:
# Enable SQL storage debugging
debug: false
### SQLite
driver: sqlite
path: var/data.db
### PostgreSQL
#driver: pgsql
#host: localhost
#port: 5432
#dbname: facette
#user: facette
#password: ********
### MySQL
#driver: mysql
#host: localhost
#port: 3306
#dbname: facette
#user: facette
#password: ********
cache:
# Cache directory path
path: var/cache
defaults:
# Default time range
time_range: -1h
# vim: ts=2 sw=2 et

View file

@ -1,12 +1,23 @@
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:12003;
}
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Include SSOWAT user panel.
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -3,24 +3,23 @@
"id": "facette",
"packaging_format": 1,
"description": {
"en": "Facette package for YunoHost.",
"fr": "Facette pour YunoHost."
"en": "Time series data visualization software.",
"fr": "Logiciel de visualisation de données de séries chronologiques."
},
"version": "0.5.1~ynh1",
"url": "https://example.com",
"license": "free",
"version": "1.0",
"license": "BSD-3-Clause",
"maintainer": {
"name": "rafi59",
"email": "jrafi59_dev@srvmaison.fr.nf",
"url": "http://example.com"
"email": "jrafi59_dev@srvmaison.fr.nf"
},
"requirements": {
"yunohost": ">= 2.7.2"
"yunohost": ">= 4.0.0"
},
"multi_instance": false,
"services": [
"nginx",
"php5-fpm",
"php7.0-fpm",
"mysql"
],
"arguments": {
@ -29,8 +28,8 @@
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for ynhexample",
"fr": "Choisissez un nom de domaine pour ynhexample"
"en": "Choose a domain name for Facette",
"fr": "Choisissez un nom de domaine pour Facette"
},
"example": "example.com"
},
@ -53,7 +52,6 @@
},
"default": true
}
]
}
}

View file

@ -1,112 +1,47 @@
#!/bin/bash
# =============================================================================
# YUNOHOST 2.7 FORTHCOMING HELPERS
# =============================================================================
#=================================================
# COMMON VARIABLES
#=================================================
# Create a dedicated nginx config
# dependencies used by the app
pkg_dependencies="rrdtool rrdcached collectd"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# Check the architecture
#
# usage: ynh_add_nginx_config
ynh_add_nginx_config () {
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalnginxconf"
sudo cp ../conf/nginx.conf "$finalnginxconf"
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
# Substitute in a nginx config file only if the variable is not empty
if test -n "${path_url:-}"; then
ynh_replace_string "__PATH__" "$path_url" "$finalnginxconf"
fi
if test -n "${domain:-}"; then
ynh_replace_string "__DOMAIN__" "$domain" "$finalnginxconf"
fi
if test -n "${port:-}"; then
ynh_replace_string "__PORT__" "$port" "$finalnginxconf"
fi
if test -n "${app:-}"; then
ynh_replace_string "__NAME__" "$app" "$finalnginxconf"
fi
if test -n "${final_path:-}"; then
ynh_replace_string "__FINALPATH__" "$final_path" "$finalnginxconf"
fi
ynh_store_file_checksum "$finalnginxconf"
sudo systemctl reload nginx
}
# Remove the dedicated nginx config
# example: architecture=$(ynh_detect_arch)
#
# usage: ynh_remove_nginx_config
ynh_remove_nginx_config () {
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
sudo systemctl reload nginx
}
# Create a dedicated php-fpm config
# usage: ynh_detect_arch
#
# usage: ynh_add_fpm_config
ynh_add_fpm_config () {
finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalphpconf"
sudo cp ../conf/php-fpm.conf "$finalphpconf"
ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf"
ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf"
ynh_replace_string "__USER__" "$app" "$finalphpconf"
sudo chown root: "$finalphpconf"
ynh_store_file_checksum "$finalphpconf"
if [ -e "../conf/php-fpm.ini" ]
then
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
ynh_backup_if_checksum_is_different "$finalphpini"
sudo cp ../conf/php-fpm.ini "$finalphpini"
sudo chown root: "$finalphpini"
ynh_store_file_checksum "$finalphpini"
fi
sudo systemctl reload php5-fpm
}
# Remove the dedicated php-fpm config
#
# usage: ynh_remove_fpm_config
ynh_remove_fpm_config () {
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1
sudo systemctl reload php5-fpm
}
# Create a dedicated systemd config
#
# usage: ynh_add_systemd_config
ynh_add_systemd_config () {
finalsystemdconf="/etc/systemd/system/$app.service"
ynh_backup_if_checksum_is_different "$finalsystemdconf"
sudo cp ../conf/systemd.service "$finalsystemdconf"
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
# Substitute in a nginx config file only if the variable is not empty
if test -n "${final_path:-}"; then
ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf"
fi
if test -n "${app:-}"; then
ynh_replace_string "__APP__" "$app" "$finalsystemdconf"
fi
ynh_store_file_checksum "$finalsystemdconf"
sudo chown root: "$finalsystemdconf"
sudo systemctl enable $app
sudo systemctl daemon-reload
}
# Remove the dedicated systemd config
#
# usage: ynh_remove_systemd_config
ynh_remove_systemd_config () {
finalsystemdconf="/etc/systemd/system/$app.service"
if [ -e "$finalsystemdconf" ]; then
sudo systemctl stop $app
sudo systemctl disable $app
ynh_secure_remove "$finalsystemdconf"
fi
# Requires YunoHost version 2.2.4 or higher.
ynh_detect_arch(){
local architecture
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
architecture="arm64"
elif [ -n "$(uname -m | grep 86)" ]; then
architecture="i386"
elif [ -n "$(uname -m | grep 64)" ]; then
architecture="x86-64"
elif [ -n "$(uname -m | grep armv7)" ]; then
architecture="armv7"
elif [ -n "$(uname -m | grep armv6)" ]; then
architecture="armv6"
elif [ -n "$(uname -m | grep armv5)" ]; then
architecture="armv5"
else
architecture="unknown"
fi
echo $architecture
}

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
@ -24,57 +23,56 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
# This is a multi-instance app, meaning it can be installed several times independently
# The id of the app as stated in the manifest is available as $YNH_APP_ID
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
# The app instance name is available as $YNH_APP_INSTANCE_NAME
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
# The app instance name is probably what you are interested the most, since this is
# guaranteed to be unique. This is a good unique identifier to define installation path,
# db names, ...
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app is_public $is_public
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=is_public --value=$is_public
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=0
# Find an available port
port=$(ynh_find_port --port=12003)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=9
ynh_install_app_dependencies rrdtool rrdcached collectd
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
wget https://github.com/facette/facette/releases/download/0.4.0rc2/facette_0.4.0rc2_jessie-amd64.deb
dpkg -i facette_0.4.0rc2_jessie-amd64.deb
ynh_setup_source --dest_dir=$final_path
#=================================================
# NGINX CONFIGURATION
@ -120,21 +118,27 @@ yunohost service add NAME_INIT.D --log "/var/log/FILE.log"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
if [ $is_public -eq 0 ]
then # Remove the public access
ynh_app_setting_delete $app skipped_uris
fi
# Make app public if necessary
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app unprotected_uris "/"
ynh_permission_update --permission "main" --add "visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
systemctl reload nginx
systemctl restart rrdcached
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Navidrome completed" --last