1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/owncast_ynh.git synced 2024-09-03 19:56:20 +02:00

Merge pull request #35 from YunoHost-Apps/testing

This commit is contained in:
Éric Gaspar 2023-03-05 12:04:07 +01:00 committed by GitHub
commit d52ebc64a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 103 additions and 484 deletions

View file

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
@ -33,7 +33,7 @@ jobs:
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}

View file

@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# Owncast for YunoHost
[![Integration level](https://dash.yunohost.org/integration/owncast.svg)](https://dash.yunohost.org/appci/app/owncast) ![Working status](https://ci-apps.yunohost.org/ci/badges/owncast.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/owncast.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/owncast.svg)](https://dash.yunohost.org/appci/app/owncast) ![Working status](https://ci-apps.yunohost.org/ci/badges/owncast.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/owncast.maintain.svg)
[![Install Owncast with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=owncast)
*[Lire ce readme en français.](./README_fr.md)*
@ -17,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Owncast is an open source, self-hosted, decentralized, single user live streaming and chat server for running your own live streams similar in style to the large mainstream options. It offers complete ownership over your content, interface, moderation and audience.
**Shipped version:** 0.0.13~ynh2
**Shipped version:** 0.0.13~ynh3
**Demo:** https://watch.owncast.online/
@ -25,26 +26,6 @@ Owncast is an open source, self-hosted, decentralized, single user live streamin
![Screenshot of Owncast](./doc/screenshots/owncast-screenshot.png)
## Disclaimers / important information
## Configuration
You can configure Owncast in the admin page: `domain.ltd/admin` with `admin` and `abc123` as credential. Don't forget to change the stream key.
## Streaming app
OBS can be used as streaming video app: https://obsproject.com/
1. Install OBS or Streamlabs OBS and get it working with your local setup.
1. Open OBS Settings and go to **Stream**.
1. Select **Custom…** as the service.
1. Enter the URL of the server running your streaming service in the format of `rtmp://myserver.net/live`.
1. Enter your **Stream Key** that matches your key file.
1. Press **Start Streaming** (OBS) or **Go Live** (Streamlabs) on OBS.
## Standalone chat mode
`https://live.domain.ltd/index-standalone-chat-readwrite.html`
## Documentation and resources
* Official app website: <https://owncast.online/>

View file

@ -5,48 +5,32 @@ It shall NOT be edited by hand.
# Owncast pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/owncast.svg)](https://dash.yunohost.org/appci/app/owncast) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/owncast.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/owncast.maintain.svg)
[![Niveau dintégration](https://dash.yunohost.org/integration/owncast.svg)](https://dash.yunohost.org/appci/app/owncast) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/owncast.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/owncast.maintain.svg)
[![Installer Owncast avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=owncast)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Owncast 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.*
> *Ce package vous permet dinstaller Owncast rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
## Vue d'ensemble
## Vue densemble
Owncast est un serveur de diffusion en direct et de chat open source, auto-hébergé, décentralisé et à utilisateur unique pour exécuter vos propres diffusions en direct dans un style similaire aux grandes options grand public. Il offre une propriété complète sur votre contenu, votre interface, votre modération et votre audience.
**Version incluse :** 0.0.13~ynh2
**Version incluse :** 0.0.13~ynh3
**Démo :** https://watch.owncast.online/
## Captures d'écran
## Captures décran
![Capture d'écran de Owncast](./doc/screenshots/owncast-screenshot.png)
## Avertissements / informations importantes
## Configuration
Vous pouvez configurer Owncast dans la page d'administration : `domain.ltd/admin` avec `admin` et `abc123` comme identifiant. N'oubliez pas de changer la clé de flux (Stream Key).
## Application de diffusion en continu
OBS peut être utilisé comme application de streaming vidéo : https://obsproject.com/
1. Installez **OBS** ou **Streamlabs OBS** et faites-le fonctionner avec votre configuration locale.
1. Ouvrez les **paramètres** OBS et allez dans **Stream**.
1. Sélectionnez **Personnalisé…** comme service.
1. Entrez l'URL du serveur exécutant votre service de streaming au format `rtmp://myserver.net/live`.
1. Saisissez votre « Stream key » qui correspond à votre clé de streaming choisie lors de l'installation.
1. Appuyez sur **Démarrer le streaming** (OBS) ou **Go Live** (Streamlabs) sur OBS.
![Capture décran de Owncast](./doc/screenshots/owncast-screenshot.png)
## Documentations et ressources
* Site officiel de l'app : <https://owncast.online/>
* Documentation officielle de l'admin : <https://owncast.online/docs/>
* Dépôt de code officiel de l'app : <https://github.com/owncast/owncast>
* Site officiel de lapp : <https://owncast.online/>
* Documentation officielle de ladmin : <https://owncast.online/docs/>
* Dépôt de code officiel de lapp : <https://github.com/owncast/owncast>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_owncast>
* Signaler un bug : <https://github.com/YunoHost-Apps/owncast_ynh/issues>
@ -62,4 +46,4 @@ ou
sudo yunohost app upgrade owncast -u https://github.com/YunoHost-Apps/owncast_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View file

@ -1,24 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/path"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
#upgrade=1 from_commit=4eab5026853627bed955945968753378ea41f5ad
backup_restore=1
multi_instance=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=4eab5026853627bed955945968753378ea41f5ad
name= Merge pull request #1
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=1Strong-Password

View file

@ -1,4 +1,5 @@
location / {
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;

View file

@ -6,8 +6,8 @@ After=network.target
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
ExecStart=__FINALPATH__/owncast --enableVerboseLogging -webserverport __PORT__
WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/owncast --enableVerboseLogging -webserverport __PORT__
Restart=on-failure
RestartSec=5

View file

@ -1,6 +1,6 @@
## Configuration
You can configure Owncast in the admin page: `domain.ltd/admin` with `admin` and `abc123` as credential. Don't forget to change the stream key.
You can configure Owncast in the admin page: `__DOMAIN__/admin` with `admin` and `abc123` as credential. Don't forget to change the stream key.
## Streaming app
@ -9,10 +9,10 @@ OBS can be used as streaming video app: https://obsproject.com/
1. Install OBS or Streamlabs OBS and get it working with your local setup.
1. Open OBS Settings and go to **Stream**.
1. Select **Custom…** as the service.
1. Enter the URL of the server running your streaming service in the format of `rtmp://myserver.net/live`.
1. Enter the URL of the server running your streaming service in the format of `rtmp://__DOMAIN__/live`.
1. Enter your **Stream Key** that matches your key file.
1. Press **Start Streaming** (OBS) or **Go Live** (Streamlabs) on OBS.
## Standalone chat mode
`https://live.domain.ltd/index-standalone-chat-readwrite.html`
`https://__DOMAIN__/index-standalone-chat-readwrite.html`

1
doc/POST_INSTALL.md Executable file
View file

@ -0,0 +1 @@
You can configure Owncast in the admin page: `__DOMAIN__/admin` with `admin` and `abc123` as credential. Don't forget to change the stream key.

1
doc/POST_INSTALL_fr.md Executable file
View file

@ -0,0 +1 @@
Vous pouvez configurer Owncast dans la page d'administration : `__DOMAIN__/admin` avec `admin` et `abc123` comme identifiant. N'oubliez pas de changer la clé de flux (Stream Key).

View file

@ -1,51 +0,0 @@
{
"name": "Owncast",
"id": "owncast",
"packaging_format": 1,
"description": {
"en": "Self-hosted live video and web chat server for use with existing broadcasting software",
"fr": "Serveur de vidéo en direct et de chat Web auto-hébergé à utiliser avec un logiciel de diffusion"
},
"version": "0.0.13~ynh2",
"url": "https://owncast.online/",
"upstream": {
"license": "MIT",
"website": "https://owncast.online/",
"demo": "https://watch.owncast.online/",
"admindoc": "https://owncast.online/docs/",
"code": "https://github.com/owncast/owncast"
},
"license": "MIT",
"maintainer": {
"name": "eric_G",
"email": ""
},
"requirements": {
"yunohost": ">= 11.0.9"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain",
"help": {
"en": "Owncast needs to be installed in a dedicated domain or sub-domain.",
"fr": "Owncast doit être installé dans un domaine ou sous-domaine dédié."
}
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Owncast will be accessible by people who do not have an account. This can be changed later via the webadmin.",
"fr": "Si cette case est cochée, Owncast sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]
}
}

55
manifest.toml Normal file
View file

@ -0,0 +1,55 @@
packaging_format = 2
id = "owncast"
name = "Owncast"
description.en = "Self-hosted live video and web chat server for use with existing broadcasting software"
description.fr = "Serveur de vidéo en direct et de chat Web auto-hébergé à utiliser avec un logiciel de diffusion"
version = "0.0.13~ynh3"
maintainers = ["eric_G"]
[upstream]
license = "MIT"
website = "https://owncast.online/"
demo = "https://watch.owncast.online/"
admindoc = "https://owncast.online/docs/"
code = "https://github.com/owncast/owncast"
[integration]
yunohost = ">= 11.1.12"
architectures = ["amd64", "armhf", "arm64"]
multi_instance = false
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
help.en = "Owncast needs to be installed in a dedicated domain or sub-domain."
help.fr = "Owncast doit être installé dans un domaine ou sous-domaine dédié."
type = "domain"
full_domain = true
[install.init_main_permission]
help.en = "If enabled, Owncast will be accessible by people who do not have an account. This can be changed later via the webadmin."
help.fr = "Si cette case est cochée, Owncast sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
type = "group"
default = "visitors"
[resources]
[resources.ports]
stream.default = 1935
stream.exposed = "TCP"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "ffmpeg"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="ffmpeg"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -10,23 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -36,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -9,60 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=3
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# 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"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -77,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
ynh_change_url_nginx_config
#=================================================
# GENERIC FINALISATION
@ -110,13 +34,6 @@ 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"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,88 +9,17 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
# Find an available port for stream
stream_port=$(ynh_find_port --port=1935)
ynh_app_setting_set --app=$app --key=stream_port --value=$stream_port
# Open the port
ynh_script_progression --message="Configuring firewall..." --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH
ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
@ -123,7 +52,7 @@ ynh_use_logrotate
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Self-hosted live video and web chat server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$stream_port"
yunohost service add $app --description="Self-hosted live video and web chat server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_stream"
#=================================================
# START SYSTEMD SERVICE
@ -134,24 +63,6 @@ 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"
sleep 20
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,17 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
#=================================================
# STANDARD REMOVE
#=================================================
@ -49,22 +38,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=2
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -73,16 +46,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $stream_port$"
then
ynh_script_progression --message="Closing port $stream_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $stream_port
fi
#=================================================
# REMOVE VARIOUS FILES
#=================================================
@ -91,16 +54,6 @@ ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,34 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -47,34 +19,15 @@ ynh_script_progression --message="Restoring the NGINX configuration..." --weight
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
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE SYSTEMD
@ -96,7 +49,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add $app --description="Self-hosted live video and web chat server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$stream_port"
yunohost service add $app --description="Self-hosted live video and web chat server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_stream"
#=================================================
# START SYSTEMD SERVICE

View file

@ -9,39 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# 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
#=================================================
@ -51,14 +24,6 @@ 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"
#=================================================
# 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
#=================================================
@ -68,12 +33,11 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH
ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
@ -83,13 +47,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SETUP SYSTEMD
#=================================================
@ -111,7 +68,7 @@ ynh_use_logrotate --non-append
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add $app --description="Self-hosted live video and web chat server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$stream_port"
yunohost service add $app --description="Self-hosted live video and web chat server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_stream"
#=================================================
# START SYSTEMD SERVICE
@ -121,13 +78,6 @@ 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"
sleep 20
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

7
tests.toml Normal file
View file

@ -0,0 +1,7 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------