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

Open PeerTube Live port

This commit is contained in:
yalh76 2021-01-13 20:59:06 +01:00
parent 58d4228035
commit 2b41d29837
8 changed files with 50 additions and 7 deletions

View file

@ -5,4 +5,6 @@ Please open your __APP__ domain: https://__DOMAIN____PATH_URL__
The admin username is: root The admin username is: root
The admin password is: __ADMIN_PASS__ The admin password is: __ADMIN_PASS__
To make PeerTube Live available, you also need to make the TCP port __RTMP_PORT__ available from internet (For example, opening the port on your ISP box if it's not automatically done).
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh

View file

@ -1,6 +1,8 @@
__APP__ was successfully removed :) __APP__ was successfully removed :)
__APP__ was successfully removed. The domain https://__DOMAIN____PATH_URL__ is free for other apps to be installed on it. The domain https://__DOMAIN____PATH_URL__ is free for other apps to be installed on it.
You should close the PeerTube Live TCP port __RTMP_PORT__ available from internet (For example, closing the port on your ISP box if it's not automatically done).
But a futher action is required from your side to completely remove the __APP__ data folder. If you have backup and plan to restore this app in the future DON'T RUN THIS COMMAND. But a futher action is required from your side to completely remove the __APP__ data folder. If you have backup and plan to restore this app in the future DON'T RUN THIS COMMAND.
And if you are going to migrate to othe server you will have to move __DATADIR__ to your new server. And if you are going to migrate to othe server you will have to move __DATADIR__ to your new server.

View file

@ -258,7 +258,7 @@ transcoding:
enabled: false enabled: false
live: live:
enabled: false enabled: true
# Limit lives duration # Limit lives duration
# Set null to disable duration limit # Set null to disable duration limit

View file

@ -21,7 +21,7 @@
"requirements": { "requirements": {
"yunohost": ">= 3.8.1" "yunohost": ">= 3.8.1"
}, },
"multi_instance": true, "multi_instance": false,
"services": [ "services": [
"nginx" "nginx"
], ],

View file

@ -68,6 +68,15 @@ ynh_script_progression --message="Finding an available port..."
port=$(ynh_find_port --port=9000) port=$(ynh_find_port --port=9000)
ynh_app_setting_set --app=$app --key=port --value=$port ynh_app_setting_set --app=$app --key=port --value=$port
# PeerTube Live port
rtmp_port=1935
ynh_port_available --port=$rtmp_port || ynh_die "Port $rtmp_port is needs to be available for this app"
ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port
# Open the port
ynh_script_progression --message="Configuring firewall..."
ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
@ -214,7 +223,7 @@ ynh_use_logrotate --logfile="$datadir/logs/peertube.log"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -261,6 +270,7 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --targ
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message" ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message"
ynh_replace_string --match_string="__ADMIN_PASS__" --replace_string="$admin_pass" --target_file="../conf/message" ynh_replace_string --match_string="__ADMIN_PASS__" --replace_string="$admin_pass" --target_file="../conf/message"
ynh_replace_string --match_string="__RTMP_PORT__" --replace_string="$rtmp_port" --target_file="../conf/message"
ynh_send_readme_to_admin --app_message="../conf/message" --recipients=$admin_email --type='install' ynh_send_readme_to_admin --app_message="../conf/message" --recipients=$admin_email --type='install'

View file

@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
db_name=$(ynh_app_setting_get --app=$app --key=psql_db) db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
db_user=$app db_user=$app
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -34,7 +35,7 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) # 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 if ynh_exec_warn_less yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service..." ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi
@ -98,6 +99,12 @@ then
ynh_exec_warn_less yunohost firewall disallow TCP $port ynh_exec_warn_less yunohost firewall disallow TCP $port
fi fi
if yunohost firewall list | grep -q "\- $rtmp_port$"
then
ynh_script_progression --message="Closing port $rtmp_port..."
ynh_exec_warn_less yunohost firewall disallow TCP $rtmp_port
fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -117,6 +124,7 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --targ
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message_remove" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message_remove"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message_remove" ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message_remove"
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="../conf/message_remove" ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="../conf/message_remove"
ynh_replace_string --match_string="__RTMP_PORT__" --replace_string="$rtmp_port" --target_file="../conf/message"
ynh_send_readme_to_admin --app_message="../conf/message_remove" --recipients=$admin_email --type='remove' ynh_send_readme_to_admin --app_message="../conf/message_remove" --recipients=$admin_email --type='remove'

View file

@ -31,6 +31,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) 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)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
db_name=$(ynh_app_setting_get --app=$app --key=psql_db) db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
db_user=$app db_user=$app
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
@ -123,6 +124,14 @@ ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# OPEN A PORT
#=================================================
ynh_script_progression --message="Configuring firewall..."
# Open the port
ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
@ -136,7 +145,7 @@ systemctl enable $app.service --quiet
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -22,6 +22,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public)
admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) admin_email=$(ynh_app_setting_get --app=$app --key=admin_email)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
db_name=$(ynh_app_setting_get --app=$app --key=psql_db) db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
@ -68,6 +69,17 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab
ynh_secure_remove --file="/etc/apt/sources.list.d/jessie-backports.list" ynh_secure_remove --file="/etc/apt/sources.list.d/jessie-backports.list"
ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list" ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list"
if [ -z "$rtmp_port" ];
then
rtmp_port=1935
ynh_port_available --port=$rtmp_port || ynh_die "Port $rtmp_port is needs to be available for this app"
ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port
# Open the port
ynh_script_progression --message="Configuring firewall..."
ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -259,7 +271,7 @@ ynh_use_logrotate --non-append
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE