mirror of
https://github.com/YunoHost-Apps/pytition_ynh.git
synced 2024-09-03 20:16:08 +02:00
Apply example_ynh
This commit is contained in:
parent
59cc5be2e1
commit
1c57570617
11 changed files with 82 additions and 204 deletions
|
@ -1,8 +1,3 @@
|
|||
# See here for more information
|
||||
# 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"
|
||||
|
@ -18,9 +13,11 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=CommitHash
|
||||
# 2.5.1~ynh1
|
||||
upgrade=1 from_commit=ea9cd8f526b2ac6f972c66a73b340266a1c966bc
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
|
|
|
@ -6,8 +6,8 @@ After=network.target mysql.service
|
|||
[Service]
|
||||
Type=notify
|
||||
User=__APP__
|
||||
Group=www-data
|
||||
WorkingDirectory=__FINALPATH__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
RuntimeDirectory=__APP__
|
||||
ExecStart=uwsgi --yaml __FINALPATH__/uwsgi.yaml --die-on-term
|
||||
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
"en": "Host privacy-friendly online petitions",
|
||||
"fr": "Hébergez des pétitions en ligne respectueuses de la vie privée"
|
||||
},
|
||||
"version": "2.5.1~ynh1",
|
||||
"url": "https://example.com",
|
||||
"version": "2.5.1~ynh2",
|
||||
"url": "https://pytition.org",
|
||||
"upstream": {
|
||||
"license": "BSD-3-Clause",
|
||||
"website": "https://pytition.org",
|
||||
"demo": "https://demo.pytition.org",
|
||||
"admindoc": "https://pytition.readthedocs.io/en/latest/",
|
||||
"userdoc": "",
|
||||
"code": "https://github.com/pytition/Pytition"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
|
@ -30,7 +29,7 @@
|
|||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
|
|
|
@ -5,26 +5,12 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies=(
|
||||
python3 virtualenv
|
||||
gettext libzip-dev libssl-dev
|
||||
mariadb-server default-libmysqlclient-dev
|
||||
uwsgi uwsgi-plugin-python3 python3-uwsgidecorators
|
||||
)
|
||||
pkg_dependencies="python3 virtualenv gettext libzip-dev libssl-dev mariadb-server default-libmysqlclient-dev uwsgi uwsgi-plugin-python3 python3-uwsgidecorators"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
|
||||
generate_secret_key() {
|
||||
(
|
||||
set +o nounset
|
||||
|
@ -33,3 +19,11 @@ generate_secret_key() {
|
|||
python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
|
||||
)
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -39,32 +39,19 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
# ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
# ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
|
|
|
@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
|
@ -42,6 +43,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
|
|||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
|
@ -103,16 +105,18 @@ then
|
|||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
domain="$new_domain"
|
||||
path_url="$new_path"
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# Reedit configuration files
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating app's configuration..." --weight=1
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
domain="$new_domain"
|
||||
path_url="$new_path"
|
||||
|
||||
ynh_add_config --template="../conf/config.py" --destination="$final_path/pytition/pytition/pytition/settings/config.py"
|
||||
ynh_add_config --template="../conf/uwsgi.yaml" --destination="$final_path/uwsgi.yaml"
|
||||
|
@ -124,6 +128,7 @@ ynh_add_config --template="../conf/uwsgi.yaml" --destination="$final_path/uwsgi.
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -27,8 +27,8 @@ domain=$YNH_APP_ARG_DOMAIN
|
|||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
# admin=$YNH_APP_ARG_ADMIN
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
|
@ -39,6 +39,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
|||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
|
@ -58,7 +59,7 @@ ynh_app_setting_set --app=$app --key=password --value=$password
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=3
|
||||
|
||||
ynh_install_app_dependencies "${pkg_dependencies[@]}"
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -84,10 +85,11 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
|||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
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/pytition"
|
||||
|
||||
mkdir -p "$final_path/static"
|
||||
mkdir -p "$final_path/mediaroot"
|
||||
ynh_setup_source --dest_dir="$final_path/pytition"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
|
@ -97,12 +99,14 @@ chown -R $app:www-data "$final_path"
|
|||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# ...
|
||||
# INSTALL PYTHON DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing python dependencies..." --weight=4
|
||||
|
||||
|
@ -117,42 +121,11 @@ virtualenv --python=python3 --system-site-packages "${final_path}/venv"
|
|||
python3 -m pip install -r "$final_path/pytition/requirements.txt"
|
||||
)
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating the log directory..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chmod 750 "/var/log/$app"
|
||||
chown -R $app:www-data "/var/log/$app"
|
||||
|
||||
# ### Use these lines if you need to create a directory to store "persistent files" for the application.
|
||||
# ### Usually this directory is used to store uploaded files or any file that won't be updated during
|
||||
# ### an upgrade and that won't be deleted during app removal unless "--purge" option is used.
|
||||
# ### If you're not using these lines:
|
||||
# ### - Remove the section "BACKUP THE DATA DIR" in the backup script
|
||||
# ### - Remove the section "RESTORE THE DATA DIRECTORY" in the restore script
|
||||
# ### - As well as the section "REMOVE DATA DIR" in the remove script
|
||||
|
||||
# datadir=/home/yunohost.app/$app
|
||||
# ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
# mkdir -p $datadir
|
||||
|
||||
# # FIXME: this should be managed by the core in the future
|
||||
# # Here, as a packager, you may have to tweak the ownerhsip/permissions
|
||||
# # such that the appropriate users (e.g. maybe www-data) can access
|
||||
# # files in some cases.
|
||||
# # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
||||
# # this will be treated as a security issue.
|
||||
# chmod 750 "$datadir"
|
||||
# chmod -R o-rwx "$datadir"
|
||||
# chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding configuration files..." --weight=1
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
secret_key=$(generate_secret_key)
|
||||
|
||||
config_path="$final_path/pytition/pytition/pytition/settings/config.py"
|
||||
|
@ -169,7 +142,7 @@ chmod 400 "$final_path/uwsgi.yaml"
|
|||
chown $app:$app "$final_path/uwsgi.yaml"
|
||||
|
||||
#=================================================
|
||||
# Run app configuration
|
||||
# RUN APP CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Running app configuration..." --weight=3
|
||||
|
||||
|
@ -204,8 +177,12 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chmod 750 "/var/log/$app"
|
||||
chown -R $app:www-data "/var/log/$app"
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
# TODO: ynh_use_logrotate
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
@ -222,14 +199,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Fail2Ban..." --weight=1
|
||||
|
||||
# Create a dedicated Fail2Ban config
|
||||
# TODO: ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
@ -243,14 +212,6 @@ then
|
|||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
# Only the admin can access the admin panel of the app (if the app has an admin panel)
|
||||
# ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
||||
|
||||
# Everyone can access the API part
|
||||
# We don't want to display the tile in the SSO so we put --show_tile="false"
|
||||
# And we don't want the YunoHost admin to be able to remove visitors group to this permission, so we put --protected="true"
|
||||
# ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
|
@ -21,7 +21,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
# datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -68,17 +67,6 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
|
|||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the data directory if --purge option is used
|
||||
# if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
# then
|
||||
# ynh_script_progression --message="Removing app data directory..." --weight=1
|
||||
# ynh_secure_remove --file="$datadir"
|
||||
# fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -110,12 +98,6 @@ ynh_remove_fail2ban_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..." --weight=1
|
||||
|
||||
# Remove a cron file
|
||||
# ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
# Remove a directory securely
|
||||
# ynh_secure_remove --file="/etc/$app"
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -43,13 +43,6 @@ test ! -d $final_path \
|
|||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -69,15 +62,6 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
# ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1
|
||||
|
||||
# ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
# ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
# ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
@ -86,7 +70,14 @@ chown -R $app:www-data "$final_path"
|
|||
ynh_script_progression --message="Reinstalling dependencies..." --weight=3
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies "${pkg_dependencies[@]}"
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
|
@ -108,15 +99,12 @@ systemctl enable $app.service --quiet
|
|||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
# ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
# ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
ynh_script_progression --message="Creating the log directory..." --weight=1
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chmod 750 "/var/log/$app"
|
||||
chown -R $app:www-data "/var/log/$app"
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
|
|
@ -26,13 +26,8 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
### This helper will compare the version of the currently installed app and the version of the upstream package.
|
||||
### $upgrade_type can have 2 different values
|
||||
### - UPGRADE_APP if the upstream app version has changed
|
||||
### - UPGRADE_PACKAGE if only the YunoHost package has changed
|
||||
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
|
||||
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
|
@ -43,6 +38,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
|||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
|
@ -63,24 +59,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
#
|
||||
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
|
||||
# of what you may want to do in some cases (e.g. a setting was not defined on
|
||||
# some legacy installs and you therefore want to initiaze stuff during upgrade)
|
||||
#
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
#if [ -z "$db_name" ]; then
|
||||
# db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
#if [ -z "$final_path" ]; then
|
||||
# final_path=/var/www/$app
|
||||
# ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
#fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -101,16 +79,17 @@ then
|
|||
ynh_setup_source --dest_dir="$final_path/pytition"
|
||||
fi
|
||||
|
||||
# FIXME: this should be managed by the core in the future
|
||||
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
||||
# such that the appropriate users (e.g. maybe www-data) can access
|
||||
# files in some cases.
|
||||
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
||||
# this will be treated as a security issue.
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -119,19 +98,12 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies "${pkg_dependencies[@]}"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# Upgrade virtualenv content
|
||||
# INSTALL PYTHON DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading python dependencies..." --weight=1
|
||||
ynh_script_progression --message="Installing python dependencies..." --weight=1
|
||||
|
||||
(
|
||||
set +o nounset
|
||||
|
@ -143,9 +115,10 @@ ynh_script_progression --message="Upgrading python dependencies..." --weight=1
|
|||
)
|
||||
|
||||
#=================================================
|
||||
# Update the configuration
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding configuration files..." --weight=1
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
secret_key=$(generate_secret_key)
|
||||
|
||||
config_path="$final_path/pytition/pytition/pytition/settings/config.py"
|
||||
|
@ -158,7 +131,7 @@ chmod 400 "$final_path/uwsgi.yaml"
|
|||
chown $app:$app "$final_path/uwsgi.yaml"
|
||||
|
||||
#=================================================
|
||||
# Run app configuration
|
||||
# RUN APP CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Running app configuration..." --weight=1
|
||||
|
||||
|
@ -188,10 +161,10 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
# ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||
|
||||
# # Use logrotate to manage app-specific logfile(s)
|
||||
# ynh_use_logrotate --non-append
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
@ -207,14 +180,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
#=================================================
|
||||
# ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1
|
||||
|
||||
# # Create a dedicated Fail2Ban config
|
||||
# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue