mirror of
https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh.git
synced 2024-09-03 19:46:01 +02:00
commit
a8ef3b9f81
6 changed files with 133 additions and 118 deletions
|
@ -1,15 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Matrix Whatsapp bridge
|
|
||||||
After=matrix-synapse.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=mautrix-__APP__
|
|
||||||
WorkingDirectory=/opt/yunohost/mautrix-__APP__
|
|
||||||
ExecStartPre=/opt/yunohost/mmautrix-__APP__/mautrix-whatsapp --config-path=/opt/yunohost/mmautrix-__APP__/config.yaml --config-path=/etc/matrix-synapse/homeserver.yaml --generate-keys
|
|
||||||
ExecStart=/opt/yunohost/mautrix-__APP__/mautrix-whatsapp --config-path=/opt/yunohost/mmautrix-__APP__/config.yaml --config-path=/etc/matrix-synapse/homeserver.yaml
|
|
||||||
Restart=always
|
|
||||||
RestartSec=3
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,13 +1,14 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Small description of the service
|
Description=Matrix Whatsapp bridge
|
||||||
After=network.target
|
After=matrix-synapse.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
WorkingDirectory=/opt/yunohost/__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
ExecStart=/opt/yunohost/__APP__/mautrix-whatsapp -c=/opt/yunohost/__APP__/config.yaml >> /var/log/__APP__/__APP__.log 2>&1
|
||||||
ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1
|
Restart=always
|
||||||
|
RestartSec=3
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"name": "Matrix-Whatsapp bridge",
|
"name": "Matrix-Whatsapp bridge",
|
||||||
"id": "whatsapp",
|
"id": "mautrix_whatsapp",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "A Matrix-WhatsApp puppeting bridge packaged as a YunoHost service.",
|
"en": "A WhatsApp puppeting bridge for Matrix/Synapse.",
|
||||||
"fr": "Passerelle WhatsApp exploitant matrix-synapse et un service d'application matrix packagé comme un service YunoHost."
|
"fr": "Passerelle WhatsApp pour Matrix/Synapse."
|
||||||
},
|
},
|
||||||
"version": "1.0~ynh1",
|
"version": "1.0~ynh1",
|
||||||
"url": "https://github.com/tulir/mautrix-whatsapp",
|
"url": "https://github.com/tulir/mautrix-whatsapp",
|
||||||
|
@ -16,19 +16,19 @@
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.5"
|
"yunohost": ">= 3.5"
|
||||||
"synapse": ">= 1.11.0"
|
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
"matrix-synapse"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the domain name where Synapse is installed",
|
"en": "Choose the domain name where Synapse is installed.",
|
||||||
"fr": "Choisissez le nom de domaine associé à Synapse"
|
"fr": "Choisissez le nom de domaine associé à Synapse."
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
|
@ -36,28 +36,28 @@
|
||||||
"name": "whatsappbot",
|
"name": "whatsappbot",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the user name of the whatsapp bot for which to create a YunoHost and a local synapse server account",
|
"en": "Choose the user name of the whatsapp bot for which to create a YunoHost and a local synapse server account.",
|
||||||
"fr": "Choisissez le nom d'utilisateur du robot whatsapp pour lequel un compte sera créé sur YunoHost et le serveur local synapse"
|
"fr": "Choisissez le nom d'utilisateur du robot whatsapp pour lequel un compte sera créé sur YunoHost et le serveur local synapse."
|
||||||
},
|
},
|
||||||
"example": "whatsappbot"
|
"example": "whatsappbot",
|
||||||
"default": "whatsappbot"
|
"default": "whatsappbot"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "botadmin",
|
"name": "botadmin",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the matrix account administrator of the whatsapp bot",
|
"en": "Choose the matrix account administrator of the whatsapp bot.",
|
||||||
"fr": "Choisissez le compte matrix administrateur du robot whatsapp"
|
"fr": "Choisissez le compte matrix administrateur du robot whatsapp."
|
||||||
},
|
},
|
||||||
"example": "@johndoe:domain.org or @johndoe:matrix.org"
|
"example": "@johndoe:domain.org or @johndoe:matrix.org",
|
||||||
"default": "Your main matrix account"
|
"default": "Your main matrix account"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "botusers",
|
"name": "botusers",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a matrix server authorized to use the whatsapp bot",
|
"en": "Choose a matrix server authorized to use the whatsapp bot.",
|
||||||
"fr": "Choisissez un serveur matrix dont tous les utilisateurs sont autorisés à utiliser le robot whatsapp"
|
"fr": "Choisissez un serveur matrix dont tous les utilisateurs sont autorisés à utiliser le robot whatsapp."
|
||||||
},
|
},
|
||||||
"example": "matrix.org"
|
"example": "matrix.org"
|
||||||
},
|
},
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Is it a public bot ?",
|
"en": "Is it a public bot?",
|
||||||
"fr": "Est-ce un robot public ?"
|
"fr": "Est-ce un robot public ?"
|
||||||
},
|
},
|
||||||
"default": true,
|
"default": true,
|
||||||
|
|
|
@ -6,11 +6,26 @@
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies=""
|
pkg_dependencies=""
|
||||||
|
GO_VERSION="1.14.2"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Detect the system architecture to download the right tarball
|
||||||
|
# NOTE: `uname -m` is more accurate and universal than `arch`
|
||||||
|
# See https://en.wikipedia.org/wiki/Uname
|
||||||
|
if [ -n "$(uname -m | grep 64)" ]; then
|
||||||
|
architecture="amd64"
|
||||||
|
elif [ -n "$(uname -m | grep 86)" ]; then
|
||||||
|
architecture="386"
|
||||||
|
elif [ -n "$(uname -m | grep arm)" ]; then
|
||||||
|
architecture="armv6l"
|
||||||
|
else
|
||||||
|
ynh_die "Unable to detect your achitecture, please open a bug describing \
|
||||||
|
your hardware and the result of the command \"uname -m\"." 1
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -45,15 +45,15 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
### The app instance name is probably what interests you most, since this is
|
### The app instance name is probably what interests you most, since this is
|
||||||
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
||||||
### db names, ...
|
### db names, ...
|
||||||
app="$YNH_APP_INSTANCE_NAME"
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET CONSTANTS
|
# SET CONSTANTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
mautrix_whatsapp_user="mautrix-$app"
|
mautrix_whatsapp_user=$app
|
||||||
mautrix_whatsapp_db_name="mautrix_$app"
|
mautrix_whatsapp_db_name=$app
|
||||||
mautrix_whatsapp_db_user="mautrix_$app"
|
mautrix_whatsapp_db_user=$app
|
||||||
upstream_version=$(ynh_app_upstream_version)
|
upstream_version=$(ynh_app_upstream_version)
|
||||||
#report_stats="false"
|
#report_stats="false"
|
||||||
#allow_public_rooms="false"
|
#allow_public_rooms="false"
|
||||||
|
@ -74,7 +74,7 @@ ynh_script_progression --message="Validating installation parameters..." --time
|
||||||
|
|
||||||
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
||||||
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
||||||
final_path=/opt/yunohost/mautrix-$app
|
final_path=/opt/yunohost/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
|
@ -131,6 +131,17 @@ ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL GO
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
type /usr/local/go/bin/go > /dev/null || {
|
||||||
|
ynh_script_progression --message="Installing go..." --time --weight=1
|
||||||
|
wget https://dl.google.com/go/go$GO_VERSION.linux-$architecture.tar.gz -q
|
||||||
|
tar -C /usr/local -xzf go$GO_VERSION.linux-$architecture.tar.gz
|
||||||
|
}
|
||||||
|
export PATH=$PATH:/usr/local/go/bin
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -147,7 +158,7 @@ ynh_print_OFF
|
||||||
ynh_psql_create_user $mautrix_whatsapp_db_user $mautrix_whatsapp_db_pwd
|
ynh_psql_create_user $mautrix_whatsapp_db_user $mautrix_whatsapp_db_pwd
|
||||||
ynh_print_ON
|
ynh_print_ON
|
||||||
ynh_psql_execute_as_root \
|
ynh_psql_execute_as_root \
|
||||||
--sql="CREATE DATABASE $mautrix_whatsapp_db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $mautrix_whatsapp_db_user;"
|
--sql="CREATE DATABASE ""$mautrix_whatsapp_db_name"" ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER ""$mautrix_whatsapp_db_user"";"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -179,7 +190,6 @@ ynh_script_progression --message="Configuring system user..." --time --weight=1
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$mautrix_whatsapp_user
|
ynh_system_user_create --username=$mautrix_whatsapp_user
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -197,8 +207,8 @@ ynh_script_progression --message="Configuring a systemd service..." --time --wei
|
||||||
### - And the section "SETUP SYSTEMD" in the upgrade script
|
### - And the section "SETUP SYSTEMD" in the upgrade script
|
||||||
|
|
||||||
# Create systemd config for mautrix-whatsapp
|
# Create systemd config for mautrix-whatsapp
|
||||||
#cp ../conf/default_mautrix-whatsapp /etc/default/mautrix-$app
|
#cp ../conf/default_mautrix-whatsapp /etc/default/$app
|
||||||
ynh_add_systemd_config --service=mautrix-$app --template=mautrix-whatsapp.service
|
ynh_add_systemd_config --service=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -231,7 +241,7 @@ cp example-config.yaml config.yaml
|
||||||
ynh_replace_string --match_string="address: https://example.com" --replace_string="address: https://$domain" --target_file="$final_path/config.yaml"
|
ynh_replace_string --match_string="address: https://example.com" --replace_string="address: https://$domain" --target_file="$final_path/config.yaml"
|
||||||
# The domain of the homeserver (for MXIDs, etc).
|
# The domain of the homeserver (for MXIDs, etc).
|
||||||
#"domain: example.com"
|
#"domain: example.com"
|
||||||
ynh_replace_string --match_string="domain: example.com" --replace_string="domain: "$domain --target_file="$final_path/config.yaml"
|
ynh_replace_string --match_string="domain: example.com" --replace_string="domain: $domain" --target_file="$final_path/config.yaml"
|
||||||
|
|
||||||
# Application service host/registration related details.
|
# Application service host/registration related details.
|
||||||
# Changing these values requires regeneration of the registration.
|
# Changing these values requires regeneration of the registration.
|
||||||
|
@ -250,11 +260,11 @@ ynh_replace_string --match_string="type: sqlite3" --replace_string="type: postgr
|
||||||
# The database URI.
|
# The database URI.
|
||||||
# SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
|
# SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
|
||||||
# Postgres: Connection string. For example, postgres://user:password@host/database
|
# Postgres: Connection string. For example, postgres://user:password@host/database
|
||||||
ynh_replace_string --match_string="uri: mautrix-whatsapp.db" --replace_string="uri: postgres://$mautrix_whatsapp_user@localhost:5432/$mautrix_whatsapp_db_name" --target_file="$final_path/config.yaml"
|
ynh_replace_string --match_string="uri: mautrix-whatsapp.db" --replace_string="uri: postgres://$mautrix_whatsapp_user:$mautrix_whatsapp_db_pwd@localhost:5432/$mautrix_whatsapp_db_name" --target_file="$final_path/config.yaml"
|
||||||
|
|
||||||
# The unique ID of this appservice.
|
# The unique ID of this appservice.
|
||||||
#id: whatsapp
|
#id: whatsapp
|
||||||
ynh_replace_string --match_string="id: whatsapp" --replace_string="id: mautrix-$app" --target_file="$final_path/config.yaml"
|
ynh_replace_string --match_string="id: whatsapp" --replace_string="id: $app" --target_file="$final_path/config.yaml"
|
||||||
# Appservice bot details.
|
# Appservice bot details.
|
||||||
#bot:
|
#bot:
|
||||||
# Username of the appservice bot.
|
# Username of the appservice bot.
|
||||||
|
@ -312,7 +322,7 @@ fi
|
||||||
|
|
||||||
#Generate the appservice registration file by running ./mautrix-whatsapp -g.
|
#Generate the appservice registration file by running ./mautrix-whatsapp -g.
|
||||||
#You can use the -c and -r flags to change the location of the config and registration files. They default to config.yaml and registration.yaml respectively.
|
#You can use the -c and -r flags to change the location of the config and registration files. They default to config.yaml and registration.yaml respectively.
|
||||||
./mautrix-whatsapp -g -r /etc/matrix-synapse/mautrix-whatsapp-registration.yaml
|
./mautrix-whatsapp -g -r /etc/matrix-synapse/$app-registration.yaml
|
||||||
#Add the path to the registration file (registration.yaml by default) to your synapse homeserver.yaml under app_service_config_files.
|
#Add the path to the registration file (registration.yaml by default) to your synapse homeserver.yaml under app_service_config_files.
|
||||||
# A list of application service config files to use
|
# A list of application service config files to use
|
||||||
#
|
#
|
||||||
|
@ -320,7 +330,7 @@ fi
|
||||||
# - app_service_1.yaml
|
# - app_service_1.yaml
|
||||||
# - "/etc/matrix-synapse/registration.yaml"
|
# - "/etc/matrix-synapse/registration.yaml"
|
||||||
ynh_replace_string --match_string="#app_service_config_files:" --replace_string="app_service_config_files:" --target_file="/etc/matrix-synapse/homeserver.yaml"
|
ynh_replace_string --match_string="#app_service_config_files:" --replace_string="app_service_config_files:" --target_file="/etc/matrix-synapse/homeserver.yaml"
|
||||||
ynh_replace_string --match_string="# - app_service_1.yaml" --replace_string=" - '/etc/matrix-synapse/mautrix-whatsapp-registration.yaml'" --target_file="/etc/matrix-synapse/homeserver.yaml"
|
ynh_replace_string --match_string="# - app_service_1.yaml" --replace_string=" - '/etc/matrix-synapse/$app-registration.yaml'" --target_file="/etc/matrix-synapse/homeserver.yaml"
|
||||||
#You will then need to restart the synapse server. Remember to restart it every time the registration file is regenerated.
|
#You will then need to restart the synapse server. Remember to restart it every time the registration file is regenerated.
|
||||||
service matrix-synapse restart
|
service matrix-synapse restart
|
||||||
#Run the bridge with
|
#Run the bridge with
|
||||||
|
@ -357,16 +367,16 @@ ynh_store_file_checksum --file="/etc/matrix-synapse/homeserver.yaml"
|
||||||
# For any update do it in all files
|
# For any update do it in all files
|
||||||
chown $mautrix_whatsapp_user:root -R $final_path
|
chown $mautrix_whatsapp_user:root -R $final_path
|
||||||
#chmod 770 $final_path/Coturn_config_rotate.sh
|
#chmod 770 $final_path/Coturn_config_rotate.sh
|
||||||
#chown $mautrix_whatsapp_user:root -R /var/lib/mautrix-$app
|
#chown $mautrix_whatsapp_user:root -R /var/lib/$app
|
||||||
#chown $mautrix_whatsapp_user:root -R /var/log/mautrix-$app
|
#chown $mautrix_whatsapp_user:root -R /var/log/$app
|
||||||
#chown $mautrix_whatsapp_user:root -R /etc/mautrix-$app
|
#chown $mautrix_whatsapp_user:root -R /etc/$app
|
||||||
#chmod u=rwX,g=rX,o= -R /etc/mautrix-$app
|
#chmod u=rwX,g=rX,o= -R /etc/$app
|
||||||
#chmod 600 /etc/matrix-$app/$server_name.signing.key
|
#chmod 600 /etc/matrix-$app/$server_name.signing.key
|
||||||
#setfacl -R -m user:turnserver:rX /etc/matrix-$app
|
#setfacl -R -m user:turnserver:rX /etc/matrix-$app
|
||||||
#setfacl -R -m user:turnserver:rwX /var/log/matrix-$app
|
#setfacl -R -m user:turnserver:rwX /var/log/matrix-$app
|
||||||
|
|
||||||
chown matrix-synapse:root /etc/matrix-synapse/mautrix-whatsapp-registration.yaml
|
chown /etc/matrix-synapse/$app-registration.yaml --reference="/etc/matrix-synapse/homeserver.yaml"
|
||||||
chmod u=rwX,g=rX,o= /etc/matrix-synapse/mautrix-whatsapp-registration.yaml
|
chmod u=rwX,g=rX,o= /etc/matrix-synapse/$app-registration.yaml
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
@ -382,7 +392,7 @@ ynh_script_progression --message="Configuring log rotation..." --time --weight=1
|
||||||
### - And the section "SETUP LOGROTATE" in the upgrade script
|
### - And the section "SETUP LOGROTATE" in the upgrade script
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate --logfile "/var/log/mautrix-$app"
|
ynh_use_logrotate --logfile "/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
@ -396,7 +406,7 @@ ynh_use_logrotate --logfile "/var/log/mautrix-$app"
|
||||||
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
|
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
|
||||||
### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
|
### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
|
||||||
|
|
||||||
yunohost service add mautrix-$app --log "/var/log/mautrix-$app/mautrix-whatsapp.log"
|
yunohost service add $app --log "/var/log/$app/$app.log"
|
||||||
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
|
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
|
||||||
#yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/$app.log"
|
#yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/$app.log"
|
||||||
|
|
||||||
|
@ -414,7 +424,7 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight
|
||||||
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
|
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=mautrix-$app --action="start" --line_match="Bot now ready to bridge Whatsapp and Matrix users from $botusers" --log_path="/var/log/mautrix-$app/mautrix-whatsapp.log" --timeout=300
|
ynh_systemd_action --service_name=$app --action="start" --line_match="Bot now ready to bridge Whatsapp and Matrix users from $botusers" --log_path="/var/log/$app/$app.log" --timeout=300
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
|
@ -423,7 +433,7 @@ ynh_script_progression --message="Configuring fail2ban..." --time --weight=1
|
||||||
|
|
||||||
# Create a dedicated fail2ban config
|
# Create a dedicated fail2ban config
|
||||||
#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||||
ynh_add_fail2ban_config --use_template
|
#ynh_add_fail2ban_config --use_template
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
@ -448,4 +458,4 @@ ynh_add_fail2ban_config --use_template
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of mautrix-$app completed" --time --last
|
ynh_script_progression --message="Installation of $app completed" --time --last
|
||||||
|
|
|
@ -50,6 +50,8 @@ ynh_script_progression --message="Removing the MySQL database..." --time --weigh
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
ynh_psql_drop_db $app
|
||||||
|
ynh_psql_drop_user $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
|
@ -67,6 +69,8 @@ ynh_script_progression --message="Removing app main directory..." --time --weigh
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
|
ynh_secure_remove --file="/etc/matrix-synapse/$app-registration.yaml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue