1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/streama_ynh.git synced 2024-09-03 20:26:30 +02:00
* Update install

* Add badges

* Fix manifest

* set port

* Update README.md

* Create README_fr.md

* Update README.md

Add link to README_fr.md

* Update README.md

Little change

* V.1.9.2 (#19)

* Upgrade to 1.9.2

* Add subdomain warning install

* Update manifest.json

* Small fixes

* Update restore

* Fix typo

Co-authored-by: Thovi98 <51749973+Thovi98@users.noreply.github.com>
This commit is contained in:
Éric Gaspar 2020-10-27 13:36:23 +01:00 committed by GitHub
parent 9595a7f894
commit c4f3e0cc21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 424 additions and 392 deletions

View file

@ -1,38 +1,69 @@
# Streama app for YunoHost
Streama Server
**Shipped version:** 1.9.1
- [Yunohost project](https://yunohost.org)
- [Streama website](https://github.com/streamaserver/streama/)
![](https://avatars2.githubusercontent.com/u/38193973?s=280&v=4)
# Streama for YunoHost
[![Integration level](https://dash.yunohost.org/integration/streama.svg)](https://dash.yunohost.org/appci/app/streama) ![](https://ci-apps.yunohost.org/ci/badges/streama.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/streama.maintain.svg)
[![Install Streama with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=streama)
### Installing guide
*[Lire ce readme en français.](./README_fr.md)*
App can be installed by YunoHost **admin web-interface** or by **running following command**:
> *This package allows you to install Streama 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.*
$ sudo yunohost app install https://github.com/YunoHost-Apps/streama_ynh
## Overview
Streama is a free self hosted media streaming server running on Java, that you can install on your Linux distribution. Its features are similar to those of Kodi and Plex and it is simply a matter of personal choice which one you would like to use.
Upload directory is : /home/yunohost.app/streama
**Shipped version:** 1.9.2
Local video is : /home/yunohost.app/streama/upload
## Screenshots
### Convert video :
![](https://user-images.githubusercontent.com/51749973/96721577-9f216280-13ac-11eb-935c-d083f4b010a2.jpg)
## Demo
* [Official demo](https://streama.demo-version.net)
**User**: demoUser
**Password**: demoUser
## Installation guide
> :warning: Streama must be installed in the root domain or subdomain.
Default upload directory is: `/home/yunohost.app/streama` (must be mentioned in *Settings* page or can be changed)
Default local video directory is: `/home/yunohost.app/streama/upload` (must be mentioned in *Settings* page or can be changed)
## Documentation
* Official documentation: https://docs.streama-project.com/ or https://github.com/streamaserver/streama/wiki
#### Multi-user support
* Are LDAP and HTTP auth supported? **No**
* Can the app be used by multiple users? **Yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/streama%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/streama/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/streama%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/streama/)
## Limitations
## Additional information
* After install:
- **Username**: admin
- **Password**: admin
This can be changed in settings.
### Convert video:
$ convert_movies -ffmpeg
$ convert_movies -avidemux
$ convert_movies -mencoder
$ convert_movies -avconv
### Upgrade this package:
$ sudo yunohost app upgrade --verbose example -u https://github.com/YunoHost-Apps/streama_ynh
### Avidemux compilation :
### Avidemux compilation:
$ git clone https://github.com/mean00/avidemux2/
$ cd avidemux2
@ -49,3 +80,22 @@ Streama Server
$ sudo dpkg -i libaften-dev_0.0.8svn20100103-dmo2_amd64.deb
$ bash bootStrap.bash --deb --without-qt --with-cli
## Links
* Report a bug: https://github.com/YunoHost-Apps/streama_ynh/issues
* App website: https://docs.streama-project.com/
* Upstream app repository: https://github.com/streamaserver/streama
* YunoHost website: https://yunohost.org/
---
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/streama_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/streama_ynh/tree/testing --debug
or
sudo yunohost app upgrade streama -u https://github.com/YunoHost-Apps/streama_ynh/tree/testing --debug
```

101
README_fr.md Normal file
View file

@ -0,0 +1,101 @@
# Streama pour YunoHost
[![Integration level](https://dash.yunohost.org/integration/streama.svg)](https://dash.yunohost.org/appci/app/streama) ![](https://ci-apps.yunohost.org/ci/badges/streama.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/streama.maintain.svg)
[![Install Streama with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=streama)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Streama rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
## Vue d'ensemble
Streama est un serveur de streaming multimédia auto-hébergé gratuit fonctionnant sur Java, que vous pouvez installer sur votre distribution Linux. Ses fonctionnalités sont similaires à celles de Kodi et Plex et c'est simplement une question de choix personnel que vous souhaitez utiliser.
**Version incluse :** 1.9.2
## Captures d'écran
![](https://user-images.githubusercontent.com/51749973/96721577-9f216280-13ac-11eb-935c-d083f4b010a2.jpg)
## Démo
* [Démo officielle](https://streama.demo-version.net)
**Nom dutilisateur**: demoUser
**Mot de passe**: demoUser
## Guide dinstallation
> :warning: Streama doit être installé dans le domaine racine ou un sous-domaine dédié.
Le répertoire de téléchargement par défaut est : `/home/yunohost.app/streama` (doit être mentionné dans la page *Paramètres* ou peut être modifié)
Le répertoire vidéo local par défaut est : `/home/yunohost.app/streama/upload` (doit être mentionné dans la page *Paramètres* ou peut être modifié)
## Documentation
* Documentation officielle : https://docs.streama-project.com/ ou https://github.com/streamaserver/streama/wiki
#### Support multi-utilisateur
* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/streama%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/streama/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/streama%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/streama/)
## Limitations
## Informations additionnelles
* Après linstallation :
- **Nom dutilisateur**: admin
- **Mot de passe**: admin
Ceci pourra être changé dans les paramètres.
### Convertir des vidéos :
$ convert_movies -ffmpeg
$ convert_movies -avidemux
$ convert_movies -mencoder
$ convert_movies -avconv
### Compilation avidemux :
$ git clone https://github.com/mean00/avidemux2/
$ cd avidemux2
$ sudo apt-get install build-essential cmake \
pkg-config yasm libsqlite3-dev libfontconfig1-dev \
libfribidi-dev libxvdev libvdpau-dev libva-dev \
libasound2-dev libpulse-dev libfdk-aac-dev \
libpng-dev libmp3lame-dev libx264-dev \
libxvidcore-dev libfaad-dev libfaac-dev libopus-dev \
libvorbis-dev libogg-dev libdca-dev libx265-dev
$ wget https://www.deb-multimedia.org/pool/main/a/aften/libaften0_0.0.8svn20100103-dmo2_amd64.deb
$ wget https://www.deb-multimedia.org/pool/main/a/aften/libaften-dev_0.0.8svn20100103-dmo2_amd64.deb
$ sudo dpkg -i libaften0_0.0.8svn20100103-dmo2_amd64.deb
$ sudo dpkg -i libaften-dev_0.0.8svn20100103-dmo2_amd64.deb
$ bash bootStrap.bash --deb --without-qt --with-cli
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/streama_ynh/issues
* Site de l'application : https://docs.streama-project.com/
* Dépôt de l'application principale : https://github.com/streamaserver/streama
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/streama_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/streama_ynh/tree/testing --debug
ou
sudo yunohost app upgrade streama -u https://github.com/YunoHost-Apps/streama_ynh/tree/testing --debug
```

View file

@ -8,35 +8,22 @@
domain="domain.tld" (DOMAIN)
path="/" (PATH)
is_public=1 (PUBLIC|public=1|private=0)
# password="pass"
# nextclouddomain="domain.tld"
port="9980" (PORT)
; Checks
pkg_linter=1
setup_sub_dir=0
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=0
setup_private=1
setup_public=1
upgrade=1
backup_restore=1
multi_instance=1
incorrect_path=1
multi_instance=0
incorrect_path=0
port_already_use=0
change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4:
Level 4=1 (This app supports the Nextcloud LDAP auth)
# 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,6 +1,6 @@
SOURCE_URL=https://github.com/streamaserver/streama/releases/download/v1.9.1/streama-1.9.1.jar
SOURCE_SUM=b5070cde90d4291828b473009e8f3adb1e81b234ed29c0395837ff0842f6de24dfcfb37ba55304bc7a73dfa831d24949b6b5befbdee01b6c4ddfc26066360662
SOURCE_SUM_PRG=sha512sum
SOURCE_URL=https://github.com/streamaserver/streama/releases/download/v1.9.2/streama-1.9.2.jar
SOURCE_SUM=86362d9f61b85846a23aaafbfbe2746bb6fb25f9c459e8739337c8dbd128a786
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=jar
SOURCE_IN_SUBDIR=false
SOURCE_EXTRACT=false

View file

@ -1,4 +1,10 @@
location __PATH__/ {
# 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;
@ -8,12 +14,11 @@ location __PATH__/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
#WebSocket Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
# Upload Size.
client_max_body_size 128g;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
}

View file

@ -1,14 +1,14 @@
[Unit]
Description=streama
Description=Streama media system
After=network.target
[Service]
WorkingDirectory=/opt/streama/
User=streama
Group=users
Type=simple
User=__APP__
Group=__APP__
UMask=000
ExecStart=/usr/bin/java -Djava.awt.headless=true -jar streama.jar
WorkingDirectory=__FINALPATH__
ExecStart=/usr/bin/java -Djava.awt.headless=true -Dserver.port=__PORT__ -jar streama.jar
RestartSec=30
Restart=always

View file

@ -1,25 +1,24 @@
{
"name": "StreamaServer",
"name": "Streama",
"id": "streama",
"packaging_format": 1,
"description": {
"en": "A self hosted streaming media server",
"fr": "Un serveur de streaming auto-hébergé"
"en": "Self hosted streaming media server",
"fr": "Serveur de streaming auto-hébergé"
},
"version": "1.9.1",
"version": "1.9.2~ynh1",
"url": "https://streamaserver.org/",
"license": "free",
"license": "MIT",
"maintainer": {
"name": "liberodark",
"email": "liberodark@gmail.com"
},
"requirements": {
"yunohost": ">= 2.7.2"
"yunohost": ">= 3.8.1"
},
"multi_instance": true,
"multi_instance": false,
"services": [
"nginx",
"php5-fpm",
"mysql"
],
"arguments": {
@ -27,31 +26,19 @@
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for StreamaServer",
"fr": "Choisissez un nom de domaine pour StreamaServer"
"en": "Choose a domain name for Streama",
"fr": "Choisissez un nom de domaine pour Streama"
},
"example": "example.com"
"example": "streama.example.com"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for StreamaServer only / is accepted",
"fr": "Choisissez un chemin pour StreamaServer seulement / est accepté"
},
"example": "/",
"default": "/"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public site ?",
"en": "Is it a public site?",
"fr": "Est-ce un site public ?"
},
"default": "true"
"default": true
}
]
}

View file

@ -1,112 +1,20 @@
#!/bin/bash
# =============================================================================
# YUNOHOST 2.7 FORTHCOMING HELPERS
# =============================================================================
#=================================================
# COMMON VARIABLES
#=================================================
# Create a dedicated nginx config
#
# 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"
# dependencies used by the app
pkg_dependencies="openjdk-11-jre-headless ffmpeg"
# 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"
#=================================================
# PERSONAL HELPERS
#=================================================
sudo systemctl reload nginx
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
# Remove the dedicated nginx config
#
# 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_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
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -6,7 +6,6 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -14,17 +13,12 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
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
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -32,46 +26,30 @@ final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
domain=$(ynh_app_setting_get --app="$app" --key=domain)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..." --time --weight=1
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
ynh_print_info --message="Backup script completed for Streama. (YunoHost will then actually copy those files to the archive)."

View file

@ -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
@ -26,119 +25,79 @@ ynh_abort_if_errors
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
### If it's 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 interests you 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
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
final_path=/opt/$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"
# 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_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
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
#=================================================
# FIND AND OPEN A PORT
#=================================================
### Use these lines if you have to open a port for the application
### `ynh_find_port` will find the first available port starting from the given port.
### If you're not using these lines:
### - Remove the section "CLOSE A PORT" in the remove script
ynh_script_progression --message="Configuring firewall..." --weight=3
# Find a free port
port=$(ynh_find_port 8080)
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies..."
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
### Those deb packages will be installed as dependencies of this package.
### If you're not using this helper:
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
ynh_install_app_dependencies openjdk-8-jre-headless ffmpeg
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
ynh_app_setting_set $app final_path $final_path
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 "$final_path"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_add_systemd_config
systemctl enable $app.service
ynh_setup_source --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGNX web server..." --weight=3
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
ynh_system_user_create $app
ynh_system_user_create --username=$app
#=================================================
# MODIFY A CONFIG FILE
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_replace_string "__DOMAIN__" "$domain" "../conf/nginx.conf"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
### `ynh_store_file_checksum` is used to store the checksum of a file.
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
### you can make a backup of this file before modifying it again if the admin had modified it.
# Calculate and store the config file checksum into the app settings
#ynh_store_file_checksum "/etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/systemd.service"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
@ -146,27 +105,58 @@ ynh_replace_string "__DOMAIN__" "$domain" "../conf/nginx.conf"
# SECURE FILES AND DIRECTORIES
#=================================================
### For security reason, any app should set the permissions to root: before anything else.
### Then, if write authorization is needed, any access should be given only to directories
### that really need such authorization.
# Set permissions to app files
mkdir -p $final_path/data/streama
ln -s $final_path/data/streama /home/yunohost.app/streama
chown -R $app: $final_path
cp "../conf/convert.sh" /usr/bin/convert_movies
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
chown -R $app: $final_path
chmod +x /usr/bin/convert_movies
chmod +x $final_path/streama.jar
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=4
yunohost service add $app --description "Streama media system" --log "/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Grails application running at"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# If app is public, add url to SSOWat conf as skipped_uris
if [ $is_public -eq 1 ]; then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set "$app" unprotected_uris "/"
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission "main" --add "visitors"
fi
# Reload services
systemctl start $app.service
systemctl reload nginx
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Streama completed" --last

View file

@ -12,14 +12,12 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain)
port=$(ynh_app_setting_get "$app" port)
db_name=$(ynh_app_setting_get "$app" db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get "$app" final_path)
#=================================================
@ -28,17 +26,17 @@ final_path=$(ynh_app_setting_get "$app" final_path)
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status "$app" >/dev/null 2>&1
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_print_info "Removing $app service"
yunohost service remove "$app"
ynh_script_progression --message="Removing Streama service integration..." --weight=1
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info "Stopping and removing the systemd service"
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config
ynh_remove_systemd_config
@ -46,81 +44,39 @@ ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies"
ynh_script_progression --message="Removing dependencies..." --weight=11
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info "Removing app main directory"
ynh_script_progression --message="Removing Streama main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove "$final_path"
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info "Removing nginx web server configuration"
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
#ynh_print_info "Removing php-fpm configuration"
# Remove the dedicated php-fpm config
#ynh_remove_fpm_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_print_info "Removing logrotate configuration"
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_print_info "Closing port $port"
ynh_exec_warn_less yunohost firewall disallow TCP "$port"
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
#=================================================
# Remove a cron file
ynh_secure_remove "/etc/cron.d/$app"
# Remove a directory securely
ynh_secure_remove "/etc/$app/"
# Remove the log files
ynh_secure_remove "/var/log/$app/"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing the dedicated system user"
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete "$app"
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Removal of $app completed"
ynh_script_progression --message="Removal of Streama completed" --last

View file

@ -6,7 +6,6 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -15,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
@ -24,7 +22,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --time --weight=1
ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -35,7 +33,7 @@ final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
ynh_script_progression --message="Validating restoration parameters..." --weight=3
ynh_webpath_available --domain="$domain" --path_url="$path_url" \
|| ynh_die --message="Path not available: ${domain}${path_url}"
@ -53,27 +51,34 @@ 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..." --time --weight=1
ynh_script_progression --message="Restoring Streama main directory..." --weight=2
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
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
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC RESTORATION
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1
ynh_script_progression --message="Restoring the systemd configuration..." --weight=2
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable "$app".service
systemctl enable $app.service
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -84,16 +89,16 @@ yunohost service add "$app" --description "Streama media system" --log "/var/log
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Grails application running at"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -101,4 +106,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --time --last
ynh_script_progression --message="Restoration completed for Streama" --last

View file

@ -1,64 +1,129 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# See comments in install script
app=$YNH_APP_INSTANCE_NAME
final_path=/opt/yunohost/$app
# Source YunoHost helpers
source /usr/share/yunohost/helpers
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)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
port=$(ynh_app_setting_get --app=$app --key=port)
# Stop streama service
systemctl stop streama
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up Streama before upgrading (may take a while)..." --weight=2
# 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
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=20
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=3
ynh_app_setting_set $app final_path $final_path
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 "$final_path"
ynh_setup_source --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=240
# Create a dedicated nginx config
#ynh_add_nginx_config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE CONFIG
# UPGRADE DEPENDENCIES
#=================================================
#cp -a ../conf/loolwsd.xml /etc/loolwsd
#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml"
#ynh_replace_string "__PASSWORD__" "$password" "/etc/loolwsd/loolwsd.xml"
#systemctl restart loolwsd
ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=3
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/systemd.service"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
### For security reason, any app should set the permissions to root: before anything else.
### Then, if write authorization is needed, any access should be given only to directories
### that really need such authorization.
# Set permissions to app files
mkdir -p $final_path/data/streama
ln -s $final_path/data/streama /home/yunohost.app/streama
chown -R $app: $final_path
cp -a "../conf/convert.sh" /usr/bin/convert_movies
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
chown -R $app: $final_path
chmod +x /usr/bin/convert_movies
chmod +x $final_path/streama.jar
# If app is public, add url to SSOWat conf as skipped_uris
#if [[ $is_public -eq 1 ]]; then
# See install script
# ynh_app_setting_set "$app" unprotected_uris "/"
#fi
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=3
# Start streama service
systemctl start streama
yunohost service add $app --description "Streama media system" --log "/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=5
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Grails application running at"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of Streama completed" --last