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

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 01:12:59 +02:00 committed by Alexandre Aubin
parent 51bfdf4165
commit 7e8f421990
12 changed files with 159 additions and 236 deletions

View file

@ -8,8 +8,8 @@ User=__APP__
Group=__APP__
WorkingDirectory=__INSTALL_DIR__/
Environment="NODE_ENV=production"
Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=__YNH_NPM__ start
Environment="PATH=__PATH_WITH_NODEJS__"
ExecStart=__NODEJS_DIR__/npm start
StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit

View file

@ -18,7 +18,8 @@ userdoc = "https://www.getoutline.com/about"
code = "https://github.com/outline/outline"
[integration]
yunohost = ">= 11.2.14"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all"
multi_instance = false
ldap = false

View file

@ -1,24 +1,12 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
NODEJS_VERSION=18
#=================================================
# PERSONAL HELPERS
#=================================================
nodejs_version=18
# FIXME : to be replaced in the future by ynh_string_random(hex)
ynh_hex_32_random() {
echo "$(tr -dc 'A-F0-9' < /dev/urandom | head -c64)"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,44 +1,35 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# 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
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP LOCAL STORAGE
#=================================================
ynh_backup --src_path="/var/lib/outline"
ynh_backup "/var/lib/outline"
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/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"
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
@ -46,35 +37,35 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP THE CRON FILE
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"
ynh_backup "/etc/cron.d/$app"
#=================================================
# BACKUP LOGS
#=================================================
ynh_backup --src_path="/var/log/$app/$app.log"
ynh_backup "/var/log/$app/$app.log"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# BACKUP THE POSTGRESQL DATABASE
#=================================================
ynh_print_info --message="Backing up the PostgreSQL database..."
ynh_print_info "Backing up the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql
ynh_psql_dump_db > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,67 +1,56 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_systemctl --service=$app --action="stop" --log_path="systemd"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config
ynh_config_change_url_nginx
#=================================================
# UPDATING A CONFIGURATION
#=================================================
ynh_script_progression --message="Updating the configuration file..." --weight=1
ynh_script_progression "Updating the configuration file..."
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
ynh_config_add --template=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env"
#=================================================
# RUN DB MIGRATION
#=================================================
ynh_script_progression --message="Running DB initial migration..." --weight=3
ynh_script_progression "Running DB initial migration..."
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn db:migrate
popd
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemctl --service=$app --action="start" --log_path="systemd"
#=================================================
# SLACK WARNING
#=================================================
ynh_print_info --message="Don't forget to add a new redirction url in your Slack app settings !"
ynh_print_info "Don't forget to add a new redirction url in your Slack app settings !"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last
ynh_script_progression "Change of URL completed for $app"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -19,7 +13,7 @@ secret_key=$(ynh_hex_32_random)
#=================================================
# INSTALL DEX APP FOR OAUTH2 / OIDC
#=================================================
ynh_script_progression --message="Installing Dex..." --weight=18
ynh_script_progression "Installing Dex..."
oidc_secret=$(ynh_hex_32_random)
oidc_name="Outline"
@ -42,51 +36,52 @@ then
else
dex_auth_uri="https://$dex_domain$dex_path/auth"
dex_token_uri="https://$dex_domain$dex_path/token"
dex_user_uri="https://$dex_domain$dex_path/userinfo"
dex_user_uri="https://$dex_domain$dex_path/userinfo"
fi
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_script_progression "Storing installation settings..."
ynh_app_setting_set --app=$app --key=utils_secret --value=$utils_secret
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
ynh_app_setting_set --app=$app --key=dex_app --value=$dex_app
ynh_app_setting_set --app=$app --key=oidc_name --value=$oidc_name
ynh_app_setting_set --app=$app --key=oidc_secret --value=$oidc_secret
ynh_app_setting_set --app=$app --key=oidc_callback --value=$oidc_callback
ynh_app_setting_set --app=$app --key=dex_auth_uri --value=$dex_auth_uri
ynh_app_setting_set --app=$app --key=dex_token_uri --value=$dex_token_uri
ynh_app_setting_set --app=$app --key=dex_user_uri --value=$dex_user_uri
ynh_app_setting_set --key=utils_secret --value=$utils_secret
ynh_app_setting_set --key=secret_key --value=$secret_key
ynh_app_setting_set --key=dex_app --value=$dex_app
ynh_app_setting_set --key=oidc_name --value=$oidc_name
ynh_app_setting_set --key=oidc_secret --value=$oidc_secret
ynh_app_setting_set --key=oidc_callback --value=$oidc_callback
ynh_app_setting_set --key=dex_auth_uri --value=$dex_auth_uri
ynh_app_setting_set --key=dex_token_uri --value=$dex_token_uri
ynh_app_setting_set --key=dex_user_uri --value=$dex_user_uri
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_script_progression "Installing dependencies..."
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1
ynh_nodejs_install 2>&1
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
ynh_script_progression "Creating a PostgreSQL database..."
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
ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS unaccent;"
ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# SETUP LOCAL STORAGE
#=================================================
@ -97,66 +92,66 @@ chown -R $app:www-data "/var/lib/$app"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_script_progression "Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_config_add_systemd
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
ynh_config_add_logrotate
cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/outline.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
ynh_config_add --template="outline.cron" --destination="$cron_path"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "$cron_path"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "$cron_path"
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
#=================================================
# BUILD YARN DEPENDENCIES
#=================================================
ynh_script_progression --message="Building $app. This can be very long, be patient !" --weight=18
ynh_script_progression "Building $app. This can be very long, be patient !"
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000 2>&1
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3200" yarn build 2>&1
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000 2>&1
ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_OPTIONS="--max-old-space-size=3200" yarn build 2>&1
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn cache clean 2>&1
popd
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression "Adding $app's configuration..."
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
ynh_config_add --template=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env"
#=================================================
# RUN DB MIGRATION
#=================================================
ynh_script_progression --message="Running DB initial migration..." --weight=3
ynh_script_progression "Running DB initial migration..."
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn db:migrate
popd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemctl --service=$app --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -16,32 +10,32 @@ source /usr/share/yunohost/helpers
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
if ynh_hide_warnings yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
ynh_script_progression "Removing $app service integration..."
yunohost service remove $app
fi
# Remove the dedicated systemd config
ynh_remove_systemd_config
ynh_config_remove_systemd
# Remove the app-specific logrotate config
ynh_remove_logrotate
ynh_config_remove_logrotate
ynh_remove_nodejs
ynh_nodejs_remove
yunohost app remove $dex_app
ynh_secure_remove --file="/var/lib/outline"
ynh_safe_rm "/var/lib/outline"
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
ynh_safe_rm "/etc/cron.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# 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
@ -13,7 +7,7 @@ source /usr/share/yunohost/helpers
#=================================================
# CHECK IF DEX IS INSTALLED, IF NOT INSTALL IT
#=================================================
ynh_script_progression --message="Installing Dex if needed..." --weight=18
ynh_script_progression "Installing Dex if needed..."
if ! yunohost app list | grep -q "id: $dex_app"; then
echo "Dex is not installed. Installing... "
@ -27,19 +21,18 @@ fi
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_restore "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE LOCAL STORAGE
#=================================================
ynh_script_progression --message="Restoring the app local storage..." --weight=1
ynh_script_progression "Restoring the app local storage..."
ynh_restore_file --origin_path="/var/lib/outline"
ynh_restore "/var/lib/outline"
chmod -R o-rwx "/var/lib/outline"
chown -R $app:www-data "/var/lib/outline"
@ -47,54 +40,54 @@ chown -R $app:www-data "/var/lib/outline"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
ynh_script_progression "Restoring the PostgreSQL database..."
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_psql_db_shell < "./db.sql""
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_script_progression "Reinstalling dependencies..."
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1
ynh_nodejs_install 2>&1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
ynh_restore "/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore "/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/var/log/$app/$app.log"
ynh_restore "/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/cron.d/$app"
ynh_restore "/etc/cron.d/$app"
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
#=================================================
# UPDATING A CONFIGURATION
#=================================================
ynh_script_progression --message="Updating the configuration file..." --weight=1
ynh_script_progression "Updating the configuration file..."
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
ynh_config_add --template=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemctl --service=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression "Restoration completed for $app"

View file

@ -1,75 +1,63 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_systemctl --service=$app --action="stop" --log_path="systemd"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
ynh_setup_source --dest_dir="$install_dir" --full_replace
fi
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=======================================================
# MIGRATE MINIO BUCKET IF UPGRADING FROM AN OLD VERSION
#=======================================================
ynh_script_progression --message="Checking if a migration is needed"
if ynh_compare_current_package_version --comparison le --version 0.69.2.2~ynh1
ynh_script_progression "Checking if a migration is needed"
if ynh_app_upgrading_from_version_before_or_equal_to 0.69.2.2~ynh1
then
ynh_script_progression --message="Migrating MinIO data to local directory"
ynh_script_progression "Migrating MinIO data to local directory"
mkdir -p "/var/lib/$app/data"
chown -R minio:www-data "/var/lib/$app"
ynh_exec_warn_less sudo -u minio $mc_path/mc mirror --preserve "minio/outlinestorage" "/var/lib/$app/data"
ynh_hide_warnings sudo -u minio $mc_path/mc mirror --preserve "minio/outlinestorage" "/var/lib/$app/data"
chown -R $app:www-data "/var/lib/$app"
ynh_script_progression --message="Data migration finished"
ynh_script_progression --message="Data bucket was kept for safety, just in case !"
ynh_script_progression --message="Don't forget to remove MinIO app if you don't use it !"
ynh_script_progression "Data migration finished"
ynh_script_progression "Data bucket was kept for safety, just in case !"
ynh_script_progression "Don't forget to remove MinIO app if you don't use it !"
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS "uuid-ossp";" --database=$db_name
ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS "uuid-ossp";"
else
ynh_script_progression --message="No migration to be done"
ynh_script_progression "No migration to be done"
fi
#=======================================================
# MIGRATE DEFAULT LANGUAGE ENV PARAMETER
#=======================================================
if ynh_compare_current_package_version --comparison le --version 0.75.0~ynh1
if ynh_app_upgrading_from_version_before_or_equal_to 0.75.0~ynh1
then
ynh_script_progression --message="Migrating default language variable"
ynh_script_progression "Migrating default language variable"
if [ "$language" == "fr" ]
then
ynh_app_setting_set --key=language --value="fr_FR"
@ -77,79 +65,79 @@ then
ynh_app_setting_set --key=language --value="en_US"
fi
else
ynh_script_progression --message="No default language migration to be done"
ynh_script_progression "No default language migration to be done"
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
ynh_script_progression "Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_nodejs_install
#=================================================
# UPGRADE YARN DEPENDENCIES
#=================================================
ynh_script_progression --message="Building $app. This can be very long, be patient !" --weight=10
ynh_script_progression "Building $app. This can be very long, be patient !"
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000 2>&1
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3900" yarn build 2>&1
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000 2>&1
ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_OPTIONS="--max-old-space-size=3900" yarn build 2>&1
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn cache clean 2>&1
popd
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression "Adding $app's configuration..."
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
ynh_config_add --template=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env"
#=================================================
# RUN DB MIGRATION
#=================================================
ynh_script_progression --message="Running DB initial migration..."
ynh_script_progression "Running DB initial migration..."
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production yarn db:migrate
ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_ENV=production yarn db:migrate
popd
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
ynh_script_progression "Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_config_add_systemd
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
ynh_config_add_logrotate
cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/outline.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
ynh_config_add --template="outline.cron" --destination="$cron_path"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "$cron_path"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "$cron_path"
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemctl --service=$app --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,3 +0,0 @@
*~
*.sw[op]
*.js

View file

@ -1,11 +0,0 @@
diff --git a/server/emails/mailer.tsx b/server/emails/mailer.tsx
index f53e44b6b..bcf56efca 100644
--- a/server/emails/mailer.tsx
+++ b/server/emails/mailer.tsx
@@ -207,6 +207,7 @@ export class Mailer {
: {
rejectUnauthorized: false,
},
+ ignoreTLS:true
};
}