mirror of
https://github.com/YunoHost-Apps/gotosocial_ynh.git
synced 2024-09-03 19:16:06 +02:00
setting up scripts
This commit is contained in:
parent
02a5a3fdbb
commit
7918f0aa57
3 changed files with 25 additions and 24 deletions
|
@ -62,12 +62,6 @@ ynh_backup --src_path="$datadir" --is_big
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP FAIL2BAN CONFIGURATION
|
# BACKUP FAIL2BAN CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -98,14 +92,11 @@ ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
ynh_backup --src_path="/etc/$app/"
|
ynh_backup --src_path="/etc/$app/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Backing up the MySQL database..."
|
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||||
|
|
||||||
### (However, things like MySQL dumps *do* take some time to run, though the
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
### copy of the generated dump to the archive still happens later)
|
|
||||||
|
|
||||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -99,13 +99,6 @@ chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:www-data "$datadir"
|
chown -R $app:www-data "$datadir"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --time --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE FAIL2BAN CONFIGURATION
|
# RESTORE FAIL2BAN CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -126,13 +119,17 @@ ynh_script_progression --message="Reinstalling dependencies..." --time --weight=
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1
|
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
ynh_psql_test_if_first_run
|
||||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
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_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS citext;" --database=$db_name
|
||||||
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database=$db_name
|
||||||
|
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
|
|
|
@ -101,6 +101,19 @@ if ! ynh_permission_exists --permission="api"; then
|
||||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
|
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Switch variables name
|
||||||
|
psql_db=$(ynh_app_setting_get --app=$app --key=psql_db)
|
||||||
|
|
||||||
|
if [ -n "$psql_db" ]
|
||||||
|
then
|
||||||
|
db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
|
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||||
|
ynh_app_setting_delete --app=$app --key=psql_db
|
||||||
|
ynh_app_setting_delete --app=$app --key=psqlpwd
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue