mirror of
https://github.com/YunoHost-Apps/peertube_ynh.git
synced 2024-09-03 19:56:29 +02:00
Merge pull request #241 from YunoHost-Apps/ovh_fix_testing
Ovh Upgrade v3.2.1
This commit is contained in:
commit
dd607e1ec0
17 changed files with 157 additions and 183 deletions
|
@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide
|
|||
1. *Read this whole template first.*
|
||||
2. *Determine if you are on the right place:*
|
||||
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||
- *Otherwise, the issue may be due to PeerTube itself. Refer to its documentation or repository for help.*
|
||||
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
|
||||
- *When in doubt, post here and we will figure it out together.*
|
||||
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||
---
|
||||
|
@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide
|
|||
|
||||
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
||||
```sh
|
||||
sudo yunohost app install peertube
|
||||
sudo yunohost app install the_app
|
||||
```
|
||||
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
||||
- *If the error occurs in your browser, explain what you did:*
|
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
## Problem
|
||||
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
|
||||
- [ ] Code finished and ready to be reviewed/tested
|
||||
- [ ] The fix/enhancement were manually tested (if applicable)
|
||||
|
||||
## Automatic tests
|
||||
|
||||
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
|
|
@ -1,8 +1,3 @@
|
|||
# See here for more informations
|
||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||
|
||||
# Move this file from check_process.default to check_process when you have filled it.
|
||||
|
||||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
|
@ -29,6 +24,12 @@
|
|||
upgrade=1 from_commit=10d79175a8a45137d271931cbd6d14e927400729
|
||||
# 3.0.1~ynh1
|
||||
upgrade=1 from_commit=5a74f4033eafa657fcd32a9713cd77ba0f4f79c9
|
||||
# 3.1.0~ynh2
|
||||
upgrade=1 from_commit=1be4caaaf2787e614cd315ca8564573d4268032a
|
||||
# 3.1.0~ynh5
|
||||
upgrade=1 from_commit=343f2b80e0f3bddc87ad8ed143411a0920c21150
|
||||
# 3.2.1~ynh6
|
||||
upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
|
@ -49,4 +50,10 @@ Notification=yes
|
|||
name=2.4.0~ynh1
|
||||
; commit=5a74f4033eafa657fcd32a9713cd77ba0f4f79c9
|
||||
name=3.0.1~ynh1
|
||||
|
||||
; commit=1be4caaaf2787e614cd315ca8564573d4268032a
|
||||
name=3.1.0~ynh2
|
||||
; commit=343f2b80e0f3bddc87ad8ed143411a0920c21150
|
||||
name=3.1.0~ynh5
|
||||
; commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf
|
||||
name=3.2.1~ynh6
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v3.1.0/peertube-v3.1.0.tar.xz
|
||||
SOURCE_SUM=94b4ac2e5dd880039b999e6891e96246b9655070c5d08aedbdc0926ecad1bfa5
|
||||
SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v3.2.1/peertube-v3.2.1.tar.xz
|
||||
SOURCE_SUM=2c8fb6c3796d50155e7c2d9533875b034a0aa3513188bf6281f4686e0d33c639
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.xz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -19,6 +19,12 @@ location @api {
|
|||
proxy_pass http://127.0.0.1:__PORT__;
|
||||
}
|
||||
|
||||
location = /api/v1/videos/upload-resumable {
|
||||
client_max_body_size 0;
|
||||
proxy_request_buffering off;
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location / {
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
|
|
|
@ -8,8 +8,7 @@ Environment=NODE_ENV=production
|
|||
Environment=NODE_CONFIG_DIR=__FINALPATH__/config
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
ExecStart=/bin/sh -c ' npm start'
|
||||
ExecStart=__YNH_NODE__ __FINALPATH__/dist/server
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Video streaming platform using P2P directly in the web browser, connected to a federated network",
|
||||
"fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé"
|
||||
},
|
||||
"version": "3.1.0~ynh1",
|
||||
"version": "3.2.1~ynh1",
|
||||
"url": "https://github.com/Chocobozzz/PeerTube",
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": [
|
||||
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
],
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7.3"
|
||||
"yunohost": ">= 4.2.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
|
@ -30,28 +30,16 @@
|
|||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain name for PeerTube",
|
||||
"fr": "Choisissez un nom de domaine pour PeerTube"
|
||||
},
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose an admin user",
|
||||
"fr": "Choisissez l'administrateur"
|
||||
},
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?",
|
||||
"fr": "Est-ce une application publique ?"
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
## Problem
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
- [ ] Code finished.
|
||||
- [ ] Tested with Package_check.
|
||||
- [ ] Fix or enhancement tested.
|
||||
- [ ] Upgrade from last version tested.
|
||||
- [ ] Can be reviewed and tested.
|
||||
|
||||
## Package_check results
|
||||
---
|
||||
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
|
|
@ -7,7 +7,7 @@
|
|||
# dependencies used by the app
|
||||
pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ redis-server redis-tools mailutils apt-transport-https"
|
||||
|
||||
YNH_NODEJS_VERSION=14
|
||||
NODEJS_VERSION=14
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -63,13 +63,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
|||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIRECTORY
|
||||
#=================================================
|
||||
|
@ -77,6 +70,13 @@ ynh_print_info --message="Backing up data directory..."
|
|||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -82,7 +82,7 @@ ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
|
|||
ynh_script_progression --message="Installing dependencies..."
|
||||
|
||||
# Install nodejs
|
||||
#ynh_install_nodejs --nodejs_version=10
|
||||
#ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
|
||||
# Install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
@ -97,6 +97,14 @@ fi
|
|||
# Install Yarn
|
||||
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..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
@ -122,22 +130,18 @@ 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"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config "datadir"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -148,37 +152,42 @@ ynh_script_progression --message="Creating the data directory..."
|
|||
# Create app folders
|
||||
mkdir -p "$datadir"
|
||||
|
||||
# Give permission to the datadir
|
||||
chown -R "$app":"$app" "$datadir"
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..."
|
||||
|
||||
ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml"
|
||||
|
||||
ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json"
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# BUILD YARN DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building Yarn dependencies..."
|
||||
|
||||
chown -R "$app":"$app" $final_path
|
||||
|
||||
pushd "$final_path"
|
||||
ynh_use_nodejs
|
||||
#ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a config file..."
|
||||
|
||||
ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml"
|
||||
|
||||
chmod 400 "$final_path/config/production.yaml"
|
||||
chown $app:$app "$final_path/config/production.yaml"
|
||||
|
||||
ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json"
|
||||
|
||||
chmod 600 "$final_path/config/local-production.json"
|
||||
chown $app:$app "$final_path/config/local-production.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --others_var="ynh_node_load_PATH"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -216,14 +225,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
|||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Securing files and directories..."
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R $app:$app $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
@ -237,7 +238,7 @@ ynh_use_logrotate --logfile="$datadir/logs/peertube.log"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
|
||||
yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -274,7 +275,6 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
#=================================================
|
||||
ynh_script_progression --message="Sending a readme for the admin..."
|
||||
|
||||
ynh_add_config --template="../conf/message_install" --destination="../conf/msg_install"
|
||||
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install'
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -34,7 +34,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
# 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
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
|
@ -79,7 +79,7 @@ ynh_secure_remove --file="$final_path"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
|
@ -121,7 +121,6 @@ ynh_system_user_delete --username=$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Sending a readme for the admin..."
|
||||
|
||||
ynh_add_config --template="../conf/message_remove" --destination="../conf/msg_remove"
|
||||
ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove'
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -23,7 +23,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..."
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -52,10 +52,18 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
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..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -63,21 +71,9 @@ ynh_script_progression --message="Restoring the app main directory..."
|
|||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring user rights..."
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app:$app $final_path
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
|
@ -91,8 +87,17 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory
|
|||
|
||||
mkdir -p "$datadir"
|
||||
|
||||
# Give permission to the datadir
|
||||
chown -R "$app":"$app" "$datadir"
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring firewall..."
|
||||
|
||||
# Open the port
|
||||
ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
|
@ -100,7 +105,7 @@ chown -R "$app":"$app" "$datadir"
|
|||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
# Install nodejs
|
||||
ynh_install_nodejs --nodejs_version=$YNH_NODEJS_VERSION
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
|
||||
# Install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
@ -124,14 +129,6 @@ ynh_psql_test_if_first_run
|
|||
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
|
||||
|
||||
#=================================================
|
||||
# OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring firewall..."
|
||||
|
||||
# Open the port
|
||||
ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
@ -145,7 +142,7 @@ systemctl enable $app.service --quiet
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
|
||||
yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -76,6 +76,9 @@ 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/yarn.list"
|
||||
|
||||
# Remove not needed checksum
|
||||
ynh_delete_file_checksum --file="../conf/msg_install"
|
||||
|
||||
if [ -z "$rtmp_port" ];
|
||||
then
|
||||
rtmp_port=1935
|
||||
|
@ -104,19 +107,11 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Inform the backup/restore process that it should not save the data directory
|
||||
# Use only for the previous backup script that doesn't set 'is_big'
|
||||
ynh_app_setting_set --app=$app --key=backup_core_only --value=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
||||
# Remove the option backup_core_only after the backup.
|
||||
ynh_app_setting_delete --app=$app --key=backup_core_only
|
||||
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -131,6 +126,14 @@ ynh_script_progression --message="Stopping a systemd service..."
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -143,10 +146,10 @@ then
|
|||
tmpdir="$(mktemp -d)"
|
||||
|
||||
# Backup the config file in the temp dir
|
||||
cp -a "$final_path/config/production.yaml" "$tmpdir/production.yaml"
|
||||
cp -af "$final_path/config/production.yaml" "$tmpdir/production.yaml"
|
||||
if [ -s "$final_path/config/local-production.json" ]
|
||||
then
|
||||
cp -a "$final_path/config/local-production.json" "$tmpdir/local-production.json"
|
||||
cp -af "$final_path/config/local-production.json" "$tmpdir/local-production.json"
|
||||
fi
|
||||
|
||||
# Remove the app directory securely
|
||||
|
@ -156,11 +159,11 @@ then
|
|||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
#Copy the admin saved settings from tmp directory to final path
|
||||
cp -a "$tmpdir/production.yaml" "$final_path/config/production.yaml"
|
||||
cp -af "$tmpdir/production.yaml" "$final_path/config/production.yaml"
|
||||
|
||||
if [ -s "$tmpdir/local-production.json" ]
|
||||
then
|
||||
cp -a "$tmpdir/local-production.json" "$final_path/config/local-production.json"
|
||||
cp -af "$tmpdir/local-production.json" "$final_path/config/local-production.json"
|
||||
else
|
||||
cp ../conf/local-production.json "$final_path/config/local-production.json"
|
||||
fi
|
||||
|
@ -169,12 +172,16 @@ then
|
|||
ynh_secure_remove --file="$tmpdir"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config "datadir"
|
||||
|
||||
#=================================================
|
||||
|
@ -183,7 +190,7 @@ ynh_add_nginx_config "datadir"
|
|||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
# Install nodejs
|
||||
#ynh_install_nodejs --nodejs_version=10
|
||||
#ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
|
||||
# Install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
@ -202,14 +209,6 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
|
|||
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
|
||||
yunohost tools regen-conf nginx
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
|
@ -217,33 +216,31 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Creating the data directory..."
|
||||
|
||||
if [ ! -d "$datadir" ]
|
||||
then
|
||||
# Create app folders
|
||||
mkdir -p "$datadir"
|
||||
fi
|
||||
# Create app folders
|
||||
mkdir -p "$datadir"
|
||||
|
||||
# Give permission to the datadir
|
||||
chown -R "$app":"$app" "$datadir"
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..."
|
||||
ynh_script_progression --message="Updating a config file..."
|
||||
|
||||
ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml"
|
||||
|
||||
local_config="$final_path/config/local-production.json"
|
||||
ynh_backup_if_checksum_is_different --file="$local_config"
|
||||
ynh_store_file_checksum --file="$local_config"
|
||||
chmod 400 "$final_path/config/production.yaml"
|
||||
chown $app:$app "$final_path/config/production.yaml"
|
||||
|
||||
chmod 600 "$final_path/config/local-production.json"
|
||||
chown $app:$app "$final_path/config/local-production.json"
|
||||
|
||||
#=================================================
|
||||
# BUILD YARN DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building Yarn dependencies..."
|
||||
|
||||
chown -R "$app":"$app" $final_path
|
||||
|
||||
pushd "$final_path"
|
||||
ynh_use_nodejs
|
||||
#ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
|
||||
|
@ -264,18 +261,10 @@ popd
|
|||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --others_var="ynh_node_load_PATH"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Securing files and directories..."
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app:$app $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
@ -289,7 +278,7 @@ ynh_use_logrotate --non-append
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
|
||||
yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||
# example: "root admin@domain user1 user2"
|
||||
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
|
||||
#
|
||||
# Requires YunoHost version 4.1.0 or higher.
|
||||
ynh_send_readme_to_admin() {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
|
||||
|
@ -68,21 +70,15 @@ ynh_send_readme_to_admin() {
|
|||
mail_subject="$mail_subject has just been installed!"
|
||||
fi
|
||||
|
||||
ynh_add_config --template="$app_message" --destination="../conf/msg__to_send"
|
||||
|
||||
ynh_delete_file_checksum --file="../conf/msg__to_send"
|
||||
|
||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||
|
||||
Specific information for the application $app.
|
||||
|
||||
$(if [ -n "$app_message" ]
|
||||
then
|
||||
cat "$app_message"
|
||||
else
|
||||
echo "...No specific information..."
|
||||
fi)
|
||||
|
||||
---
|
||||
Automatic diagnosis data from YunoHost
|
||||
|
||||
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
|
||||
$(cat "../conf/msg__to_send")"
|
||||
|
||||
# Store the message into a file for further modifications.
|
||||
echo "$mail_message" > mail_to_send
|
||||
|
@ -103,10 +99,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
|||
# Insert url links tags
|
||||
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
||||
|
||||
# Insert pre tags
|
||||
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
|
||||
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
|
||||
|
||||
# Insert finishing HTML tags
|
||||
echo -e "\n</body>\n</html>" >> mail_to_send
|
||||
|
||||
|
@ -115,9 +107,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
|||
# Remove URL tags
|
||||
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
|
||||
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
|
||||
|
||||
# Remove PRE tags
|
||||
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
|
||||
fi
|
||||
|
||||
# Define binary to use for mail command
|
||||
|
|
Loading…
Add table
Reference in a new issue