mirror of
https://github.com/YunoHost-Apps/matrix-appservice-irc_ynh.git
synced 2024-09-03 19:36:37 +02:00
Manifestv2
This commit is contained in:
parent
76b83da390
commit
a3d7153f6d
9 changed files with 215 additions and 503 deletions
|
@ -1,24 +0,0 @@
|
|||
;; Test complet
|
||||
; 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_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force
|
||||
; Manifest
|
||||
port="8449" (PORT)
|
||||
synapsenumber="1"
|
||||
botname="ircmatrixbot"
|
||||
botadmin="@johndoe:synapsedomain.tld" (USER)
|
||||
botusers="@johndoe:synapsedomain.tld"
|
||||
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=0
|
||||
setup_nourl=1
|
||||
setup_private=0
|
||||
setup_public=0
|
||||
upgrade=1
|
||||
upgrade=0 from_commit=CommitHash
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=0
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/matrix-org/matrix-appservice-irc/archive/refs/tags/0.36.0.tar.gz
|
||||
SOURCE_SUM=95f2f5288d2347121e399dff1136e854932db5b3a8ff61a1a7cf5c9fd2729988
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
|
@ -6,9 +6,9 @@ After=matrix-synapse.target
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
ExecStart=__FINALPATH__/bin/matrix-appservice-irc -c __FINALPATH__/config.yaml
|
||||
ExecStart=__INSTALL_DIR__/bin/matrix-appservice-irc -c __INSTALL_DIR__/config.yaml
|
||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||
StandardError=inherit
|
||||
|
||||
|
|
|
@ -1,295 +0,0 @@
|
|||
|
||||
## Config panel are available from webadmin > Apps > YOUR_APP > Config Panel Button
|
||||
## Those panels let user configure some params on their apps using a friendly interface,
|
||||
## and remove the need to manually edit files from the command line.
|
||||
|
||||
## From a packager perspective, this .toml is coupled to the scripts/config script,
|
||||
## which may be used to define custom getters/setters. However, most use cases
|
||||
## should be covered automagically by the core, thus it may not be necessary
|
||||
## to define a scripts/config at all!
|
||||
|
||||
## -----------------------------------------------------------------------------
|
||||
## IMPORTANT: In accordance with YunoHost's spirit, please keep things simple and
|
||||
## do not overwhelm the admin with tons of misunderstandable or advanced settings.
|
||||
## -----------------------------------------------------------------------------
|
||||
|
||||
## The top level describe the entire config panels screen.
|
||||
|
||||
## The version is a required property.
|
||||
## Here a small reminder to associate config panel version with YunoHost version
|
||||
## | Config | YNH | Config panel small change log |
|
||||
## | ------ | --- | ------------------------------------------------------- |
|
||||
## | 0.1 | 3.x | 0.1 config script not compatible with YNH >= 4.3 |
|
||||
## | 1.0 | 4.3.x | The new config panel system with 'bind' property |
|
||||
version = "1.0"
|
||||
|
||||
## (optional) i18n property let you internationalize questions, however this feature
|
||||
## is only available in core configuration panel (like yunohost domain config).
|
||||
## So in app config panel this key is ignored for now, but you can internationalize
|
||||
## by using a lang dictionary (see property name bellow)
|
||||
# i18n = "prefix_translation_key"
|
||||
|
||||
################################################################################
|
||||
#### ABOUT PANELS
|
||||
################################################################################
|
||||
|
||||
## The next level describes web admin panels
|
||||
## You have to choose an ID for each panel, in this example the ID is "main"
|
||||
## Keep in mind this ID will be used in CLI to refer to your question, so choose
|
||||
## something short and meaningfull.
|
||||
## In the webadmin, each panel corresponds to a distinct tab / form
|
||||
[main]
|
||||
|
||||
## Define the label for your panel
|
||||
## Internationalization works similarly to the 'description' and 'ask' questions in the manifest
|
||||
# name.en = "Main configuration"
|
||||
# name.fr = "Configuration principale"
|
||||
|
||||
## (optional) If you need to trigger a service reload-or-restart after the user
|
||||
## change a question in this panel, you can add your service in the list.
|
||||
services = ["__APP__"]
|
||||
# or services = ["nginx", "__APP__"] to also reload-or-restart nginx
|
||||
|
||||
## (optional) This help properties is a short help displayed on the same line
|
||||
## than the panel title but not displayed in the tab.
|
||||
# help = ""
|
||||
|
||||
############################################################################
|
||||
#### ABOUT SECTIONS
|
||||
############################################################################
|
||||
|
||||
## A panel is composed of one or several sections.
|
||||
##
|
||||
## Sections are meant to group questions together when they correspond to
|
||||
## a same subtopic. This impacts the rendering in terms of CLI prompts
|
||||
## and HTML forms
|
||||
##
|
||||
## You should choose an ID for your section, and prefix it with the panel ID
|
||||
## (Be sure to not make a typo in the panel ID, which would implicitly create
|
||||
## an other entire panel)
|
||||
##
|
||||
## We use the context of pepettes_ynh as an example,
|
||||
## which is a simple donation form app written in python,
|
||||
## and for which the admin will want to edit the configuration
|
||||
[main.customization]
|
||||
|
||||
## (optional) Defining a proper title for sections is not mandatory
|
||||
## and depends on the exact rendering you're aiming for the CLI / webadmin
|
||||
name = ""
|
||||
|
||||
## (optional) This help properties is a short help displayed on the same line
|
||||
## than the section title, meant to provide additional details
|
||||
# help = ""
|
||||
|
||||
## (optional) As for panel, you can specify to trigger a service
|
||||
## reload-or-restart after the user change a question in this section.
|
||||
## This property is added to the panel property, it doesn't deactivate it.
|
||||
## So no need to replicate, the service list from panel services property.
|
||||
# services = []
|
||||
|
||||
## (optional) By default all questions are optionals, but you can specify a
|
||||
## default behaviour for question in the section
|
||||
optional = false
|
||||
|
||||
## (optional) It's also possible with the 'visible' property to only
|
||||
## display the section depending on the user's answers to previous questions.
|
||||
##
|
||||
## Be careful that the 'visible' property should only refer to **previous** questions
|
||||
## Hence, it should not make sense to have a "visible" property on the very first section.
|
||||
##
|
||||
## Also, keep in mind that this feature only works in the webadmin and not in CLI
|
||||
## (therefore a user could be prompted in CLI for a question that may not be relevant)
|
||||
# visible = true
|
||||
|
||||
########################################################################
|
||||
#### ABOUT QUESTIONS
|
||||
########################################################################
|
||||
|
||||
## A section is compound of one or several questions.
|
||||
|
||||
## ---------------------------------------------------------------------
|
||||
## IMPORTANT: as for panel and section you have to choose an ID, but this
|
||||
## one should be unique in all this document, even if the question is in
|
||||
## an other panel.
|
||||
## ---------------------------------------------------------------------
|
||||
|
||||
## You can use same questions types and properties than in manifest.yml
|
||||
## install part. However, in YNH 4.3, a lot of change has been made to
|
||||
## extend availables questions types list.
|
||||
## See: TODO DOC LINK
|
||||
|
||||
[main.customization.project_name]
|
||||
|
||||
## (required) The ask property is equivalent to the ask property in
|
||||
## the manifest. However, in config panels, questions are displayed on the
|
||||
## left side and therefore have less space to be rendered. Therefore,
|
||||
## it is better to use a short question, and use the "help" property to
|
||||
## provide additional details if necessary.
|
||||
ask.en = "Name of the project"
|
||||
|
||||
## (required) The type property indicates how the question should be
|
||||
## displayed, validated and managed. Some types have specific properties.
|
||||
##
|
||||
## Types available: string, boolean, number, range, text, password, path
|
||||
## email, url, date, time, color, select, domain, user, tags, file.
|
||||
##
|
||||
## For a complete list with specific properties, see: TODO DOC LINK
|
||||
type = "string"
|
||||
|
||||
########################################################################
|
||||
#### ABOUT THE BIND PROPERTY
|
||||
########################################################################
|
||||
|
||||
## (recommended) 'bind' property is a powerful feature that let you
|
||||
## configure how and where the data will be read, validated and written.
|
||||
|
||||
## By default, 'bind property is in "settings" mode, it means it will
|
||||
## **only** read and write the value in application settings file.
|
||||
## bind = "settings"
|
||||
|
||||
## However, settings usually correspond to key/values in actual app configurations
|
||||
## Hence, a more useful mode is to have bind = ":FILENAME". In that case, YunoHost
|
||||
## will automagically find a line with "KEY=VALUE" in FILENAME
|
||||
## (with the adequate separator between KEY and VALUE)
|
||||
##
|
||||
## YunoHost will then use this value for the read/get operation.
|
||||
## During write/set operations, YunoHost will overwrite the value
|
||||
## in **both** FILENAME and in the app's settings.yml
|
||||
|
||||
## Configuration file format supported: yaml, toml, json, ini, env, php,
|
||||
## python. The feature probably works with others formats, but should be tested carefully.
|
||||
|
||||
## Note that this feature only works with relatively simple cases
|
||||
## such as `KEY: VALUE`, but won't properly work with
|
||||
## complex data structures like multilin array/lists or dictionnaries.
|
||||
## It also doesn't work with XML format, custom config function call, php define(), ...
|
||||
|
||||
## More info on TODO
|
||||
# bind = ":/var/www/__APP__/settings.py"
|
||||
|
||||
|
||||
## By default, bind = ":FILENAME" will use the question ID as KEY
|
||||
## ... but the question ID may sometime not be the exact KEY name in the configuration file.
|
||||
##
|
||||
## In particular, in pepettes, the python variable is 'name' and not 'project_name'
|
||||
## (c.f. https://github.com/YunoHost-Apps/pepettes_ynh/blob/5cc2d3ffd6529cc7356ff93af92dbb6785c3ab9a/conf/settings.py##L11 )
|
||||
##
|
||||
## In that case, the key name can be specified before the column ':'
|
||||
|
||||
bind = "name:/var/www/__APP__/settings.py"
|
||||
|
||||
## ---------------------------------------------------------------------
|
||||
## IMPORTANT: other 'bind' mode exists:
|
||||
##
|
||||
## bind = "FILENAME" (with no column character before FILENAME)
|
||||
## may be used to bind to the **entire file content** (instead of a single KEY/VALUE)
|
||||
## This could be used to expose an entire configuration file, or binary files such as images
|
||||
## For example:
|
||||
## bind = "/var/www/__APP__/img/logo.png"
|
||||
##
|
||||
## bind = "null" can be used to disable reading / writing in settings.
|
||||
## This creates sort of a "virtual" or "ephemeral" question which is not related to any actual setting
|
||||
## In this mode, you are expected to define custom getter/setters/validators in scripts/config:
|
||||
##
|
||||
## getter: get__QUESTIONID()
|
||||
## setter: set__QUESTIONID()
|
||||
## validator: validate__QUESTIONID()
|
||||
##
|
||||
## You can also specify a common getter / setter / validator, with the
|
||||
## function 'bind' mode, for example here it will try to run
|
||||
## get__array_settings() first.
|
||||
# bind = "array_settings()"
|
||||
## ---------------------------------------------------------------------
|
||||
|
||||
## ---------------------------------------------------------------------
|
||||
## IMPORTANT: with the exception of bind=null questions,
|
||||
## question IDs should almost **always** correspond to an app setting
|
||||
## initialized / reused during install/upgrade.
|
||||
## Not doing so may result in inconsistencies between the config panel mechanism
|
||||
## and the use of ynh_add_config
|
||||
## ---------------------------------------------------------------------
|
||||
|
||||
########################################################################
|
||||
#### OTHER GENERIC PROPERTY FOR QUESTIONS
|
||||
########################################################################
|
||||
|
||||
## (optional) An help text for the question
|
||||
help = "Fill the name of the project which will received donation"
|
||||
|
||||
## (optional) An example display as placeholder in web form
|
||||
# example = "YunoHost"
|
||||
|
||||
## (optional) set to true in order to redact the value in operation logs
|
||||
# redact = false
|
||||
|
||||
## (optional) A validation pattern
|
||||
## ---------------------------------------------------------------------
|
||||
## IMPORTANT: your pattern should be between simple quote, not double.
|
||||
## ---------------------------------------------------------------------
|
||||
pattern.regexp = '^\w{3,30}$'
|
||||
pattern.error = "The name should be at least 3 chars and less than 30 chars. Alphanumeric chars are accepted"
|
||||
|
||||
## Note: visible and optional properties are also available for questions
|
||||
|
||||
|
||||
[main.customization.contact_url]
|
||||
ask = "Contact url"
|
||||
type = "url"
|
||||
example = "mailto: contact@example.org"
|
||||
help = "mailto: accepted"
|
||||
pattern.regexp = '^mailto:[^@]+@[^@]+|https://$'
|
||||
pattern.error = "Should be https or mailto:"
|
||||
bind = ":/var/www/__APP__/settings.py"
|
||||
|
||||
[main.customization.logo]
|
||||
ask = "Logo"
|
||||
type = "file"
|
||||
accept = ".png"
|
||||
help = "Fill with an already resized logo"
|
||||
bind = "__FINALPATH__/img/logo.png"
|
||||
|
||||
[main.customization.favicon]
|
||||
ask = "Favicon"
|
||||
type = "file"
|
||||
accept = ".png"
|
||||
help = "Fill with an already sized favicon"
|
||||
bind = "__FINALPATH__/img/favicon.png"
|
||||
|
||||
|
||||
[main.stripe]
|
||||
name = "Stripe general info"
|
||||
optional = false
|
||||
|
||||
# The next alert is overwrited with a getter from the config script
|
||||
[main.stripe.amount]
|
||||
ask = "Donation in the month : XX €
|
||||
type = "alert"
|
||||
style = "success"
|
||||
|
||||
[main.stripe.publishable_key]
|
||||
ask = "Publishable key"
|
||||
type = "string"
|
||||
redact = true
|
||||
help = "Indicate here the stripe publishable key"
|
||||
bind = ":/var/www/__APP__/settings.py"
|
||||
|
||||
[main.stripe.secret_key]
|
||||
ask = "Secret key"
|
||||
type = "string"
|
||||
redact = true
|
||||
help = "Indicate here the stripe secret key"
|
||||
bind = ":/var/www/__APP__/settings.py"
|
||||
|
||||
[main.stripe.prices]
|
||||
ask = "Prices ID"
|
||||
type = "tags"
|
||||
help = """\
|
||||
Indicates here the prices ID of donation products you created in stripe interfaces. \
|
||||
Go on [Stripe products](https://dashboard.stripe.com/products) to create those donation products. \
|
||||
Fill it tag with 'FREQUENCY/CURRENCY/PRICE_ID' \
|
||||
FREQUENCY: 'one_time' or 'recuring' \
|
||||
CURRENCY: 'EUR' or 'USD' \
|
||||
PRICE_ID: ID from stripe interfaces starting with 'price_' \
|
||||
"""
|
||||
pattern.regexp = '^(one_time|recuring)/(EUR|USD)/price_.*$'
|
||||
pattern.error = "Please respect the format describe in help text for each price ID"
|
|
@ -1,75 +0,0 @@
|
|||
{
|
||||
"name": "Matrix IRC Bridge",
|
||||
"id": "matrix-appservice-irc",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Matrix bridge for IRC",
|
||||
"fr": "Passerelle Matrix pour IRC"
|
||||
},
|
||||
"version": "0.36.0~ynh1",
|
||||
"url": "https://github.com/matrix-org/matrix-appservice-irc",
|
||||
"upstream": {
|
||||
"license": "Apache-2.0",
|
||||
"admindoc": "https://matrix-org.github.io/matrix-appservice-irc/latest/bridge_setup",
|
||||
"userdoc": "https://matrix-org.github.io/matrix-appservice-irc/latest/usage",
|
||||
"code": "https://github.com/matrix-org/matrix-appservice-irc"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"maintainer": {
|
||||
"name": "Salamandar",
|
||||
"email": "felix@piedallu.me"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"postgresql"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "synapsenumber",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the local Synapse instance number to communicate with matrix-appservice-irc.",
|
||||
"fr": "Choisissez le numéro de l'instance Synapse qui doit communiquer avec matrix-appservice-irc."
|
||||
},
|
||||
"example": "2 (for instance synapse__2)",
|
||||
"help": {
|
||||
"en": "If you installed Synapse only once time, then leave default value 1.",
|
||||
"fr": "Si vous n'avez installé qu'une fois Synapse, gardez la valeur par défaut 1."
|
||||
},
|
||||
"default": "1"
|
||||
},
|
||||
{
|
||||
"name": "botname",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose a local Synapse user name for the irc bot",
|
||||
"fr": "Choisissez un nom d'utilisateur Synapse local pour le robot irc"
|
||||
},
|
||||
"example": "ircmatrixbot",
|
||||
"help": {
|
||||
"en": "A system user will be created. Invite @ircmatrixbot:localsynapse.servername from an authorized Matrix account to start bridging. Give the Matrix server_name, not the full domain/URL.",
|
||||
"fr": "Un utilisateur système sera créé. Inviter @ircmatrixbot:localsynapse.servername depuis un compte Matrix autorisé pour démarrer une passerelle. Donner le nom du serveur Matrix, pas le domaine/URL complet."
|
||||
},
|
||||
"default": "ircmatrixbot"
|
||||
},
|
||||
{
|
||||
"name": "botadmin",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the Matrix account administrator of the irc bridge",
|
||||
"fr": "Choisissez le compte Matrix administrateur de la passerelle irc"
|
||||
},
|
||||
"example": "@johndoe:localsynapse.servername or @johndoe:matrix.org",
|
||||
"help": {
|
||||
"en": "The irc bridge administrator does not need to be a local Synapse account.",
|
||||
"fr": "Le compte administrateur de la passerelle irc peut ne pas être un compte local Synapse."
|
||||
},
|
||||
"default": "Your main Matrix account"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
113
manifest.toml
Normal file
113
manifest.toml
Normal file
|
@ -0,0 +1,113 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||
|
||||
packaging_format = 2
|
||||
|
||||
id = "matrix-appservice-irc"
|
||||
name = "Matrix IRC Bridge"
|
||||
description.en = "Matrix bridge for IRC"
|
||||
description.fr = "Passerelle Matrix pour IRC"
|
||||
|
||||
version = "0.36.0~ynh1"
|
||||
|
||||
maintainers = ["Salamandar"]
|
||||
|
||||
[upstream]
|
||||
license = "Apache-2.0"
|
||||
code = "https://github.com/matrix-org/matrix-appservice-irc"
|
||||
admindoc = "https://matrix-org.github.io/matrix-appservice-irc/latest/bridge_setup"
|
||||
userdoc = "https://matrix-org.github.io/matrix-appservice-irc/latest/usage"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = false
|
||||
sso = false
|
||||
disk = "100M"
|
||||
ram.build = "256M"
|
||||
ram.runtime = "1024M"
|
||||
|
||||
[install]
|
||||
[install.synapse_instance]
|
||||
ask.en = "Choose the local Synapse instance to communicate with matrix-appservice-irc."
|
||||
ask.fr = "Choisissez l'instance Synapse qui doit communiquer avec matrix-appservice-irc."
|
||||
type = "app"
|
||||
pattern.regexp = "synapse(__)*[0-9]*"
|
||||
pattern.error = "Invalid app selected. Please select a Synapse instance."
|
||||
help.en = "Usually the Synapse instances contain a number after it is installed more than one time. E.g. synapse__1 will be the second instance."
|
||||
help.fr = "En général, les instances de Synapse contiennent un numéro après avoir été installées plus d'une fois. Par exemple, synapse__1 sera la deuxième instance."
|
||||
default = "synapse"
|
||||
|
||||
[install.botname]
|
||||
ask.en = "Choose a local Synapse user name for the irc bot"
|
||||
ask.fr = "Choisissez un nom d'utilisateur Synapse local pour le robot irc"
|
||||
help.en = "A system user will be created. Invite @ircmatrixbot:localsynapse.servername from an authorized Matrix account to start bridging. Give the Matrix server_name, not the full domain/URL."
|
||||
help.fr = "Un utilisateur système sera créé. Inviter @ircmatrixbot:localsynapse.servername depuis un compte Matrix autorisé pour démarrer une passerelle. Donner le nom du serveur Matrix, pas le domaine/URL complet."
|
||||
type = "string"
|
||||
example = "ircmatrixbot"
|
||||
default = "ircmatrixbot"
|
||||
|
||||
[install.bot_synapse_adm]
|
||||
ask.en = "Give the IRC bot administrator rights to the Synapse instance?"
|
||||
ask.fr = "Donner au robot IRC des droits administrateur à l'instance Synapse ?"
|
||||
type = "boolean"
|
||||
help.en = "If true, the bot can group IRC chats in a Matrix space.Not required if you set up Synapse so that non-admins are authorized to create communities."
|
||||
help.fr = "Si true, le robot groupera les conversations IRC dans une communauté Matrix.Pas nécessaire si vous avez réglé Synapse pour qu'il autorise les non-admin à créer des communautés."
|
||||
default = true
|
||||
|
||||
# TODO: is it supported?
|
||||
# [install.encryption]
|
||||
# ask.en = "Enable end-to-bridge encryption?"
|
||||
# ask.fr = "Activer le chiffrement entre Synapse et le bridge ?"
|
||||
# type = "boolean"
|
||||
# help.en = "Only activate if you know the prerequisites and constraints related to E2B."
|
||||
# help.fr = "N'activer que si vous connaissez les prérequis et constraintes liées à E2B."
|
||||
# default = true
|
||||
|
||||
[install.botadmin]
|
||||
ask.en = "Choose the Matrix account administrator of the IRC bot"
|
||||
ask.fr = "Choisissez le compte Matrix administrateur du robot IRC"
|
||||
type = "string"
|
||||
example = "@johndoe:localsynapse.servername or @johndoe:matrix.org"
|
||||
help.en = "The administrator does not need to be a local Synapse account. Valid formats are @johndoe:localsynapse.servername or @johndoe:matrix.org"
|
||||
help.fr = "L'administrateur peut ne pas être un compte local Synapse. Les formats valables sont @johndoe:localsynapse.servername or @johndoe:matrix.org"
|
||||
|
||||
[install.botusers]
|
||||
ask.en = "Choose Matrix user(s) authorized to bridge with the IRC bot."
|
||||
ask.fr = "Choisissez le/les compte(s) Matrix autorisés à utiliser la passerelle IRC."
|
||||
type = "string"
|
||||
example = "@johndoe:server.name or server.name or *"
|
||||
help.en = """
|
||||
A remote or local user (@johndoe:server.name),the local server (server.name), a remote server (matrix.org), or all remote/local servers (*) can be authorized.
|
||||
Give the Matrix server_name, not the full domain/URL.
|
||||
It is also possible to specify multiple values by separating them with comma. Example: @johndoe:server.name,domain.tld,matrix.org"""
|
||||
help.fr = """Un compte local ou distant (@johndoe:server.name), le serveur local (server.name), un serveur distant (matrix.org), ou tous les serveurs remote/local (*).
|
||||
Donner le nom du serveur Matrix, pas le domaine/URL complet.
|
||||
Il est également possible de spécifier plusieurs valeurs en les séparant par une virgule. Exemple : @johndoe:server.name,domain.tld,matrix.org"""
|
||||
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
url = "https://github.com/matrix-org/matrix-appservice-irc/archive/refs/tags/1.0.1.tar.gz"
|
||||
sha256 = "ac58ca1e7ed1a496b0ec69cd7079f67c2e3ad5007f24bdacd63fc992cc442ce3"
|
||||
|
||||
[resources.system_user]
|
||||
home = "/opt/yunohost/__APP__"
|
||||
|
||||
[resources.install_dir]
|
||||
dir = "/opt/yunohost/__APP__"
|
||||
|
||||
[resources.permissions]
|
||||
main.allowed = "all_users"
|
||||
main.auth_header = false
|
||||
|
||||
[resources.ports]
|
||||
main.default = 8095
|
||||
|
||||
[resources.apt]
|
||||
packages = [
|
||||
"postgresql",
|
||||
]
|
||||
|
||||
[resources.database]
|
||||
type = "postgresql"
|
|
@ -4,9 +4,6 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="postgresql"
|
||||
|
||||
nodejs_version=18
|
||||
|
||||
#=================================================
|
||||
|
@ -14,18 +11,20 @@ nodejs_version=18
|
|||
#=================================================
|
||||
|
||||
__ynh_register_synapse_app_service() {
|
||||
$final_path/bin/matrix-appservice-irc -r \
|
||||
-c $final_path/config.yaml \
|
||||
"$install_dir/bin/matrix-appservice-irc" -r \
|
||||
-c "$install_dir/config.yaml" \
|
||||
-u "http://localhost:$port" \
|
||||
-f $final_path/appservice-registration-irc.yaml
|
||||
|
||||
ynh_store_file_checksum --file=$final_path/appservice-registration-irc.yaml
|
||||
-f "$install_dir/appservice-registration-irc.yaml"
|
||||
|
||||
# This appservice needs it to be duplicated…
|
||||
cp $final_path/appservice-registration-irc.yaml /etc/matrix-$synapse_instance/app-service/$app.yaml
|
||||
cp "$install_dir/appservice-registration-irc.yaml" \
|
||||
"/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
||||
|
||||
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|
||||
|| ynh_die "Synapse can't restart with the appservice configuration"
|
||||
"/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh" \
|
||||
|| ynh_die --message="Synapse can't restart with the appservice configuration"
|
||||
|
||||
ynh_store_file_checksum --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
||||
ynh_store_file_checksum --file="$install_dir/appservice-registration-irc.yaml"
|
||||
}
|
||||
|
||||
# TODO:
|
||||
|
|
125
scripts/install
125
scripts/install
|
@ -9,50 +9,28 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER
|
||||
botname=$YNH_APP_ARG_BOTNAME
|
||||
botadmin=$YNH_APP_ARG_BOTADMIN
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
if [ "$synapsenumber" == "1" ]; then
|
||||
synapse_instance="synapse"
|
||||
else
|
||||
synapse_instance="synapse__$synapsenumber"
|
||||
fi
|
||||
|
||||
domain=$(ynh_app_setting_get --app "$synapse_instance" --key domain)
|
||||
# Retrieve some values from selected Synapse instance and store them
|
||||
server_name=$(ynh_app_setting_get --app "$synapse_instance" --key server_name)
|
||||
domain=$(ynh_app_setting_get --app "$synapse_instance" --key domain)
|
||||
ynh_app_setting_set --app="$app" --key=server_name --value="$server_name"
|
||||
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
||||
synapse_db_name="matrix_$synapse_instance"
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
final_path=/opt/yunohost/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# This is needed to convert the value from the manifest to a valid value for the config.yaml file.
|
||||
# Without this the install script will throw a warning.
|
||||
if [ "$encryption" -eq "1" ]; then
|
||||
encryption="true"
|
||||
else
|
||||
encryption="false"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
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=botname --value=$botname
|
||||
ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance
|
||||
ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
|
||||
|
||||
#=================================================
|
||||
# SET CONSTANTS
|
||||
|
@ -60,82 +38,51 @@ ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
|
|||
|
||||
enable_relaybot=true
|
||||
bot_synapse_db_user="@$botname:$server_name"
|
||||
synapse_db_name="matrix_$synapse_instance"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port for communication between the local synapse instance (home server) and the bridge app service.
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
ynh_script_progression --message="Installing NodeJS..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
ynh_use_nodejs
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
db_pwd=$(ynh_string_random --length=30)
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files and building the app..." --weight=3
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
pushd "$final_path" >/dev/null || ynh_die
|
||||
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm i
|
||||
popd >/dev/null || ynh_die
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:$app" "$install_dir"
|
||||
(
|
||||
cd "$install_dir"
|
||||
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" i
|
||||
)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml"
|
||||
ynh_store_file_checksum --file="$final_path/config.yaml"
|
||||
chmod 400 "$final_path/config.yaml"
|
||||
chown $app:$app "$final_path/config.yaml"
|
||||
ynh_add_config --template="../conf/config.yaml" --destination="$install_dir/config.yaml"
|
||||
|
||||
chmod 400 "$install_dir/config.yaml"
|
||||
chown "$app:$app" "$install_dir/config.yaml"
|
||||
|
||||
# Generate the password encryption key
|
||||
openssl genpkey -out $final_path/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
|
||||
chmod 400 "$final_path/passkey.pem"
|
||||
chown $app:$app "$final_path/passkey.pem"
|
||||
openssl genpkey -out "$install_dir/passkey.pem" -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
|
||||
chmod 400 "$install_dir/passkey.pem"
|
||||
chown "$app:$app" "$install_dir/passkey.pem"
|
||||
|
||||
#=================================================
|
||||
# REGISTER SYNAPSE APP-SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Registering Synapse app-service" --weight=1
|
||||
|
||||
__ynh_register_matrix_app_service
|
||||
|
||||
|
@ -155,17 +102,17 @@ ynh_add_systemd_config
|
|||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate --specific_user $app/$app
|
||||
ynh_use_logrotate --logfile "/var/log/$app/$app.log" --nonappend --specific_user "$app/$app"
|
||||
chmod -R 600 "/var/log/$app"
|
||||
chmod 700 "/var/log/$app"
|
||||
chown -R $app:$app /var/log/$app
|
||||
chown -R "$app:$app" "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="$app daemon for bridging IRC and Matrix." --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app --description="$app daemon for bridging IRC and Matrix messages." --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -173,10 +120,10 @@ yunohost service add $app --description="$app daemon for bridging IRC and Matrix
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Error: No IRC servers specified."
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="Error: No IRC servers specified."
|
||||
|
||||
ynh_print_warn "The bridge is successfully configured but non working yet!"
|
||||
ynh_print_warn "You need to edit the file $final_path/config.yaml to add IRC networks."
|
||||
ynh_print_warn "You need to edit the file $install_dir/config.yaml to add IRC networks."
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
54
tests.toml
Normal file
54
tests.toml
Normal file
|
@ -0,0 +1,54 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||
|
||||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
# For special usecases, sometimes you need to setup other things on the machine
|
||||
# prior to installing the app (such as installing another app)
|
||||
# (Remove this key entirely if not needed)
|
||||
preinstall = """
|
||||
sudo yunohost tools update apps
|
||||
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
|
||||
"""
|
||||
|
||||
# -------------------------------
|
||||
# Default args to use for install
|
||||
# -------------------------------
|
||||
|
||||
# By default, the CI will automagically fill the 'standard' args
|
||||
# such as domain, path, admin, is_public and password with relevant values
|
||||
# and also install args with a "default" provided in the manifest..
|
||||
# It should only make sense to declare custom args here for args with no default values
|
||||
|
||||
args.botadmin = "@johndoe:server.name"
|
||||
args.botusers = "server.name"
|
||||
|
||||
# -------------------------------
|
||||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
|
||||
# test_upgrade_from.1d57a3b.name = "Upgrade from 0.7.2" # After config panel was implemented
|
||||
# test_upgrade_from.ede12ed.name = "Upgrade from 0.8.0"
|
||||
|
||||
|
||||
# # This is an additional test suite
|
||||
# [multiple_botusers]
|
||||
|
||||
# preinstall = """
|
||||
# sudo yunohost tools update apps
|
||||
# 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
|
||||
# """
|
||||
|
||||
# # On additional tests suites, you can decide to run only specific tests
|
||||
|
||||
# only = ["install.subdir"]
|
||||
|
||||
# args.botadmin = "@johndoe:server.name"
|
||||
# args.botusers = "@john:server.name,@jdoe:server.name,@janedoe:server.name"
|
Loading…
Add table
Reference in a new issue