1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/outline_ynh.git synced 2024-09-03 19:56:12 +02:00
This commit is contained in:
Éric Gaspar 2023-10-19 19:16:11 +02:00
parent f414a89595
commit 5d4ff496f1
6 changed files with 40 additions and 79 deletions

View file

@ -40,8 +40,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================

View file

@ -59,7 +59,6 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
ynh_print_info --message="Don't forget to add a new redirction url in your Slack app settings !"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -63,10 +63,10 @@ ynh_app_setting_set --app=$app --key=dex_user_uri --value=$dex_user_uri
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_script_progression --message="Installing dependencies..." --weight=7
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
# CREATE A POSTGRESQL DATABASE
@ -115,20 +115,6 @@ chmod 644 "$cron_path"
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
#=================================================
# BUILD YARN DEPENDENCIES
#=================================================
pushd "$install_dir"
ynh_use_nodejs
#REMOVEME? ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --weight=18
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000 2>&1
ynh_script_progression --message="Building... This can be very long, be patient !" --weight=18
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3200" yarn build 2>&1
ynh_script_progression --message="Cleaning cache... " --weight=3
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1
popd
#=================================================
# ADD A CONFIGURATION
#=================================================
@ -140,12 +126,15 @@ chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#=================================================
# RUN DB MIGRATION
# BUILD YARN DEPENDENCIES
#=================================================
ynh_script_progression --message="Running DB initial migration..." --weight=3
ynh_script_progression --message="Building $app..." --weight=10
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
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3200" yarn build
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate
popd

View file

@ -10,10 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# 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

View file

@ -19,7 +19,7 @@ if ! yunohost app list | grep -q "id: $dex_app"; then
echo "Dex is not installed. Installing... "
yunohost tools update
if yunohost app list | grep -q "$dex_domain$dex_path"; then
ynh_die "The domain provided for Dex is already used by another app. Please chose another one !"
ynh_die "The domain provided for Dex is already used by another app. Please chose another one!"
fi
yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "domain=$dex_domain&path=$dex_path&OIDC_name=$oidc_name&OIDC_secret=$oidc_secret&OIDC_callback=$oidc_callback"
fi
@ -49,7 +49,7 @@ chown -R $app:www-data "/var/lib/outline"
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# SPECIFIC RESTORATION
@ -59,7 +59,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -77,8 +77,6 @@ yunohost service add $app --description="Outline server" --log="/var/log/$app/$a
#=================================================
# UPDATING A CONFIGURATION
#=================================================
#REMOVEME? ynh_secure_remove --file="$install_dir/.env"
ynh_script_progression --message="Updating the configuration file..." --weight=1
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"

View file

@ -42,16 +42,11 @@ 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
then
ynh_script_progression --message="Migrating MinIO data to local directory"
#REMOVEME? minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain)
#REMOVEME? minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin)
#REMOVEME? minio_password=$(ynh_app_setting_get --app=$app --key=minio_password)
#REMOVEME? mc_path=$(ynh_app_setting_get --app=$app --key=mc_path)
mkdir -p "/var/lib/$app/data"
chown -R minio:www-data "/var/lib/$app"
@ -59,8 +54,6 @@ then
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 !"
else
ynh_script_progression --message="No migration to be done"
fi
@ -73,49 +66,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
# UPGRADE YARN DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=10
pushd "$install_dir"
ynh_use_nodejs
#REMOVEME? ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --weight=18
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000 2>&1
ynh_script_progression --message="Building... This can be very long, be patient !" --weight=18
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3900" yarn build 2>&1
ynh_script_progression --message="Cleaning cache... " --weight=3
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1
popd
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#=================================================
# RUN DB MIGRATION
#=================================================
ynh_script_progression --message="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
popd
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
@ -129,6 +79,32 @@ chmod 644 "$cron_path"
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#=================================================
# UPGRADE YARN DEPENDENCIES
#=================================================
ynh_script_progression --message="Building $app" --weight=10
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
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3900" yarn build
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate
popd
#=================================================
# START SYSTEMD SERVICE
#=================================================