Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to match the signal_ynh package #5

Merged
merged 12 commits into from
Mar 7, 2022
4 changes: 2 additions & 2 deletions check_process
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
;; Default test serie
; pre-install
sudo yunohost tools update apps
sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/ -a "domain=$domain&server_name=$server_name&is_public=$is_public&jitsi_server=$jitsi_server" --force
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_public=$is_public&jitsi_server=$jitsi_server" --force
; Manifest
port="8449" (PORT)
synapsenumber="1"
whatsappbot="whatsappbot"
botname="facebookbot"
bot_synapse_adm=0
encryption=0
botadmin="@johndoe:synapsedomain.tld" (USER)
Expand Down
2 changes: 1 addition & 1 deletion conf/app.src
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/tulir/mautrix-facebook/archive/v0.3.0.tar.gz
SOURCE_SUM=992e491a3e34bd42ddfba0b3aef7869a7a7c03171560783ec23a692d1f0d79a1
SOURCE_SUM=0b31c0a865d71bc76bed541ee8e57dd790a67197f62883032a7ae05b9658642b
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
Expand Down
34 changes: 19 additions & 15 deletions conf/config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Homeserver details
homeserver:
# The address that this appservice can use to connect to the homeserver.
# address: https://example.com
address: __DOMAIN__
address: https://__DOMAIN__
# The domain of the homeserver (for MXIDs, etc).
# domain: example.com
domain: __SERVER_NAME__
# Whether or not to verify the SSL certificate of the homeserver.
# Only applies if address starts with https://
# verify_ssl: true
verify_ssl: __VERIFY_SERVER_SSL_CERTIFICATES__
# Whether or not the homeserver supports asmux-specific endpoints,
# such as /_matrix/client/unstable/net.maunium.asmux/dms for atomically
Expand All @@ -20,21 +17,26 @@ homeserver:
# Changing these values requires regeneration of the registration.
appservice:
# The address that the homeserver can use to connect to this appservice.
# address: http://localhost:29319
address: http://localhost:__PORT__
# When using https:// the TLS certificate and key files for the address.
tls_cert: false
tls_key: false

# The hostname and port where this appservice should listen.
# hostname: localhost
hostname: 0.0.0.0
# port: 29319
port: __PORT__
# The maximum body size of appservice API requests (from the homeserver) in mebibytes
# Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
max_body_size: 1

# The full URI to the database. Only Postgres is currently supported.
# database: postgres://username:password@hostname/db
database: postgres://__MAUTRIX_FACEBOOK_USER__:__MAUTRIX_FACEBOOK_DB_PWD__@localhost:5432/__MAUTRIX_FACEBOOK_DB_NAME__
database: postgres://__MAUTRIX_BRIDGE_USER__:__MAUTRIX_BRIDGE_DB_PWD__@localhost:5432/__MAUTRIX_BRIDGE_DB_NAME__
# Additional arguments for asyncpg.create_pool()
# https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
database_opts:
min_size: 5
max_size: 10


# Public part of web server for out-of-Matrix interaction with the bridge.
public:
Expand All @@ -51,17 +53,19 @@ appservice:
shared_secret: generate

# The unique ID of this appservice.
id: __FACEBOOKBOT__
id: __BOTNAME__
# Username of the appservice bot.
bot_username: __FACEBOOKBOT__
bot_username: __BOTNAME__
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
# to leave display name/avatar as-is.
bot_displayname: FB bridge bot
bot_avatar: mxc://maunium.net/ygtkteZsXnGJLJHRchUwYWak

# Community ID for bridged users (changes registration file) and rooms.
# Must be created manually. Example: "+facebook:example.com"
community_id: null
# Must be created manually.
#
# Example: "+fb:example.com". Set to false to disable.
community_id: +fb:__SERVER_NAME__

# Whether or not to receive ephemeral events via appservice transactions.
# Requires MSC2409 support (i.e. Synapse 1.22+).
Expand Down Expand Up @@ -244,11 +248,11 @@ logging:
formatter: colored
loggers:
mau:
level: DEBUG
level: __LOG_LEVEL__
paho:
level: INFO
aiohttp:
level: INFO
root:
level: DEBUG
level: __LOG_LEVEL__
handlers: [file, console]
4 changes: 2 additions & 2 deletions issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to REPLACEBYYOURAPP itself. Refer to its documentation or repository for help.*
- *Otherwise, the issue may be due to mautrix-facebook itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
Expand All @@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide

- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install REPLACEBYYOURAPP
sudo yunohost app install mautrix_facebook
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
Expand Down
10 changes: 8 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@
},
"version": "0.3.0~ynh1",
"url": "https://github.com/tulir/mautrix-facebook",
"upstream": {
"license": "AGPL-3.0-or-later",
"admindoc": "https://docs.mau.fi/bridges/python/setup/index.html?bridge=facebook",
"userdoc": "https://docs.mau.fi/bridges/python/facebook/index.html",
"code": "https://github.com/mautrix/facebook"
},
"license": "AGPL-3.0-or-later",
"maintainer": {
"name": "Gredin67",
"email": "[email protected]",
"url": "https://github.com/YunoHost-Apps/mautrix_facebook_ynh"
},
"requirements": {
"yunohost": ">= 4.0"
"yunohost": ">= 4.1"
},
"multi_instance": true,
"services": [
Expand All @@ -38,7 +44,7 @@
"default": "1"
},
{
"name": "facebookbot",
"name": "botname",
"type": "string",
"ask": {
"en": "Choose a local synapse user name for the Facebook bot",
Expand Down
48 changes: 31 additions & 17 deletions scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,34 @@ ynh_print_info --message="Loading installation settings..."

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)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# language=$(ynh_app_setting_get --app=$app --key=language)

server_name=$(ynh_app_setting_get --app=$app --key=server_name)
port=$(ynh_app_setting_get --app=$app --key=port)
botname=$(ynh_app_setting_get --app=$app --key=botname)
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
app_service_registration_path=$(ynh_app_setting_get --app=$app --key=app_service_registration_path)
# bot_is_synapse_admin=$(ynh_app_setting_get --app=$app --key=bot_is_synapse_admin)
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)
mautrix_config_path="$final_path/config.yaml"
mautrix_version=$(ynh_app_setting_get --app=$app --key=mautrix_version)

mautrix_bridge_db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_pwd)
#=================================================
# SET CONSTANTS
#=================================================

botname_synapse_db_user="@$botname:$server_name"
synapse_db_name="matrix_$synapse_instance"
mautrix_bridge_user=$app
mautrix_bridge_db_name=$app
mautrix_bridge_db_user=$app
upstream_version=$(ynh_app_upstream_version)
log_filename="/var/log/$app/$app.log"

#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
Expand All @@ -54,7 +79,7 @@ ynh_backup --src_path="$final_path"
# BACKUP LOGROTATE
#=================================================

ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/var/log/$app"

#=================================================
# BACKUP SYSTEMD
Expand All @@ -63,22 +88,11 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service"

#=================================================
# BACKUP VARIOUS FILES
# BACKUP THE POSTGRESQL DATABASE
#=================================================
ynh_print_info --message="Backing up the PostgreSQL database..."

ynh_backup --src_path="/etc/cron.d/$app"

ynh_backup --src_path="/etc/$app/"

#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."

### (However, things like MySQL dumps *do* take some time to run, though the
### copy of the generated dump to the archive still happens later)

ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_psql_dump_db --database="$mautrix_bridge_db_name" > ${YNH_CWD}/dump.sql

#=================================================
# END OF SCRIPT
Expand Down
Loading