mirror of
https://github.com/YunoHost-Apps/yunorunner_ynh.git
synced 2024-09-03 20:36:13 +02:00
commit
dbfe7eb90a
8 changed files with 223 additions and 72 deletions
41
README.md
41
README.md
|
@ -1,7 +1,7 @@
|
|||
# YunoRunner for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/APP.svg)](https://dash.yunohost.org/appci/app/yunorunner)
|
||||
[![Install YunoRunner with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=yunorunner)
|
||||
[![Integration level](https://dash.yunohost.org/integration/yunorunner.svg)](https://dash.yunohost.org/appci/app/yunorunner)
|
||||
[![Install yunorunner with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=yunorunner)
|
||||
|
||||
> *This package allow you to install YunoRunner quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
|
@ -11,17 +11,44 @@ YunoRunner is our own CI runner for YunoHost Apps
|
|||
|
||||
**Shipped version:** Work in progress...
|
||||
|
||||
## Screenshots
|
||||
|
||||
![](https://user-images.githubusercontent.com/30271971/52810447-e06b5600-3092-11e9-9853-fb46e46fda65.PNG)
|
||||
|
||||
## Demo
|
||||
|
||||
* [Official demo](https://ci-apps.yunohost.org)
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/APP%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/yunorunner%20(Community)/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/APP%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/yunorunner%20(Community)%20(%7EARM%7E)/)
|
||||
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/jenkins/job/leed%20(Community)/badge/icon)](https://ci-stretch.nohost.me/jenkins/job/yunorunner%20(Community)/)
|
||||
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/yunorunner%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/yunorunner/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/yunorunner%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/yunorunner/)
|
||||
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/yunorunner%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/yunorunner/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* You need to install [CI_package_check](https://github.com/YunoHost/CI_package_check) before YunoRunner and modify the systemd script to add the path of the script analyseCI.sh.
|
||||
* You need to install [CI_package_check](https://github.com/YunoHost/CI_package_check) using the build_CI.sh script before installing YunoRunner
|
||||
* When YunoRunner is installed, modify the systemd script to add the path of the script analyseCI.sh. The default systemd is configured to /home/CI_package_check/analyseCI.sh
|
||||
|
||||
## Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/yunorunner_ynh/issues
|
||||
* Report a bug: https://github.com/YunoHost-Apps/yunorunner_ynh_core/issues
|
||||
* App website: https://github.com/YunoHost/yunorunner
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
Developers info
|
||||
----------------
|
||||
|
||||
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/yunorunner_ynh_core/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/yunorunner_ynh_core/issues/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade yunorunner -u https://github.com/YunoHost-Apps/yunorunner_ynh_core/tree/testing --debug
|
||||
```
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"id": "yunorunner",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "CI runner for YunoHost"
|
||||
"en": "CI runner for YunoHost",
|
||||
"fr": "Runner d'intégration continue pour YunoHost"
|
||||
},
|
||||
"version": "010219~ynh1",
|
||||
"url": "https://github.com/YunoHost/yunorunner",
|
||||
|
@ -28,7 +29,7 @@
|
|||
"en": "Choose a domain for YunoRunner",
|
||||
"fr": "Choisissez un domaine pour YunoRunner"
|
||||
},
|
||||
"example": "domain.org"
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
|
|
|
@ -19,6 +19,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -28,14 +29,16 @@ domain=$(ynh_app_setting_get $app domain)
|
|||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
#=================================================
|
||||
# BACKUP OF THE MAIN DIR OF THE APP
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the main app directory..."
|
||||
|
||||
ynh_backup "$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE NGINX CONFIGURATION
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Backing up nginx configuration..."
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
@ -44,6 +47,12 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Backing up systemd configuration..."
|
||||
|
||||
ynh_backup "/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -24,6 +24,10 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
port=$(ynh_app_setting_get $app port)
|
||||
|
||||
|
@ -72,6 +76,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_print_info "Updating nginx configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
|
@ -108,6 +113,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx..."
|
||||
|
||||
ynh_system_reload --service_name=nginx
|
||||
|
||||
|
@ -118,3 +124,9 @@ ynh_system_reload --service_name=nginx
|
|||
path_url=$old_path
|
||||
domain=$old_domain
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Change of url completed for $app"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,15 +10,15 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE FAILURE OF THE SCRIPT
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# ynh_clean_setup () {
|
||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||
# Pas de nettoyage supplémentaire nécessaire ici...
|
||||
# echo ""
|
||||
# }
|
||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||
ynh_clean_setup () {
|
||||
### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
|
@ -32,6 +32,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_print_info "Validating installation parameters..."
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
@ -39,14 +40,13 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
|||
# Normalize the url path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available $domain $path_url
|
||||
# Register (book) web path
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_print_info "Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path $path_url
|
||||
|
@ -56,36 +56,46 @@ ynh_app_setting_set $app path $path_url
|
|||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_print_info "Configuring firewall..."
|
||||
|
||||
# Find a free port
|
||||
port=$(ynh_find_port 4242)
|
||||
# Ouvre le port dans le firewall
|
||||
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
|
||||
# Open this port
|
||||
#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
ynh_app_setting_set $app port $port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Installing dependencies..."
|
||||
|
||||
ynh_install_app_dependencies python-virtualenv sqlite3 libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Setting up source files..."
|
||||
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Configuring nginx..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
|
||||
ynh_system_user_create $app # Créer un utilisateur système dédié à l'app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -113,14 +123,20 @@ $final_path/.pythonz/bin/pythonz install 3.6.6
|
|||
# INSTALL YUNORUNNER DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
( cd $final_path
|
||||
pushd $final_path
|
||||
virtualenv -p $($final_path/.pythonz/bin/pythonz locate 3.6.6) ve3
|
||||
ve3/bin/pip3 install -r requirements.txt )
|
||||
ve3/bin/pip3 install -r requirements.txt
|
||||
#Fix current websocket version error (2019-02-14)
|
||||
ve3/bin/pip3 uninstall -y websockets
|
||||
ve3/bin/pip3 install 'websockets>=6.0,<7.0'
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Configuring a systemd service..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
|
@ -128,6 +144,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
|
||||
ynh_replace_string "__PORT__" "$port" "/etc/systemd/system/$app.service"
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "/etc/systemd/system/$app.service"
|
||||
systemctl daemon-reload
|
||||
|
||||
|
@ -137,17 +154,19 @@ systemctl daemon-reload
|
|||
# SECURING FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R $app:root $final_path
|
||||
|
||||
#=================================================
|
||||
# ENABLE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app.service
|
||||
yunohost service add $app --description "$app daemon for YunoRunner"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info "Configuring SSOwat..."
|
||||
|
||||
# Make app public
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
|
@ -155,6 +174,7 @@ ynh_app_setting_set $app skipped_uris "/"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx..."
|
||||
|
||||
ynh_system_reload --service_name=nginx
|
||||
|
||||
|
@ -163,3 +183,9 @@ ynh_system_reload --service_name=nginx
|
|||
#=================================================
|
||||
|
||||
ynh_system_reload --service_name=$app --action=start
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Installation of $app completed"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -12,47 +12,59 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
port=$(ynh_app_setting_get $app port)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
if yunohost service status | grep -q $app
|
||||
then
|
||||
ynh_print_info "Removing $app service"
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_print_info "Stopping and removing the service"
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# DISABLE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
|
||||
then
|
||||
ynh_print_info "Remove $app service" >&2
|
||||
yunohost service remove $app.service
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Removing dependencies"
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MAIN DIR OF THE APP
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Removing app main directory"
|
||||
|
||||
ynh_secure_remove "/var/www/$app" # Suppression du dossier de l'application
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove "$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE NGINX CONFIGURATION
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing nginx configuration"
|
||||
|
||||
ynh_remove_nginx_config # Suppression de la configuration nginx
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
|
@ -60,8 +72,8 @@ ynh_remove_nginx_config # Suppression de la configuration nginx
|
|||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_print_info "Close port $port" >&2
|
||||
ynh_exec_quiet yunohost firewall disallow TCP $port
|
||||
ynh_print_info "Closing port $port"
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -69,5 +81,13 @@ fi
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Removing the dedicated system user"
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete $app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Removal of $app completed"
|
||||
|
|
|
@ -19,6 +19,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -29,6 +30,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_print_info "Validating restoration parameters..."
|
||||
|
||||
ynh_webpath_available $domain $path_url \
|
||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
|
@ -42,29 +44,33 @@ test ! -d $final_path \
|
|||
ynh_maintenance_mode_ON
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORE STEPS
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE OF THE NGINX CONFIGURATION
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF THE MAIN DIR OF THE APP
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Restore the app main directory..."
|
||||
|
||||
ynh_restore_file "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE OF THE DEDICATED USER
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Recreate the dedicated systen user..."
|
||||
|
||||
ynh_system_user_create $app # Recreate the dedicated user, if not exist
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app:root $final_path
|
||||
|
||||
#=================================================
|
||||
|
@ -72,28 +78,32 @@ chown -R $app:root $final_path
|
|||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Reinstall dependencies..."
|
||||
|
||||
ynh_install_app_dependencies python-virtualenv sqlite3 zlib1g-dev
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies python-virtualenv sqlite3 libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev
|
||||
|
||||
#=================================================
|
||||
# ENABLE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app.service
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Restoring the systemd configuration..."
|
||||
|
||||
ynh_restore_file "/etc/systemd/system/$app.service"
|
||||
## Démarrage auto du service
|
||||
systemctl enable $app.service
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --description "$app daemon for YunoRunner"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx"
|
||||
|
||||
ynh_system_reload --service_name=nginx
|
||||
|
||||
|
@ -108,3 +118,9 @@ ynh_system_reload --service_name=$app --action=start
|
|||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Restoration completed for $app"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -29,6 +30,7 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_print_info "Ensuring downward compatibility..."
|
||||
|
||||
# If port doesn't exist, create it
|
||||
if [ -z "$port" ]; then
|
||||
|
@ -36,9 +38,20 @@ if [ -z "$port" ]; then
|
|||
ynh_app_setting_set $app port $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_print_info "Closing port $port"
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the app before upgrading... (may take a while)"
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -53,7 +66,8 @@ ynh_abort_if_errors
|
|||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path.
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
|
@ -66,29 +80,38 @@ ynh_maintenance_mode_ON
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading source files..."
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_install_app_dependencies python-virtualenv sqlite3 zlib1g-dev
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading nginx configuration..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies python-virtualenv sqlite3 zlib1g-dev
|
||||
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
ynh_system_user_create $app # Create the dedicated user, if not exist
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -108,17 +131,27 @@ ynh_store_file_checksum "/etc/systemd/system/$app.service"
|
|||
systemctl daemon-reload
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
# Fix current websocket version error (2019-02-14)
|
||||
#=================================================
|
||||
|
||||
pushd $final_path
|
||||
ve3/bin/pip3 uninstall -y websockets
|
||||
ve3/bin/pip3 install 'websockets>=6.0,<7.0'
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app:root $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading SSOwat configuration..."
|
||||
|
||||
# Make app public
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
|
@ -126,6 +159,7 @@ ynh_app_setting_set $app skipped_uris "/"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx..."
|
||||
|
||||
ynh_system_reload --service_name=nginx
|
||||
|
||||
|
@ -141,3 +175,9 @@ ynh_system_reload --service_name=$app --action=restart
|
|||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Upgrade of $app completed"
|
||||
|
|
Loading…
Reference in a new issue