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

Upgrade to Airsonic-Advanced

This commit is contained in:
yalh76 2022-09-21 22:43:56 +02:00
parent b8f9f6f6fe
commit 90007488ce
14 changed files with 225 additions and 20 deletions

132
.github/workflows/updater.sh vendored Normal file
View file

@ -0,0 +1,132 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | .tag_name' | sort -V | tail -1)
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"war"*)
src="app"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=war
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=airsonic.war
SOURCE_EXTRACT=false
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

49
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,49 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -13,6 +13,8 @@
setup_public=1
upgrade=1
upgrade=1 from_commit=72d530415c016b23b6ba62085272957b04d2cca6
# 10.6.2~ynh3
upgrade=1 from_commit=6ca76697a8f8da7419eb490aa435649f1b9d96c2
backup_restore=1
multi_instance=1
port_already_use=0

View file

@ -10,3 +10,4 @@ LdapAutoShadowing=true
GettingStartedEnabled=false
PodcastFolder=/home/yunohost.multimedia/share/Podcasts
PlaylistFolder=/home/yunohost.multimedia/share/Playlists
server.forward-headers-strategy=native

View file

@ -1,7 +1,7 @@
SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.6.2/airsonic.war
SOURCE_SUM=94b17d6a7859a9c029dcbcdc672f4d49bd605bf46bdf74ac51ea0d593db67860
SOURCE_URL=https://github.com/airsonic-advanced/airsonic-advanced/releases/download/11.0.0-SNAPSHOT.20220625052932/airsonic.war
SOURCE_SUM=6be139912d0e15b97e454f52fa8a7bb2f511d177afe202f6e2f32dcd8a253cc8
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=false
SOURCE_FORMAT=war
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=airsonic.war
SOURCE_EXTRACT=false

View file

@ -3,14 +3,20 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Host $host;
proxy_max_temp_file_size 0;
proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect http:// https://;
proxy_buffering off;
proxy_request_buffering off;
# set client body size to 500 MB
# Allows to upload zip file up to 500 MB

View file

@ -16,7 +16,7 @@ EnvironmentFile=-/etc/default/__APP__
ExecStart=/usr/bin/java \
$JAVA_OPTS \
-Dairsonic.home=${AIRSONIC_HOME} \
-Dserver.context-path=${CONTEXT_PATH} \
-Dserver.servlet.context-path=${CONTEXT_PATH} \
-Dserver.port=${PORT} \
-jar ${JAVA_JAR} $JAVA_ARGS

View file

@ -1,3 +1,5 @@
Airsonic-Advanced is a more modern implementation of the Airsonic fork with several key performance and feature enhancements. It adds and supersedes several features in Airsonic.
Airsonic is a free, web-based media streamer, providing ubiquitous access to your music. Use it to share your music with friends, or to listen to your own music while at work. You can stream to multiple players simultaneously, for instance to one player in your kitchen and another in your living room.
Airsonic is designed to handle very large music collections (hundreds of gigabytes). Although optimized for MP3 streaming, it works for any audio or video format that can stream over HTTP, for instance AAC and OGG. By using transcoder plug-ins, Airsonic supports on-the-fly conversion and streaming of virtually any audio format, including WMA, FLAC, APE, Musepack, WavPack and Shorten.

View file

@ -1 +1,9 @@
Streamez et gérez votre collection de musique
Airsonic-Advanced est une implémentation plus moderne de la bifurcation d'Airsonic avec plusieurs améliorations clés en termes de performances et de fonctionnalités. Elle ajoute et remplace plusieurs fonctionnalités d'Airsonic.
Airsonic est un streamer multimédia gratuit, basé sur le web, qui fournit un accès omniprésent à votre musique. Utilisez-le pour partager votre musique avec vos amis, ou pour écouter votre propre musique au travail. Vous pouvez diffuser votre musique sur plusieurs lecteurs simultanément, par exemple sur un lecteur dans votre cuisine et un autre dans votre salon.
Airsonic est conçu pour gérer de très grandes collections de musique (des centaines de gigaoctets). Bien qu'il soit optimisé pour le streaming MP3, il fonctionne pour tout format audio ou vidéo pouvant être diffusé par HTTP, par exemple AAC et OGG. En utilisant des plug-ins de transcodage, Airsonic prend en charge la conversion et le streaming à la volée de pratiquement tous les formats audio, notamment WMA, FLAC, APE, Musepack, WavPack et Shorten.
Si vous avez une bande passante limitée, vous pouvez fixer une limite supérieure pour le débit binaire des flux musicaux. Airsonic rééchantillonnera alors automatiquement la musique à un débit binaire approprié.
En plus d'être un serveur de médias en streaming, Airsonic fonctionne très bien comme un jukebox local. L'interface web intuitive, ainsi que les fonctions de recherche et d'indexation, sont optimisées pour une navigation efficace dans les grandes bibliothèques de médias. Airsonic est également livré avec un récepteur de podcasts intégré, avec la plupart des fonctionnalités que vous trouvez dans iTunes.

View file

@ -0,0 +1,6 @@
## Caractéristiques spécifiques de YunoHost
* Comptes LDAP supportés par YunoHost : **Oui**
* Gestion du [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia)
* La limite de mémoire RAM a été fixée à 256 Mo car Airsonic était souvent tué par le manque de RAM (hello OOM killer).
* Voir https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/

View file

@ -1,19 +1,18 @@
{
"name": "Airsonic",
"name": "Airsonic-Advanced",
"id": "airsonic",
"packaging_format": 1,
"description": {
"en": "Stream and manage your music collection",
"fr": "Streamez et gérez votre collection de musique"
},
"version": "10.6.2~ynh3",
"url": "http://airsonic.github.io",
"version": "11.0.0-SNAPSHOT.20220625052932~ynh1",
"url": "https://github.com/airsonic-advanced/airsonic-advanced",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://airsonic.github.io/",
"demo": "https://airsonic.github.io/demo/",
"website": "https://github.com/airsonic-advanced/airsonic-advanced",
"admindoc": "https://airsonic.github.io/docs/",
"code": "https://github.com/airsonic/airsonic"
"code": "https://github.com/airsonic-advanced/airsonic-advanced"
},
"license": "GPL-3.0-or-later",
"maintainer": {

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app (must be on a single line)
pkg_dependencies="openjdk-8-jre|openjdk-11-jre ffmpeg"
pkg_dependencies="openjdk-11-jre ffmpeg"
#=================================================
# PERSONAL HELPERS

View file

@ -39,7 +39,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/opt/yunohost/$app
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
@ -154,12 +154,12 @@ chown $app $final_path/transcode
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app"
chmod 400 "/etc/default/$app"
chmod 600 "/etc/default/$app"
chown $app:$app "/etc/default/$app"
# Copy configuration file of airsonic
ynh_add_config --template="../conf/airsonic.properties" --destination="$final_path/airsonic.properties"
chmod 400 "$final_path/airsonic.properties"
chmod 600 "$final_path/airsonic.properties"
chown $app:$app "$final_path/airsonic.properties"
#=================================================

View file

@ -60,7 +60,7 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/opt/yunohost/$app
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
@ -185,11 +185,11 @@ chown $app $final_path/transcode
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app"
chmod 400 "/etc/default/$app"
chmod 600 "/etc/default/$app"
chown $app:$app "/etc/default/$app"
ynh_add_config --template="../conf/airsonic.properties" --destination="$final_path/airsonic.properties"
chmod 400 "$final_path/airsonic.properties"
chmod 600 "$final_path/airsonic.properties"
chown $app:$app "$final_path/airsonic.properties"
#=================================================