mirror of
https://framagit.org/YunoHost-Apps/gitea_ynh.git
synced 2024-11-24 03:51:35 +01:00
60cb5e5ae4
* Move app install dir from /opt to /var/www * Revamp the way binaries are downloaded thanks to manifestv2 (no need to check for arch, etc) * Remove custom helpers (exec_as, ynh_handle_app_migration) * Rename LFS_KEY as LFS_JWT_SECRET and KEY as SECRET_KEY as named in app.ini * Add JWT_SECRET for oauth and INTERNAL_TOKEN in app.ini * update upstream sample app.ini URL * Disable actions for now. * Automatically add ssh permissions to the system user * Remove support for upgrade before 1.6.4. Edit test_upgrade_from accordingly.
58 lines
2.0 KiB
Bash
58 lines
2.0 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
|
|
# Load common variables and helpers
|
|
source ../settings/scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RESTORE THE APP MAIN DIR
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the app files..." --weight=1
|
|
ynh_restore
|
|
|
|
# Also sets the permissions
|
|
_gitea_mkdirs
|
|
|
|
#=================================================
|
|
# RESTORE THE MYSQL DATABASE
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
|
|
|
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
|
|
|
#=================================================
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable "$app".service --quiet
|
|
|
|
yunohost service add "$app" --log="/var/log/$app/gitea.log"
|
|
|
|
# SETUP FAIL2BAN
|
|
ynh_script_progression --message="Configuring fail2ban..."
|
|
ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
|
|
|
# Typically you only have either $app or php-fpm but not both at the same time...
|
|
ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -t 10
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|