1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mautrix_facebook_ynh.git synced 2024-09-03 19:36:33 +02:00

more applying example_ynh

This commit is contained in:
yalh76 2022-09-04 22:28:50 +02:00
parent feaa63510f
commit 0b0318f557
6 changed files with 19 additions and 15 deletions

View file

@ -1,7 +1,7 @@
;; Default test serie
; pre-install
sudo yunohost tools update apps
sudo yunohost app info synapse --quiet > /dev/null || sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/ -a "domain=$domain&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force
sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/ -a "domain=$domain&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force
; Manifest
port="8449" (PORT)
bot_synapse_adm=0

View file

@ -10,9 +10,8 @@ homeserver:
# Whether or not the homeserver supports asmux-specific endpoints,
# such as /_matrix/client/unstable/net.maunium.asmux/dms for atomically
# updating m.direct.
# asmux: false
asmux: false
# Number of retries for all HTTP requests if the homeserver isn't reachable.
# Number of retries for all HTTP requests if the homeserver isn't reachable.
http_retry_count: 4
# The URL to push real-time bridge status to.
# If set, the bridge will make POST requests to this URL whenever a user's Facebook MQTT connection state changes.

View file

@ -70,7 +70,7 @@ ynh_app_setting_set --app=$app --key=synapse_registration_path --value=$synapse_
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Configuring bridge port..." --weight=1
ynh_script_progression --message="Finding an available port..." --weight=1
# Find a free port for communication between your local synapse instance (home server) and its app service mautrix_bridge.
port=$(ynh_find_port --port=8449)
@ -114,7 +114,7 @@ ynh_setup_source --dest_dir="$final_path/src"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:root "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# SPECIFIC SETUP
@ -139,16 +139,21 @@ python3 -m venv $final_path
export HOME=$final_path
$final_path/bin/pip3 install --upgrade pip setuptools wheel
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-facebook.tar.gz
#=================================================
# REGISTER SYNAPSE APP-SERVICE
#=================================================
ynh_script_progression --message="Registering Synapse app-service" --weight=1
$final_path/bin/python3 -m mautrix_facebook -g -c $final_path/config.yaml -r $synapse_registration_path/$app.yaml
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || ynh_die "Synapse can't restart with the appservice configuration"
# Handled by synapse: synapse_ynh adds all registration files added in $synapse_registration_path to the app_service_config_files list
chown -R $app:$app "$final_path"
ynh_store_file_checksum --file="$synapse_registration_path/$app.yaml"
ynh_store_file_checksum --file="$final_path/config.yaml"
chown $app:root -R $final_path
#=================================================
# SETUP SYSTEMD
#=================================================
@ -166,7 +171,7 @@ ynh_script_progression --message="Configuring log rotation..." --weight=3
# Use logrotate to manage application logfile(s)
ynh_use_logrotate --logfile "/var/log/$app/$app.log"
chown $app:root -R /var/log/$app
chown $app:$app -R /var/log/$app
#=================================================
# INTEGRATE SERVICE IN YUNOHOST

View file

@ -17,7 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
botname=$(ynh_app_setting_get --app=$app --key=botname)
encryption=$(ynh_app_setting_get --app=$app --key=encryption)
botadmin=$(ynh_app_setting_get --app=$app --key=botadmin)
botusers=$(ynh_app_setting_get --app=$app --key=botusers)
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)

View file

@ -63,7 +63,7 @@ ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:root "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# SPECIFIC RESTORATION
@ -83,7 +83,7 @@ ynh_script_progression --message="Restoring the PostgreSQL database..." --weight
ynh_psql_test_if_first_run
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name"
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# INSTALL MAUTRIX-BRIDGE PYTHON MODULE
@ -114,7 +114,7 @@ systemctl enable $app.service --quiet
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_use_logrotate --logfile "/var/log/$app/$app.log"
chown $app:root -R /var/log/$app
chown $app:$app -R /var/log/$app
#=================================================
# INTEGRATE SERVICE IN YUNOHOST

View file

@ -24,6 +24,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port)
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
@ -87,7 +88,7 @@ fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:root "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
@ -125,7 +126,7 @@ $final_path/bin/python3 -m mautrix_facebook -g -c $final_path/config.yaml -r $sy
# Handled by synapse: synapse_ynh adds all registration files added in $synapse_registration_path to the app_service_config_files list
# Set permissions on app files
chown $app:root -R $final_path
chown -R $app:$app "$final_path"
#=================================================
# SETUP SYSTEMD
@ -144,7 +145,7 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --weight
# Use logrotate to manage application logfile(s)
ynh_use_logrotate --logfile "/var/log/$app/$app.log"
chown $app:root -R /var/log/$app
chown -R $app:$app /var/log/$app
#=================================================
# INTEGRATE SERVICE IN YUNOHOST