mirror of
https://github.com/YunoHost-Apps/audiobookshelf_ynh.git
synced 2024-09-03 18:06:19 +02:00
Merge pull request #12 from YunoHost-Apps/testing
Apply last example_ynh
This commit is contained in:
commit
77d65c4051
17 changed files with 110 additions and 79 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
21
README.md
21
README.md
|
@ -5,7 +5,7 @@ It shall NOT be edited by hand.
|
|||
|
||||
# Audiobookshelf for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/audiobookshelf)  
|
||||
[](https://dash.yunohost.org/appci/app/audiobookshelf)  
|
||||
[](https://install-app.yunohost.org/?app=audiobookshelf)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
@ -30,13 +30,13 @@ Audiobookshelf is a self-hosted audiobook server for managing and playing your a
|
|||
* Chromecast support on the web app
|
||||
* Fetch metadata and cover art from several sources
|
||||
|
||||
**Shipped version:** 2.0.11~ynh1
|
||||
**Shipped version:** 2.0.11~ynh2
|
||||
|
||||
**Demo:** https://audiobookshelf.org/
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
|
@ -51,21 +51,22 @@ Audiobookshelf is a self-hosted audiobook server for managing and playing your a
|
|||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://audiobookshelf.org/
|
||||
* Official user documentation: https://www.audiobookshelf.org/docs
|
||||
* Upstream app code repository: https://github.com/advplyr/audiobookshelf
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_audiobookshelf
|
||||
* Report a bug: https://github.com/YunoHost-Apps/audiobookshelf_ynh/issues
|
||||
* Official app website: <https://audiobookshelf.org/>
|
||||
* Official user documentation: <https://www.audiobookshelf.org/docs>
|
||||
* Upstream app code repository: <https://github.com/advplyr/audiobookshelf>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_audiobookshelf>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/audiobookshelf_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/audiobookshelf_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/audiobookshelf_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade audiobookshelf -u https://github.com/YunoHost-Apps/audiobookshelf_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
27
README_fr.md
27
README_fr.md
|
@ -1,10 +1,14 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# Audiobookshelf pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/audiobookshelf)  
|
||||
[](https://dash.yunohost.org/appci/app/audiobookshelf)  
|
||||
[](https://install-app.yunohost.org/?app=audiobookshelf)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Audiobookshelf 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.*
|
||||
|
@ -26,13 +30,13 @@ Audiobookshelf est un serveur auto-hébergé pour gérer et lire vos livres audi
|
|||
* Support de Chromecast dans la webapp
|
||||
* Récupération des métadonnées et des pochettes depuis plusieurs sources
|
||||
|
||||
**Version incluse :** 2.0.11~ynh1
|
||||
**Version incluse :** 2.0.11~ynh2
|
||||
|
||||
**Démo :** https://audiobookshelf.org/
|
||||
|
||||
## Captures d'écran
|
||||
|
||||

|
||||

|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
|
@ -46,21 +50,22 @@ Audiobookshelf est un serveur auto-hébergé pour gérer et lire vos livres audi
|
|||
* L'utilisateur par défaut est `root`, sans mot de passe
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l'app : https://audiobookshelf.org/
|
||||
* Documentation officielle utilisateur : https://www.audiobookshelf.org/docs
|
||||
* Dépôt de code officiel de l'app : https://github.com/advplyr/audiobookshelf
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_audiobookshelf
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/audiobookshelf_ynh/issues
|
||||
* Site officiel de l'app : <https://audiobookshelf.org/>
|
||||
* Documentation officielle utilisateur : <https://www.audiobookshelf.org/docs>
|
||||
* Dépôt de code officiel de l'app : <https://github.com/advplyr/audiobookshelf>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_audiobookshelf>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/audiobookshelf_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/audiobookshelf_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/audiobookshelf_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade audiobookshelf -u https://github.com/YunoHost-Apps/audiobookshelf_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/"
|
||||
is_public=1
|
||||
port="3333"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
|
@ -12,13 +10,11 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
#upgrade=1 from_commit=CommitHash
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=CommitHash
|
||||
name=Name and date of the commit.
|
||||
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666&
|
||||
|
|
11
conf/.env
Normal file
11
conf/.env
Normal file
|
@ -0,0 +1,11 @@
|
|||
NODE_ENV=production
|
||||
PORT=__PORT__
|
||||
HOST=localhost
|
||||
CONFIG_PATH=__DATADIR__/config
|
||||
AUDIOBOOK_PATH=__DATADIR__/audiobooks
|
||||
METADATA_PATH=__DATADIR__/metadata
|
||||
AUDIOBOOKSHELF_UID=__APP__
|
||||
AUDIOBOOKSHELF_GID=__APP__
|
||||
FFMPEG_PATH=/usr/bin/ffmpeg
|
||||
FFPROBE_PATH=/usr/bin/ffprobe
|
||||
SOURCE=local
|
|
@ -1,9 +0,0 @@
|
|||
const Path = require('path')
|
||||
module.exports.config = {
|
||||
Port: __PORT__,
|
||||
ConfigPath: Path.resolve('__DATADIR__/config'),
|
||||
AudiobookPath: Path.resolve('__DATADIR__/audiobooks'),
|
||||
MetadataPath: Path.resolve('__DATADIR__/metadata'),
|
||||
FFmpegPath: '/usr/bin/ffmpeg',
|
||||
FFProbePath: '/usr/bin/ffprobe'
|
||||
}
|
|
@ -19,4 +19,4 @@ location __PATH__/ {
|
|||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=__YNH_NPM__ run prod
|
||||
EnvironmentFile=__FINALPATH__/.env
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
ExecStart=__YNH_NODE__ prod.js
|
||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||
StandardError=inherit
|
||||
Restart=on-failure
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Audiobook server for managing and playing your audiobooks",
|
||||
"fr": "Serveur de livres audio pour gérer et lire vos livres audio"
|
||||
},
|
||||
"version": "2.0.11~ynh1",
|
||||
"version": "2.0.11~ynh2",
|
||||
"url": "https://audiobookshelf.org/",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-only",
|
||||
|
@ -28,7 +28,7 @@
|
|||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
|
|
|
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
|
|
@ -38,6 +38,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
|
|||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
|
@ -108,7 +109,8 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --timeout="120"
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Listening on"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -14,8 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -49,8 +48,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
|
|||
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=nodejs_version --value=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
@ -59,7 +56,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
|||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=3333)
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
|
@ -68,7 +65,6 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
ynh_script_progression --message="Installing dependencies..." --weight=10
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
|
@ -101,13 +97,20 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# Node Stuff
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Audiobookshelf..." --weight=10
|
||||
ynh_script_progression --message="Building app..." --weight=10
|
||||
|
||||
ynh_use_nodejs
|
||||
|
||||
pushd $final_path/client
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm cache clean --force
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run generate
|
||||
popd
|
||||
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install run client
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --only=production
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -129,10 +132,10 @@ chown -R $app:www-data "$datadir"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/dev.js" --destination="$final_path/dev.js"
|
||||
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||
|
||||
chmod 400 "$final_path/dev.js"
|
||||
chown $app:$app "$final_path/dev.js"
|
||||
chmod 400 "$final_path/.env"
|
||||
chown $app:$app "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -165,7 +168,7 @@ yunohost service add $app --description="Audiobook server" --log="/var/log/$app/
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=3
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --timeout="120"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Listening on"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -83,10 +83,8 @@ ynh_remove_nginx_config
|
|||
ynh_script_progression --message="Removing dependencies..." --weight=4
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
# Remove NodeJS
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
|
|
|
@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -91,7 +90,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=10
|
|||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
|
@ -107,6 +105,8 @@ systemctl enable $app.service --quiet
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R $app: "/var/log/$app"
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
|
@ -121,14 +121,14 @@ yunohost service add $app --description="Audiobook server" --log="/var/log/$app/
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --timeout="120"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Listening on"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server" --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -20,10 +20,12 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
|
@ -35,6 +37,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
|||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
|
@ -50,6 +53,11 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -67,7 +75,7 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/dev.js"
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
@ -88,18 +96,39 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Upgrading dependencies..." --weight=10
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# Node Stuff
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading Audiobookshelf..." --weight=10
|
||||
# UPGRADE APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading app..." --weight=10
|
||||
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm run client
|
||||
popd
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_use_nodejs
|
||||
|
||||
pushd $final_path/client
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm cache clean --force
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run generate
|
||||
popd
|
||||
|
||||
pushd $final_path
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --only=production
|
||||
popd
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||
|
||||
chmod 400 "$final_path/.env"
|
||||
chown $app:$app "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -131,7 +160,7 @@ yunohost service add $app --description="Audiobook server" --log="/var/log/$app/
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=3
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --timeout="120"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Listening on"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
Loading…
Add table
Reference in a new issue