mirror of
https://github.com/YunoHost-Apps/peertube_ynh.git
synced 2024-09-03 19:56:29 +02:00
v2
This commit is contained in:
parent
82d42c7782
commit
80a838b735
13 changed files with 283 additions and 224 deletions
|
@ -1,6 +0,0 @@
|
|||
SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v5.0.1/peertube-v5.0.1.tar.xz
|
||||
SOURCE_SUM=f43d36fb73b87dc1e6f86fc4d5039aba9f4619c5fff6d64669a900989bed80e2
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.xz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_EXTRACT=true
|
|
@ -1,13 +1,13 @@
|
|||
__APP__ was successfully installed :)
|
||||
|
||||
Please open your __APP__ domain: https://__DOMAIN____PATH_URL__
|
||||
Please open your __APP__ domain: https://__DOMAIN____PATH__
|
||||
|
||||
The admin username is: root
|
||||
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).
|
||||
|
||||
To enable LDAP authentication open https://__DOMAIN____PATH_URL__admin/plugins/show/peertube-plugin-auth-ldap
|
||||
To enable LDAP authentication open https://__DOMAIN____PATH__admin/plugins/show/peertube-plugin-auth-ldap
|
||||
Complete with the following informations :
|
||||
- URL: ldap://127.0.0.1
|
||||
- Insecure TLS : checked
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
__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__ 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.
|
||||
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 __DATA_DIR__ to your new server.
|
||||
|
||||
|
||||
You need to run this command to remove the data (warning all your videos will be removed):
|
||||
|
||||
rm -R __DATADIR__ -f
|
||||
rm -R __DATA_DIR__ -f
|
||||
|
||||
If you facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh
|
||||
|
|
|
@ -88,7 +88,7 @@ location ~ ^/plugins/[^/]+(/[^/]+)?/ws/ {
|
|||
# For extra performance please refer to https://github.com/denji/nginx-tuning
|
||||
##
|
||||
|
||||
root __DATADIR__;
|
||||
root __DATA_DIR__;
|
||||
# Enable compression for JS/CSS/HTML, for improved client load times.
|
||||
# It might be nice to compress JSON/XML as returned by the API, but
|
||||
# leaving that out to protect against potential BREACH attack.
|
||||
|
@ -125,14 +125,14 @@ tcp_nodelay on; # don't buffer data sent, good for small data burs
|
|||
location ~ ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|default-playlist\.jpg|default-avatar-account\.png|default-avatar-account-48x48\.png|default-avatar-video-channel\.png|default-avatar-video-channel-48x48\.png))$ {
|
||||
more_set_headers "Cache-Control : public, max-age=31536000, immutable"; # Cache 1 year
|
||||
|
||||
try_files __DATADIR__/client-overrides/$1 __FINALPATH__/client/dist/$1 @api;
|
||||
try_files __DATA_DIR__/client-overrides/$1 __INSTALL_DIR__/client/dist/$1 @api;
|
||||
}
|
||||
|
||||
# Bypass PeerTube for performance reasons. Optional.
|
||||
location ~ ^/client/(.*\.(js|css|png|svg|woff2|otf|ttf|woff|eot))$ {
|
||||
more_set_headers "Cache-Control : public, max-age=31536000, immutable"; # Cache 1 year
|
||||
|
||||
alias __FINALPATH__/client/dist/$1;
|
||||
alias __INSTALL_DIR__/client/dist/$1;
|
||||
}
|
||||
|
||||
# Bypass PeerTube for performance reasons. Optional.
|
||||
|
@ -154,7 +154,7 @@ location ~ ^/static/(thumbnails|avatars)/ {
|
|||
|
||||
rewrite ^/static/(.*)$ /$1 break;
|
||||
|
||||
root __DATADIR__;
|
||||
root __DATA_DIR__;
|
||||
|
||||
try_files $uri @api;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ location ~ ^/static/(webseed|redundancy|streaming-playlists)/ {
|
|||
rewrite ^/static/webseed/(.*)$ /videos/$1 break;
|
||||
rewrite ^/static/(.*)$ /$1 break;
|
||||
|
||||
root __DATADIR__;
|
||||
root __DATA_DIR__;
|
||||
|
||||
try_files $uri @api;
|
||||
}
|
||||
|
|
|
@ -113,20 +113,20 @@ defaults:
|
|||
|
||||
# From the project root directory
|
||||
storage:
|
||||
tmp: '__DATADIR__/tmp/' # Use to download data (imports etc), store uploaded files before processing...
|
||||
bin: '__DATADIR__/bin/'
|
||||
avatars: '__DATADIR__/avatars/'
|
||||
videos: '__DATADIR__/videos/'
|
||||
streaming_playlists: '__DATADIR__/streaming-playlists/'
|
||||
redundancy: '__DATADIR__/redundancy/'
|
||||
tmp: '__DATA_DIR__/tmp/' # Use to download data (imports etc), store uploaded files before processing...
|
||||
bin: '__DATA_DIR__/bin/'
|
||||
avatars: '__DATA_DIR__/avatars/'
|
||||
videos: '__DATA_DIR__/videos/'
|
||||
streaming_playlists: '__DATA_DIR__/streaming-playlists/'
|
||||
redundancy: '__DATA_DIR__/redundancy/'
|
||||
logs: '/var/log/__APP__/'
|
||||
previews: '__DATADIR__/previews/'
|
||||
thumbnails: '__DATADIR__/thumbnails/'
|
||||
torrents: '__DATADIR__/torrents/'
|
||||
captions: '__DATADIR__/captions/'
|
||||
cache: '__DATADIR__/cache/'
|
||||
plugins: '__DATADIR__/plugins/'
|
||||
well_known: '__DATADIR__/well-known/'
|
||||
previews: '__DATA_DIR__/previews/'
|
||||
thumbnails: '__DATA_DIR__/thumbnails/'
|
||||
torrents: '__DATA_DIR__/torrents/'
|
||||
captions: '__DATA_DIR__/captions/'
|
||||
cache: '__DATA_DIR__/cache/'
|
||||
plugins: '__DATA_DIR__/plugins/'
|
||||
well_known: '__DATA_DIR__/well-known/'
|
||||
# Overridable client files in client/dist/assets/images:
|
||||
# - logo.svg
|
||||
# - favicon.png
|
||||
|
@ -137,7 +137,7 @@ storage:
|
|||
# Could contain for example assets/images/favicon.png
|
||||
# If the file exists, peertube will serve it
|
||||
# If not, peertube will fallback to the default file
|
||||
client_overrides: '__DATADIR__/client-overrides/'
|
||||
client_overrides: '__DATA_DIR__/client-overrides/'
|
||||
|
||||
static_files:
|
||||
# Require and check user authentication when accessing private files (internal/private video files)
|
||||
|
|
|
@ -5,12 +5,12 @@ After=network.target postgresql.service redis-server.service
|
|||
[Service]
|
||||
Type=simple
|
||||
Environment=NODE_ENV=production
|
||||
Environment=NODE_CONFIG_DIR=__FINALPATH__/config
|
||||
Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
ExecStart=__YNH_NODE__ __FINALPATH__/dist/server
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/dist/server
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=__APP__
|
||||
|
|
65
manifest.toml
Normal file
65
manifest.toml
Normal file
|
@ -0,0 +1,65 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "peertube"
|
||||
name = "PeerTube"
|
||||
description.en = "Federated video streaming platform using P2P directly in the web browser"
|
||||
description.fr = "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur"
|
||||
|
||||
version = "5.0.1~ynh1"
|
||||
|
||||
maintainers = ["yalh76"]
|
||||
|
||||
[upstream]
|
||||
license = "AGPL-3.0-only"
|
||||
website = "https://joinpeertube.org/fr"
|
||||
demo = "http://peertube.cpy.re"
|
||||
admindoc = "https://docs.joinpeertube.org"
|
||||
code = "https://github.com/Chocobozzz/PeerTube"
|
||||
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
|
||||
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.0.0"
|
||||
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
|
||||
multi_instance = false
|
||||
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
||||
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "domain"
|
||||
full_domain = true
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.admin]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "user"
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.0.1/peertube-v5.0.1.tar.xz"
|
||||
sha256 = "f43d36fb73b87dc1e6f86fc4d5039aba9f4619c5fff6d64669a900989bed80e2"
|
||||
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.data_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
[[resources.apt.extras]]
|
||||
repo = "deb https://dl.yarnpkg.com/debian/ stable main"
|
||||
key = "https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
packages = "yarn"
|
||||
|
||||
[resources.database]
|
||||
type = "postgresql"
|
|
@ -5,8 +5,8 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https"
|
||||
app_dependencies="prosody"
|
||||
#REMOVEME? pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https"
|
||||
#REMOVEME? app_dependencies="prosody"
|
||||
|
||||
nodejs_version=16
|
||||
|
||||
|
|
|
@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? 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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -41,13 +41,13 @@ 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 DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
124
scripts/install
124
scripts/install
|
@ -16,48 +16,48 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
|
||||
path="/"
|
||||
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
|
||||
admin_pass=$(ynh_string_random --length=24)
|
||||
secrets_peertube=$(ynh_string_random --length=24)
|
||||
|
||||
# Define app's data directory
|
||||
datadir="/home/yunohost.app/${app}/storage"
|
||||
#REMOVEME? data_dir="/home/yunohost.app/${app}/storage"
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
#REMOVEME? ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
#REMOVEME? install_dir=/var/www/$app
|
||||
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube
|
||||
|
||||
#=================================================
|
||||
|
@ -65,16 +65,16 @@ ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube
|
|||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..."
|
||||
#REMOVEME? ynh_script_progression --message="Finding an available port..."
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
#REMOVEME? port=$(ynh_find_port --port=8095)
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
# PeerTube Live port
|
||||
rtmp_port=1935
|
||||
ynh_port_available --port=$rtmp_port || ynh_die --message="Port $rtmp_port is needs to be available for this app"
|
||||
ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port
|
||||
|
||||
# Open the port
|
||||
ynh_script_progression --message="Configuring firewall..."
|
||||
|
@ -83,33 +83,33 @@ ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
#REMOVEME? ynh_script_progression --message="Installing dependencies..."
|
||||
|
||||
ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies"
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
#REMOVEME? ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..."
|
||||
#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..."
|
||||
|
||||
db_name="peertube_${app}"
|
||||
db_user=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
#REMOVEME? db_name="peertube_${app}"
|
||||
#REMOVEME? db_user=$(ynh_sanitize_dbid --db_name=$app)
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
#REMOVEME? ynh_psql_test_if_first_run
|
||||
#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
||||
|
@ -126,13 +126,13 @@ ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
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
|
||||
|
@ -149,20 +149,20 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
|
||||
|
||||
mkdir -p $datadir
|
||||
mkdir -p $data_dir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod 750 "$data_dir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# BUILD YARN DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building Yarn dependencies..."
|
||||
#REMOVEME? ynh_script_progression --message="Building Yarn dependencies..."
|
||||
|
||||
pushd "$final_path"
|
||||
pushd "$install_dir"
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean
|
||||
|
@ -173,15 +173,15 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml"
|
||||
ynh_add_config --template="../conf/production.yaml" --destination="$install_dir/config/production.yaml"
|
||||
|
||||
chmod 400 "$final_path/config/production.yaml"
|
||||
chown $app:$app "$final_path/config/production.yaml"
|
||||
chmod 400 "$install_dir/config/production.yaml"
|
||||
chown $app:$app "$install_dir/config/production.yaml"
|
||||
|
||||
ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json"
|
||||
ynh_add_config --template="../conf/local-production.json" --destination="$install_dir/config/local-production.json"
|
||||
|
||||
chmod 600 "$final_path/config/local-production.json"
|
||||
chown $app:$app "$final_path/config/local-production.json"
|
||||
chmod 600 "$install_dir/config/local-production.json"
|
||||
chown $app:$app "$install_dir/config/local-production.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -206,8 +206,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing LDAP plugin..."
|
||||
|
||||
pushd "$final_path"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
|
||||
pushd "$install_dir"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -215,8 +215,8 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing PeerTube livechat plugin..."
|
||||
|
||||
pushd "$final_path"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat
|
||||
pushd "$install_dir"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -224,8 +224,8 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Changing PeerTube admin password..."
|
||||
|
||||
pushd "$final_path"
|
||||
echo $admin_pass | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run reset-password -- -u root
|
||||
pushd "$install_dir"
|
||||
echo $admin_pass | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run reset-password -- -u root
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -264,24 +264,24 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
#REMOVEME? ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
#REMOVEME? 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"
|
||||
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
|
|
|
@ -15,20 +15,20 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
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=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
|
||||
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
|
||||
|
||||
|
@ -64,10 +64,10 @@ ynh_remove_logrotate
|
|||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
||||
#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..."
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE REDIS DATABASE
|
||||
|
@ -79,10 +79,10 @@ ynh_redis_remove_db "$redis_db"
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
#REMOVEME? ynh_script_progression --message="Removing app main directory..."
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
#REMOVEME? ynh_secure_remove --file="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
|
@ -92,7 +92,7 @@ ynh_secure_remove --file="$final_path"
|
|||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory..."
|
||||
ynh_secure_remove --file="$datadir"
|
||||
#REMOVEME? ynh_secure_remove --file="$data_dir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -106,11 +106,11 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
#REMOVEME? ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
#REMOVEME? ynh_remove_app_dependencies
|
||||
ynh_remove_apps
|
||||
|
||||
#=================================================
|
||||
|
@ -138,10 +138,10 @@ ynh_secure_remove --file="/var/log/$app"
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
#REMOVEME? ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
|
|
|
@ -15,81 +15,81 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? 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)
|
||||
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=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
#REMOVEME? test ! -d $install_dir \
|
||||
|| ynh_die --message="There is already a directory: $install_dir "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
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"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
|
||||
mkdir -p $datadir
|
||||
mkdir -p $data_dir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod 750 "$data_dir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies"
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
|
@ -101,11 +101,11 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
||||
#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..."
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
#REMOVEME? ynh_psql_test_if_first_run
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
#REMOVEME? 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
|
||||
|
||||
#=================================================
|
||||
|
|
126
scripts/upgrade
126
scripts/upgrade
|
@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
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=db_name)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
|
||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
secrets_peertube=$(ynh_app_setting_get --app=$app --key=secrets_peertube)
|
||||
#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
#REMOVEME? secrets_peertube=$(ynh_app_setting_get --app=$app --key=secrets_peertube)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -42,17 +42,17 @@ 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)..."
|
||||
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_backup_before_upgrade
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -74,19 +74,19 @@ ynh_app_setting_delete --app=$app --key=admin_mail
|
|||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name="peertube_${app}"
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
|
||||
# If db_user doesn't exist, create it
|
||||
if [ -z "$db_user" ]; then
|
||||
db_user=$app
|
||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
fi
|
||||
|
||||
# If db_pwd doesn't exist, create it
|
||||
if [ -z "$db_pwd" ]; then
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
fi
|
||||
|
||||
# If redis_db doesn't exist, create it
|
||||
|
@ -95,10 +95,10 @@ if [ -z "$redis_db" ]; then
|
|||
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
||||
fi
|
||||
|
||||
if [ -z "$datadir" ];
|
||||
if [ -z "$data_dir" ];
|
||||
then
|
||||
datadir="/home/yunohost.app/${app}/storage"
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
data_dir="/home/yunohost.app/${app}/storage"
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
|
||||
fi
|
||||
|
||||
# Close a port
|
||||
|
@ -122,7 +122,7 @@ if [ -z "$rtmp_port" ];
|
|||
then
|
||||
rtmp_port=1935
|
||||
ynh_port_available --port=$rtmp_port || ynh_die --message="Port $rtmp_port is needs to be available for this app"
|
||||
ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port
|
||||
|
||||
# Open the port
|
||||
ynh_script_progression --message="Configuring firewall..."
|
||||
|
@ -130,15 +130,15 @@ then
|
|||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
#REMOVEME? if ynh_legacy_permissions_exists; then
|
||||
#REMOVEME? ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="api"; then
|
||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
#REMOVEME? if ! ynh_permission_exists --permission="api"; then
|
||||
#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
# Remove hook
|
||||
|
@ -146,17 +146,17 @@ ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
|
|||
yunohost tools regen-conf nginx
|
||||
|
||||
# Remove old log file
|
||||
ynh_secure_remove --file="$datadir/logs"
|
||||
#REMOVEME? ynh_secure_remove --file="$data_dir/logs"
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R $app:$app "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -167,23 +167,23 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --full_replace=1 --dest_dir="$final_path" \
|
||||
ynh_setup_source --full_replace=1 --dest_dir="$install_dir" \
|
||||
--keep="config/production.yaml config/local-production.json config/local.yaml"
|
||||
fi
|
||||
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies"
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -200,11 +200,11 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
mkdir -p $datadir
|
||||
mkdir -p $data_dir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod 750 "$data_dir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# Generate secrets if they don't exist
|
||||
|
@ -219,9 +219,9 @@ fi
|
|||
#=================================================
|
||||
# BUILD YARN DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building Yarn dependencies..."
|
||||
#REMOVEME? ynh_script_progression --message="Building Yarn dependencies..."
|
||||
|
||||
pushd "$final_path"
|
||||
pushd "$install_dir"
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean
|
||||
|
@ -232,15 +232,15 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating a config file..."
|
||||
|
||||
ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml"
|
||||
ynh_add_config --template="../conf/production.yaml" --destination="$install_dir/config/production.yaml"
|
||||
|
||||
chmod 400 "$final_path/config/production.yaml"
|
||||
chown $app:$app "$final_path/config/production.yaml"
|
||||
chmod 400 "$install_dir/config/production.yaml"
|
||||
chown $app:$app "$install_dir/config/production.yaml"
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/config/local-production.json"
|
||||
ynh_backup_if_checksum_is_different --file="$install_dir/config/local-production.json"
|
||||
|
||||
chmod 600 "$final_path/config/local-production.json"
|
||||
chown $app:$app "$final_path/config/local-production.json"
|
||||
chmod 600 "$install_dir/config/local-production.json"
|
||||
chown $app:$app "$install_dir/config/local-production.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -265,8 +265,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing LDAP plugin..."
|
||||
|
||||
pushd "$final_path"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
|
||||
pushd "$install_dir"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -274,8 +274,8 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing PeerTube livechat plugin..."
|
||||
|
||||
pushd "$final_path"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat
|
||||
pushd "$install_dir"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -284,15 +284,15 @@ popd
|
|||
|
||||
if ynh_compare_current_package_version --comparison lt --version 4.0.0~ynh1; then
|
||||
ynh_script_progression --message="Running Peertube 4.0.0 migration script..."
|
||||
pushd "$final_path"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.0.js
|
||||
pushd "$install_dir"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.0.js
|
||||
popd
|
||||
fi
|
||||
|
||||
if ynh_compare_current_package_version --comparison lt --version 4.2.0~ynh1; then
|
||||
ynh_script_progression --message="Running Peertube 4.2.0 migration script..."
|
||||
pushd "$final_path"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.2.js
|
||||
pushd "$install_dir"
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.2.js
|
||||
popd
|
||||
fi
|
||||
|
||||
|
@ -332,9 +332,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Add table
Reference in a new issue