improve backup and install scripts

This commit is contained in:
Benedikt Tissot 2021-04-05 13:28:00 +02:00
parent 8a7d54dbc3
commit 3526c4a3dd
3 changed files with 20 additions and 6 deletions

View file

@ -78,8 +78,8 @@ appservice:
ephemeral_events: false
# Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
as_token: "This value is generated when generating the registration"
hs_token: "This value is generated when generating the registration"
as_token: __AS_TOKEN__
hs_token: __HS_TOKEN__
# Prometheus telemetry config. Requires prometheus-client to be installed.
metrics:

View file

@ -30,9 +30,16 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
app_service_registration_path=$(ynh_app_setting_get --app=$app --key=app_service_registration_path)
# synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
# mautrix_bridge_db_name=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_name)
# mautrix_bridge_db_user=$app
# mautrix_bridge_db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_pwd)
# mautrix_bridge_db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_pwd)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -47,6 +54,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
# includes config file
ynh_backup --src_path="$final_path"
#=================================================
@ -67,7 +75,8 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
# BACKUP VARIOUS FILES
#=================================================
# ynh_backup --src_path="/etc/$app/"
# backup synapse registration file
ynh_backup --src_path="$app_service_registration_path"
#=================================================
# BACKUP THE PostrgeSQL DATABASE

View file

@ -85,7 +85,6 @@ port=$(ynh_find_port --port=29317)
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=7
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=server_name --value=$server_name
ynh_app_setting_set --app=$app --key=port --value=$port
@ -93,7 +92,8 @@ ynh_app_setting_set --app=$app --key=botname --value=$botname
ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance
ynh_app_setting_set --app=$app --key=app_service_registration_path --value=$app_service_registration_path
ynh_app_setting_set --app=$app --key=encryption --value=$encryption
ynh_app_setting_set --app=$app --key=mautrix_bridge_db_name --value=$mautrix_bridge_db_name ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
ynh_app_setting_set --app=$app --key=mautrix_bridge_db_name --value=$mautrix_bridge_db_name
ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
ynh_app_setting_set --app=$app --key=botusers --value=$botusers
ynh_app_setting_set --app=$app --key=apiid --value=$apiid
@ -189,6 +189,7 @@ mautrix_config_path="$final_path/config.yaml"
#Copy example-config.yaml to config.yaml
cp ../conf/config.yaml "$mautrix_config_path"
ynh_replace_string --match_string=__DOMAIN__ --replace_string="https://$domain" --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__SERVER_NAME__ --replace_string=$server_name --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__VERIFY_SERVER_SSL_CERTIFICATES__ --replace_string=true --target_file="$mautrix_config_path"
@ -215,6 +216,10 @@ ynh_replace_string --match_string=__TELEGRAM_API_ID__ --replace_string=$apiid --
ynh_replace_string --match_string=__TELEGRAM_API_HASH__ --replace_string=$apihash --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__TELEGRAM_BOT_TOKEN__ --replace_string=$bottoken --target_file="$mautrix_config_path"
generated="\"This value is generated when generating the registration\""
ynh_replace_string --match_string=__AS_TOKEN__ --replace_string="$generated" --target_file="$mautrix_config_path"
ynh_replace_string --match_string=__HS_TOKEN__ --replace_string="$generated" --target_file="$mautrix_config_path"
#=================================================
# INSTALL MAUTRIX-BRIDGE PYTHON MODULE