1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/airsonic_ynh.git synced 2024-09-03 18:06:14 +02:00

Add templates

This commit is contained in:
ericgaspar 2021-06-27 11:57:49 +02:00
parent e5a0e5161a
commit 052bc0f5da
No known key found for this signature in database
GPG key ID: 574F281483054D44
12 changed files with 173 additions and 157 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,9 +1,9 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
path="/path"
admin="john"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1

6
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,6 @@
## YunoHost specific features
* YunoHost LDAP accounts supported: **Yes**
* [Multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) handled
* Memory RAM limit set to 256 MB because Airsonic was often killed by lack of RAM (hello OOM killer)
* See https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/

6
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,6 @@
## Fonctionnalités spécifiques à YunoHost
* Comptes LDAP YunoHost pris en charge : **oui**
* [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) géré
* Limite de mémoire RAM fixée à 256 Mb car Airsonic quittait souvant par manque de RAM (bonjour OOM killer)
* Voir https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/

View file

Before

Width:  |  Height:  |  Size: 400 KiB

After

Width:  |  Height:  |  Size: 400 KiB

View file

@ -8,13 +8,20 @@
},
"version": "10.6.2~ynh2",
"url": "http://airsonic.github.io",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://airsonic.github.io/",
"demo": "https://airsonic.github.io/demo/",
"admindoc": "https://airsonic.github.io/docs/",
"code": "https://github.com/airsonic/airsonic"
},
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Gofannon",
"email": "gofannon@riseup.net"
},
"requirements": {
"yunohost": ">= 4.1.7"
"yunohost": ">= 4.2.4"
},
"multi_instance": true,
"services": [
@ -36,10 +43,6 @@
{
"name": "admin",
"type": "user",
"help": {
"en": "This user will have full control on this application and will be able to configure it.",
"fr": "Cet utilisateur aura le controle total de l'application et pourra la configurer."
},
"example": "johndoe"
},
{

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

@ -18,56 +18,3 @@ pkg_dependencies="openjdk-8-jre|openjdk-11-jre ffmpeg"
#=================================================
# 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
}
# Add a directory in yunohost.multimedia
# This "directory" will be a symbolic link to a existing directory.
#
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
#
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
ynh_multimedia_addfolder () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
local source_dir
local dest_dir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
}
# Grant write access to multimedia directories to a specified user
#
# usage: ynh_multimedia_addaccess user_name
#
# | arg: user_name - User to be granted write access
ynh_multimedia_addaccess () {
local user_name=$1
groupadd -f multimedia
usermod -a -G multimedia $user_name
}

View file

@ -72,6 +72,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=43
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -81,6 +89,10 @@ 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
#=================================================
@ -90,27 +102,18 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
ynh_script_progression --message="Creating a data directory..." --weight=1
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE DIRECTORIES
#=================================================
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists}
#=================================================
# SECURING FILES AND DIRECTORIES
#=================================================
chown -R $app:www-data /home/yunohost.app/$app
chmod 764 /home/yunohost.app/$app
chmod 764 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
@ -120,6 +123,7 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=3
ynh_multimedia_build_main_dir
ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Podcasts" --dest_dir="share/Podcasts"
ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Playlists" --dest_dir="share/Playlists"
# Allow airsonic to write into these directories
ynh_multimedia_addaccess $app
@ -141,7 +145,7 @@ if [ -x /usr/bin/lame ]; then # Check if 'lame' is installed and executable
fi
# Ensure links belong to the $app user
chown $app: $final_path/transcode
chown $app $final_path/transcode
#=================================================
# SETUP SYSTEMD
@ -159,15 +163,6 @@ ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/defaul
# Copy configuration file of airsonic
ynh_add_config --template="../conf/airsonic.properties" --destination="$final_path/airsonic.properties"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R $app: $final_path
#=================================================
# SETUP LOGROTATE
#=================================================

View file

@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -49,6 +50,14 @@ test ! -d $final_path \
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -56,20 +65,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
chown -R $app: $final_path
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
@ -99,7 +97,7 @@ if [ -x /usr/bin/lame -a ! -e $final_path/transcode/lame ]; then # Check if 'l
fi
# Ensure links belong to the $app user
chown $app: $final_path/transcode
chown $app $final_path/transcode
#=================================================
# RESTORE SYSTEMD
@ -130,19 +128,18 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# RESTORE DATA
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --time --weight=1
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
ynh_restore_file --origin_path="/home/yunohost.app/$app" --not_mandatory
ynh_restore_file --origin_path="$datadir" --not_mandatory
#=================================================
# RESTORE USER RIGHTS
#=================================================
mkdir -p $datadir
mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists}
chown -R $app:www-data /home/yunohost.app/$app
chmod -R 764 /home/yunohost.app/$app
chmod 764 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
@ -153,7 +150,7 @@ ynh_multimedia_build_main_dir
ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Podcasts" --dest_dir="share/Podcasts"
ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Playlists" --dest_dir="share/Playlists"
# Allow airsonic to write into these directories
ynh_multimedia_addaccess $app
ynh_multimedia_addaccess --user_name=$app
#=================================================
# GENERIC FINALIZATION

View file

@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
port=$(ynh_app_setting_get --app=$app --key=port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK VERSION
@ -38,6 +39,17 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If public_path doesn't exist, create it
if [ -z "$datadir" ]; then
datadir=/home/yunohost.app/$app
mkdir -p $datadir/{Podcasts,Playlists}
chmod 764 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
cp -a "/home/yunohost.$app" "$datadir"
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
@ -70,6 +82,14 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -82,6 +102,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
#=================================================
@ -97,28 +121,20 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=4
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# #=================================================
# # SPECIFIC UPGRADE
# #=================================================
# # CREATE DIRECTORIES
# #=================================================
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
# mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists}
#=================================================
# SPECIFIC UPGRADE
#=================================================
# CREATE DIRECTORIES
#=================================================
# #=================================================
# # SECURING FILES AND DIRECTORIES
# #=================================================
mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists}
#=================================================
# SECURING FILES AND DIRECTORIES
#=================================================
chown -R $app:www-data /home/yunohost.app/$app
chmod 764 /home/yunohost.app/$app
# chown -R $app:www-data /home/yunohost.app/$app
# chmod 764 /home/yunohost.app/$app
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
@ -160,7 +176,7 @@ if [ -x /usr/bin/lame -a ! -e $final_path/transcode/lame ]; then # Check if 'l
fi
# Ensure links belong to the $app user
chown $app: $final_path/transcode
chown $app $final_path/transcode
#=================================================
# STORE THE CONFIG FILE CHECKSUM
@ -187,15 +203,6 @@ ynh_add_systemd_config
ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R $app: $final_path
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================