mirror of
https://github.com/YunoHost-Apps/matrix-appservice-irc_ynh.git
synced 2024-09-03 19:36:37 +02:00
Manifestv2 (#1)
This commit is contained in:
parent
e666ae1bf9
commit
bf54552149
24 changed files with 717 additions and 911 deletions
203
LICENSE
203
LICENSE
|
@ -1,4 +1,201 @@
|
||||||
File containing the license of your package.
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
More information here:
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
https://yunohost.org/packaging_apps_guidelines#yep-1-3
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
|
@ -6,6 +6,7 @@ It shall NOT be edited by hand.
|
||||||
# Matrix IRC Bridge for YunoHost
|
# Matrix IRC Bridge for YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/matrix-appservice-irc)  
|
[](https://dash.yunohost.org/appci/app/matrix-appservice-irc)  
|
||||||
|
|
||||||
[](https://install-app.yunohost.org/?app=matrix-appservice-irc)
|
[](https://install-app.yunohost.org/?app=matrix-appservice-irc)
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
@ -28,16 +29,8 @@ It is highly configurable and is currently used on the matrix.org homeserver to
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 0.36.0~ynh1
|
**Shipped version:** 0.36.0~ynh1
|
||||||
## Disclaimers / important information
|
|
||||||
|
|
||||||
WARNING: This bridge requires additional configuration in the configuration file.
|
|
||||||
|
|
||||||
* You need a local Matrix-synapse server (Yunohost app available)
|
|
||||||
* No connection to the Yunohost LDAP
|
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: <https://github.com/matrix-org/matrix-appservice-irc>
|
|
||||||
* Official user documentation: <https://matrix-org.github.io/matrix-appservice-irc/latest/usage>
|
* Official user documentation: <https://matrix-org.github.io/matrix-appservice-irc/latest/usage>
|
||||||
* Official admin documentation: <https://matrix-org.github.io/matrix-appservice-irc/latest/bridge_setup>
|
* Official admin documentation: <https://matrix-org.github.io/matrix-appservice-irc/latest/bridge_setup>
|
||||||
* Upstream app code repository: <https://github.com/matrix-org/matrix-appservice-irc>
|
* Upstream app code repository: <https://github.com/matrix-org/matrix-appservice-irc>
|
||||||
|
|
|
@ -6,6 +6,7 @@ It shall NOT be edited by hand.
|
||||||
# Matrix IRC Bridge pour YunoHost
|
# Matrix IRC Bridge pour YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/matrix-appservice-irc)  
|
[](https://dash.yunohost.org/appci/app/matrix-appservice-irc)  
|
||||||
|
|
||||||
[](https://install-app.yunohost.org/?app=matrix-appservice-irc)
|
[](https://install-app.yunohost.org/?app=matrix-appservice-irc)
|
||||||
|
|
||||||
*[Read this readme in english.](./README.md)*
|
*[Read this readme in english.](./README.md)*
|
||||||
|
@ -28,16 +29,8 @@ Elle est hautement configurable, et est actuellement uilisée sur matrix.org pou
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 0.36.0~ynh1
|
**Version incluse :** 0.36.0~ynh1
|
||||||
## Avertissements / informations importantes
|
|
||||||
|
|
||||||
ATTENTION : Cette passerelle requiert une configuration supplémentaire dans son fichier de configuration.
|
|
||||||
|
|
||||||
* Vous avez besoin d'un serveur local Matrix-Synapse (appli Yunohost disponible)
|
|
||||||
* Aucune connection au LDAP de Yunohost
|
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l’app : <https://github.com/matrix-org/matrix-appservice-irc>
|
|
||||||
* Documentation officielle utilisateur : <https://matrix-org.github.io/matrix-appservice-irc/latest/usage>
|
* Documentation officielle utilisateur : <https://matrix-org.github.io/matrix-appservice-irc/latest/usage>
|
||||||
* Documentation officielle de l’admin : <https://matrix-org.github.io/matrix-appservice-irc/latest/bridge_setup>
|
* Documentation officielle de l’admin : <https://matrix-org.github.io/matrix-appservice-irc/latest/bridge_setup>
|
||||||
* Dépôt de code officiel de l’app : <https://github.com/matrix-org/matrix-appservice-irc>
|
* Dépôt de code officiel de l’app : <https://github.com/matrix-org/matrix-appservice-irc>
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
# See here for more information
|
|
||||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
|
||||||
|
|
||||||
# Move this file from check_process.default to check_process when you have filled it.
|
|
||||||
|
|
||||||
;; Test complet
|
|
||||||
; Manifest
|
|
||||||
domain="domain.tld"
|
|
||||||
path="/path"
|
|
||||||
admin="john"
|
|
||||||
language="fr"
|
|
||||||
is_public=1
|
|
||||||
password="1Strong-Password"
|
|
||||||
port="666"
|
|
||||||
; Checks
|
|
||||||
pkg_linter=1
|
|
||||||
setup_sub_dir=1
|
|
||||||
setup_root=1
|
|
||||||
setup_nourl=0
|
|
||||||
setup_private=1
|
|
||||||
setup_public=1
|
|
||||||
upgrade=1
|
|
||||||
upgrade=1 from_commit=CommitHash
|
|
||||||
backup_restore=1
|
|
||||||
multi_instance=1
|
|
||||||
port_already_use=0
|
|
||||||
change_url=1
|
|
||||||
;;; Options
|
|
||||||
Email=
|
|
||||||
Notification=none
|
|
||||||
;;; Upgrade options
|
|
||||||
; commit=CommitHash
|
|
||||||
name=Name and date of the commit.
|
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
# GENERATED BY YUNOHOST FROM UPSTREAM VERSION 0.32.1
|
# GENERATED BY YUNOHOST FROM UPSTREAM VERSION 1.0.1
|
||||||
|
|
||||||
# Configuration specific to AS registration. Unless other marked, all fields
|
# Configuration specific to AS registration. Unless other marked, all fields
|
||||||
# are *REQUIRED*.
|
# are *REQUIRED*.
|
||||||
|
@ -38,7 +38,7 @@ homeserver:
|
||||||
|
|
||||||
# Which port should the appservice bind to. Can be overriden by the one provided in the
|
# Which port should the appservice bind to. Can be overriden by the one provided in the
|
||||||
# command line! Optional.
|
# command line! Optional.
|
||||||
# bindPort: 9999
|
# bindPort: 8090
|
||||||
|
|
||||||
# Use this option to force the appservice to listen on another hostname for transactions.
|
# Use this option to force the appservice to listen on another hostname for transactions.
|
||||||
# This is NOT your synapse hostname. E.g. use 127.0.0.1 to only listen locally. Optional.
|
# This is NOT your synapse hostname. E.g. use 127.0.0.1 to only listen locally. Optional.
|
||||||
|
@ -334,8 +334,8 @@ ircService:
|
||||||
# The display name to use for created matrix clients. This should have
|
# The display name to use for created matrix clients. This should have
|
||||||
# $NICK somewhere in it if it is specified. Can also use $SERVER to
|
# $NICK somewhere in it if it is specified. Can also use $SERVER to
|
||||||
# insert the IRC domain.
|
# insert the IRC domain.
|
||||||
# Optional. Default: "$NICK (IRC)". Example: "Alice (IRC)"
|
# Optional. Default: "$NICK". Example: "Alice"
|
||||||
displayName: "$NICK (IRC)"
|
displayName: "$NICK"
|
||||||
# Number of tries a client can attempt to join a room before the request
|
# Number of tries a client can attempt to join a room before the request
|
||||||
# is discarded. You can also use -1 to never retry or 0 to never give up.
|
# is discarded. You can also use -1 to never retry or 0 to never give up.
|
||||||
# Optional. Default: -1
|
# Optional. Default: -1
|
||||||
|
@ -373,6 +373,16 @@ ircService:
|
||||||
# Older kernels will need IP_FREEBIND, which requires an LD_PRELOAD with the library
|
# Older kernels will need IP_FREEBIND, which requires an LD_PRELOAD with the library
|
||||||
# https://github.com/matrix-org/freebindfree as Node does not expose setsockopt.
|
# https://github.com/matrix-org/freebindfree as Node does not expose setsockopt.
|
||||||
# prefix: "2001:0db8:85a3::" # modify appropriately
|
# prefix: "2001:0db8:85a3::" # modify appropriately
|
||||||
|
|
||||||
|
# Optional. Define blocks of IPv6 addresses for different homeservers
|
||||||
|
# which can be used to restrict users of those homeservers to a given
|
||||||
|
# IP. These blocks should be considered immutable once set, as changing
|
||||||
|
# the startFrom value will NOT adjust existing IP addresses.
|
||||||
|
# Changing the startFrom value to a lower value may conflict with existing clients.
|
||||||
|
# Multiple homeservers may NOT share blocks.
|
||||||
|
blocks:
|
||||||
|
- homeserver: another-server.org
|
||||||
|
startFrom: '10:0000'
|
||||||
#
|
#
|
||||||
# The maximum amount of time in seconds that the client can exist
|
# The maximum amount of time in seconds that the client can exist
|
||||||
# without sending another message before being disconnected. Use 0 to
|
# without sending another message before being disconnected. Use 0 to
|
||||||
|
@ -461,7 +471,6 @@ ircService:
|
||||||
|
|
||||||
# Configuration for logging. Optional. Default: console debug level logging
|
# Configuration for logging. Optional. Default: console debug level logging
|
||||||
# only.
|
# only.
|
||||||
# This key CANNOT be hot-reloaded
|
|
||||||
logging:
|
logging:
|
||||||
# Level to log on console/logfile. One of error|warn|info|debug
|
# Level to log on console/logfile. One of error|warn|info|debug
|
||||||
level: "warn"
|
level: "warn"
|
||||||
|
@ -480,7 +489,7 @@ ircService:
|
||||||
# This key CANNOT be hot-reloaded
|
# This key CANNOT be hot-reloaded
|
||||||
metrics:
|
metrics:
|
||||||
# Whether to actually enable the metric endpoint. Default: false
|
# Whether to actually enable the metric endpoint. Default: false
|
||||||
enabled: true
|
enabled: false
|
||||||
# Which port to listen on (omit to listen on the bindPort)
|
# Which port to listen on (omit to listen on the bindPort)
|
||||||
port: 7001
|
port: 7001
|
||||||
# Which hostname to listen on (omit to listen on 127.0.0.1), requires port to be set
|
# Which hostname to listen on (omit to listen on 127.0.0.1), requires port to be set
|
||||||
|
@ -512,15 +521,15 @@ ircService:
|
||||||
port: 11100
|
port: 11100
|
||||||
|
|
||||||
# Configuration for the provisioning API.
|
# Configuration for the provisioning API.
|
||||||
#
|
|
||||||
# GET /_matrix/provision/link
|
|
||||||
# GET /_matrix/provision/unlink
|
|
||||||
# GET /_matrix/provision/listlinks
|
|
||||||
#
|
|
||||||
# This key CANNOT be hot-reloaded
|
# This key CANNOT be hot-reloaded
|
||||||
provisioning:
|
provisioning:
|
||||||
# True to enable the provisioning HTTP endpoint. Default: false.
|
# True to enable the provisioning HTTP endpoint. Default: false.
|
||||||
enabled: false
|
enabled: false
|
||||||
|
# Whether to enable hosting the setup widget page. Default: false.
|
||||||
|
widget: true
|
||||||
|
# A secure secret token for making provisioner requests. Default: the appservice hs_token.
|
||||||
|
secret: $generateMe
|
||||||
|
|
||||||
# The number of seconds to wait before giving up on getting a response from
|
# The number of seconds to wait before giving up on getting a response from
|
||||||
# an IRC channel operator. If the channel operator does not respond within the
|
# an IRC channel operator. If the channel operator does not respond within the
|
||||||
# allotted time period, the provisioning request will fail.
|
# allotted time period, the provisioning request will fail.
|
||||||
|
@ -540,11 +549,46 @@ ircService:
|
||||||
# These users will deny a room from being bridged.
|
# These users will deny a room from being bridged.
|
||||||
- "@.*:badguys.com"
|
- "@.*:badguys.com"
|
||||||
|
|
||||||
# Watch the file for changes, and apply the rules. Default: false
|
|
||||||
enableReload: true
|
|
||||||
# Number of channels allowed to be bridged
|
# Number of channels allowed to be bridged
|
||||||
roomLimit: 50
|
roomLimit: 50
|
||||||
|
|
||||||
|
# Endpoint prefix for provisoning requests. Default: "/_matrix/provision"
|
||||||
|
# apiPrefix: "/_matrix/provision"
|
||||||
|
# Whether to apply rate limiting to the provisioning API. Default: true.
|
||||||
|
# ratelimit: true
|
||||||
|
|
||||||
|
# Run a separate HTTP listener for provisioning requests.
|
||||||
|
http:
|
||||||
|
# The port to listen on.
|
||||||
|
port: 7700
|
||||||
|
# The host to listen on. Optional. By default this is 0.0.0.0
|
||||||
|
# host: 0.0.0.0
|
||||||
|
|
||||||
|
# When users request a token from the bridge to make provisioning
|
||||||
|
# requests, disallow any requests that resolve a Matrix server_name included in these ranges.
|
||||||
|
# This list should include any internal IPs that the bridge should never lookup.
|
||||||
|
# By default, the below list is used.
|
||||||
|
# openIdDisallowedIpRanges:
|
||||||
|
# - '127.0.0.0/8'
|
||||||
|
# - '10.0.0.0/8'
|
||||||
|
# - '172.16.0.0/12'
|
||||||
|
# - '192.168.0.0/16'
|
||||||
|
# - '100.64.0.0/10'
|
||||||
|
# - '192.0.0.0/24'
|
||||||
|
# - '169.254.0.0/16'
|
||||||
|
# - '192.88.99.0/24'
|
||||||
|
# - '198.18.0.0/15'
|
||||||
|
# - '192.0.2.0/24'
|
||||||
|
# - '198.51.100.0/24'
|
||||||
|
# - '203.0.113.0/24'
|
||||||
|
# - '224.0.0.0/4'
|
||||||
|
# - '::1/128'
|
||||||
|
# - 'fe80::/10'
|
||||||
|
# - 'fc00::/7'
|
||||||
|
# - '2001:db8::/32'
|
||||||
|
# - 'ff00::/8'
|
||||||
|
# - 'fec0::/10'
|
||||||
|
|
||||||
# WARNING: The bridge needs to send plaintext passwords to the IRC server, it cannot
|
# WARNING: The bridge needs to send plaintext passwords to the IRC server, it cannot
|
||||||
# send a password hash. As a result, passwords (NOT hashes) are stored encrypted in
|
# send a password hash. As a result, passwords (NOT hashes) are stored encrypted in
|
||||||
# the database.
|
# the database.
|
||||||
|
@ -575,6 +619,7 @@ ircService:
|
||||||
# Maximum number of montly active users, beyond which the bridge gets blocked (both ways)
|
# Maximum number of montly active users, beyond which the bridge gets blocked (both ways)
|
||||||
# RMAUlimit: 100
|
# RMAUlimit: 100
|
||||||
|
|
||||||
|
# Optional.
|
||||||
# userActivity:
|
# userActivity:
|
||||||
# The "grace period" before we start counting users as active
|
# The "grace period" before we start counting users as active
|
||||||
# minUserActiveDays: 1
|
# minUserActiveDays: 1
|
||||||
|
@ -623,6 +668,13 @@ ircService:
|
||||||
# the configuration in the config file.
|
# the configuration in the config file.
|
||||||
# allowUnconnectedMatrixUsers: true
|
# allowUnconnectedMatrixUsers: true
|
||||||
|
|
||||||
|
# Options for hooking into Matrix moderation policy lists
|
||||||
|
banLists:
|
||||||
|
# A list of rooms containing "m.policy.rule.*" events which can be used
|
||||||
|
# to identify banned users, rooms and servers.
|
||||||
|
rooms:
|
||||||
|
- "#matrix-org-coc-bl:matrix.org"
|
||||||
|
|
||||||
# Options here are generally only applicable to large-scale bridges and may have
|
# Options here are generally only applicable to large-scale bridges and may have
|
||||||
# consequences greater than other options in this configuration file.
|
# consequences greater than other options in this configuration file.
|
||||||
advanced:
|
advanced:
|
||||||
|
@ -655,3 +707,11 @@ database:
|
||||||
# For postgres, it must start with postgres://
|
# For postgres, it must start with postgres://
|
||||||
# For NeDB, it must start with nedb://. The path is relative to the project directory.
|
# For NeDB, it must start with nedb://. The path is relative to the project directory.
|
||||||
connectionString: "postgres://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__"
|
connectionString: "postgres://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__"
|
||||||
|
|
||||||
|
# Enable running IRC connections out of a secondary process.
|
||||||
|
# See https://matrix-org.github.io/matrix-appservice-irc/latest/connection_pooling.html for more information
|
||||||
|
# connectionPool:
|
||||||
|
# # The Redis URI to connect to
|
||||||
|
# redisUrl: redis://user:password@host:port/dbnum
|
||||||
|
# # Should the connections persist after the bridge successfully shuts down?
|
||||||
|
# persistConnectionsOnShutdown: true
|
||||||
|
|
|
@ -6,9 +6,9 @@ After=matrix-synapse.target
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
Environment="__YNH_NODE_LOAD_PATH__"
|
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
|
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||||
StandardError=inherit
|
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,4 +0,0 @@
|
||||||
WARNING: This bridge requires additional configuration in the configuration file.
|
|
||||||
|
|
||||||
* You need a local Matrix-synapse server (Yunohost app available)
|
|
||||||
* No connection to the Yunohost LDAP
|
|
|
@ -1,4 +0,0 @@
|
||||||
ATTENTION : Cette passerelle requiert une configuration supplémentaire dans son fichier de configuration.
|
|
||||||
|
|
||||||
* Vous avez besoin d'un serveur local Matrix-Synapse (appli Yunohost disponible)
|
|
||||||
* Aucune connection au LDAP de Yunohost
|
|
79
doc/POST_INSTALL.md
Normal file
79
doc/POST_INSTALL.md
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
### Bridge configuration
|
||||||
|
|
||||||
|
The bridge needs to be configure after installation.
|
||||||
|
|
||||||
|
Please edit the file `__INSTALL_DIR__/config.yaml` to add IRC servers, then run `sudo systemctl restart __APP__.service`.
|
||||||
|
|
||||||
|
This file's documentation is here: <https://github.com/matrix-org/matrix-appservice-irc/blob/develop/config.sample.yaml>.
|
||||||
|
|
||||||
|
Here's a simple IRC server configuration:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
irc.example.com:
|
||||||
|
name: "MyServer"
|
||||||
|
port: 6697
|
||||||
|
ssl: true
|
||||||
|
|
||||||
|
# A map for conversion of IRC user modes to Matrix power levels. This enables bridging
|
||||||
|
# of IRC ops to Matrix power levels only, it does not enable the reverse. If a user has
|
||||||
|
# been given multiple modes, the one that maps to the highest power level will be used.
|
||||||
|
modePowerMap:
|
||||||
|
o: 50
|
||||||
|
v: 1
|
||||||
|
|
||||||
|
botConfig:
|
||||||
|
enabled: true
|
||||||
|
nick: "MatrixBot"
|
||||||
|
username: "matrixbot"
|
||||||
|
joinChannelsIfNoUsers: false
|
||||||
|
|
||||||
|
privateMessages:
|
||||||
|
enabled: true
|
||||||
|
federate: true
|
||||||
|
|
||||||
|
dynamicChannels:
|
||||||
|
enabled: true
|
||||||
|
createAlias: true
|
||||||
|
published: true
|
||||||
|
federate: true
|
||||||
|
aliasTemplate: "#irc_$CHANNEL"
|
||||||
|
|
||||||
|
# What should the join_rule be for the new Matrix room? If 'public',
|
||||||
|
# anyone can join the room. If 'invite', only users with an invite can
|
||||||
|
# join the room. Note that if an IRC channel has +k or +i set on it,
|
||||||
|
# join_rules will be set to 'invite' until these modes are removed.
|
||||||
|
# Default: "public".
|
||||||
|
joinRule: public
|
||||||
|
# A list of user IDs which the AS bot will send invites to in response
|
||||||
|
# to a !join. Only applies if joinRule is 'invite'. Default: []
|
||||||
|
# whitelist:
|
||||||
|
# - "@foo:example.com"
|
||||||
|
# - "@bar:example.com"
|
||||||
|
#
|
||||||
|
# Prevent the given list of channels from being mapped under any
|
||||||
|
# circumstances.
|
||||||
|
# exclude: ["#foo", "#bar"]
|
||||||
|
|
||||||
|
# excludedUsers:
|
||||||
|
# - regex: "@.*:evilcorp.com"
|
||||||
|
# kickReason: "We don't like Evilcorp"
|
||||||
|
|
||||||
|
matrixClients:
|
||||||
|
userTemplate: "@irc_$NICK"
|
||||||
|
displayName: "$NICK"
|
||||||
|
joinAttempts: -1
|
||||||
|
|
||||||
|
ircClients:
|
||||||
|
nickTemplate: "$DISPLAY[m]"
|
||||||
|
allowNickChanges: true
|
||||||
|
maxClients: 30
|
||||||
|
|
||||||
|
# The number of lines to allow being sent by the IRC client that has received
|
||||||
|
# a large block of text to send from matrix. If the number of lines that would
|
||||||
|
# be sent is > lineLimit, the text will instead be uploaded to matrix and the
|
||||||
|
# resulting URI is treated as a file. As such, a link will be sent to the IRC
|
||||||
|
# side instead of potentially spamming IRC and getting the IRC client kicked.
|
||||||
|
# Default: 3.
|
||||||
|
lineLimit: 10
|
||||||
|
|
||||||
|
```
|
79
doc/POST_INSTALL_fr.md
Normal file
79
doc/POST_INSTALL_fr.md
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
### Configuration de la passerelle
|
||||||
|
|
||||||
|
La passerelle nécessite d'être configurée après installation.
|
||||||
|
|
||||||
|
Veuillez éditer le fichier `__INSTALL_DIR__/config.yaml` pour rajouter des serveurs IRC, puis exécutez `sudo systemctl restart __APP__.service`.
|
||||||
|
|
||||||
|
Vous pouvez vous référer à <https://github.com/matrix-org/matrix-appservice-irc/blob/develop/config.sample.yaml> pour les détails concernant ce fichier.
|
||||||
|
|
||||||
|
Voici une configuration simple de serveur IRC:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
irc.example.com:
|
||||||
|
name: "MyServer"
|
||||||
|
port: 6697
|
||||||
|
ssl: true
|
||||||
|
|
||||||
|
# A map for conversion of IRC user modes to Matrix power levels. This enables bridging
|
||||||
|
# of IRC ops to Matrix power levels only, it does not enable the reverse. If a user has
|
||||||
|
# been given multiple modes, the one that maps to the highest power level will be used.
|
||||||
|
modePowerMap:
|
||||||
|
o: 50
|
||||||
|
v: 1
|
||||||
|
|
||||||
|
botConfig:
|
||||||
|
enabled: true
|
||||||
|
nick: "MatrixBot"
|
||||||
|
username: "matrixbot"
|
||||||
|
joinChannelsIfNoUsers: false
|
||||||
|
|
||||||
|
privateMessages:
|
||||||
|
enabled: true
|
||||||
|
federate: true
|
||||||
|
|
||||||
|
dynamicChannels:
|
||||||
|
enabled: true
|
||||||
|
createAlias: true
|
||||||
|
published: true
|
||||||
|
federate: true
|
||||||
|
aliasTemplate: "#irc_$CHANNEL"
|
||||||
|
|
||||||
|
# What should the join_rule be for the new Matrix room? If 'public',
|
||||||
|
# anyone can join the room. If 'invite', only users with an invite can
|
||||||
|
# join the room. Note that if an IRC channel has +k or +i set on it,
|
||||||
|
# join_rules will be set to 'invite' until these modes are removed.
|
||||||
|
# Default: "public".
|
||||||
|
joinRule: public
|
||||||
|
# A list of user IDs which the AS bot will send invites to in response
|
||||||
|
# to a !join. Only applies if joinRule is 'invite'. Default: []
|
||||||
|
# whitelist:
|
||||||
|
# - "@foo:example.com"
|
||||||
|
# - "@bar:example.com"
|
||||||
|
#
|
||||||
|
# Prevent the given list of channels from being mapped under any
|
||||||
|
# circumstances.
|
||||||
|
# exclude: ["#foo", "#bar"]
|
||||||
|
|
||||||
|
# excludedUsers:
|
||||||
|
# - regex: "@.*:evilcorp.com"
|
||||||
|
# kickReason: "We don't like Evilcorp"
|
||||||
|
|
||||||
|
matrixClients:
|
||||||
|
userTemplate: "@irc_$NICK"
|
||||||
|
displayName: "$NICK"
|
||||||
|
joinAttempts: -1
|
||||||
|
|
||||||
|
ircClients:
|
||||||
|
nickTemplate: "$DISPLAY[m]"
|
||||||
|
allowNickChanges: true
|
||||||
|
maxClients: 30
|
||||||
|
|
||||||
|
# The number of lines to allow being sent by the IRC client that has received
|
||||||
|
# a large block of text to send from matrix. If the number of lines that would
|
||||||
|
# be sent is > lineLimit, the text will instead be uploaded to matrix and the
|
||||||
|
# resulting URI is treated as a file. As such, a link will be sent to the IRC
|
||||||
|
# side instead of potentially spamming IRC and getting the IRC client kicked.
|
||||||
|
# Default: 3.
|
||||||
|
lineLimit: 10
|
||||||
|
|
||||||
|
```
|
3
doc/PRE_INSTALL.md
Normal file
3
doc/PRE_INSTALL.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
This app requires the Matrix server Synapse to be installed first in Yunohost.
|
||||||
|
|
||||||
|
Also, you will have to configure the bridge into its configuration file.
|
3
doc/PRE_INSTALL_fr.md
Normal file
3
doc/PRE_INSTALL_fr.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Cette application nécessite d'installer d'abord le serveur Matrix Synapse dans Yunohost.
|
||||||
|
|
||||||
|
Vous aurez aussi besoin de configurer la passerelle dans son fichier de configuration
|
|
@ -1,76 +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": "free",
|
|
||||||
"website": "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",
|
|
||||||
"code": "https://github.com/matrix-org/matrix-appservice-irc"
|
|
||||||
},
|
|
||||||
"license": "free",
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
112
manifest.toml
Normal file
112
manifest.toml
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
#: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
|
||||||
|
|
||||||
|
[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 *"
|
||||||
|
[install.botusers.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"""
|
||||||
|
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"
|
||||||
|
autoupdate.strategy = "latest_github_release"
|
||||||
|
autoupdate.asset = "*.tar.gz"
|
||||||
|
|
||||||
|
[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",
|
||||||
|
]
|
||||||
|
|
||||||
|
extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main"
|
||||||
|
extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||||
|
extras.yarn.packages = "yarn"
|
||||||
|
|
||||||
|
[resources.database]
|
||||||
|
type = "postgresql"
|
|
@ -4,15 +4,38 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
nodejs_version=18
|
||||||
pkg_dependencies="postgresql"
|
|
||||||
|
|
||||||
nodejs_version=14
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
__ynh_register_synapse_app_service() {
|
||||||
|
"$install_dir/bin/matrix-appservice-irc" -r \
|
||||||
|
-c "$install_dir/config.yaml" \
|
||||||
|
-u "http://127.0.0.1:$port" \
|
||||||
|
-f "$install_dir/appservice-registration-irc.yaml"
|
||||||
|
|
||||||
|
# This appservice needs it to be duplicated…
|
||||||
|
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 --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:
|
||||||
|
__ynh_register_dendrite_app_service() {
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
|
__ynh_register_matrix_app_service() {
|
||||||
|
__ynh_register_synapse_app_service
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,27 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Loading installation settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -40,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
@ -61,8 +40,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
ynh_print_info --message="Backing up the PostgreSQL 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_psql_dump_db --database="$db_name" > db.sql
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,134 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
|
||||||
old_path=$YNH_APP_OLD_PATH
|
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
|
||||||
new_path=$YNH_APP_NEW_PATH
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
|
||||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
#db_user=$db_name
|
|
||||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
|
|
||||||
# Restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
change_domain=0
|
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
|
||||||
then
|
|
||||||
change_domain=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
change_path=0
|
|
||||||
if [ "$old_path" != "$new_path" ]
|
|
||||||
then
|
|
||||||
change_path=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# STOP SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MODIFY URL IN NGINX CONF
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
|
||||||
|
|
||||||
# Change the path in the NGINX config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original NGINX config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
|
||||||
# Set global variables for NGINX helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for NGINX
|
|
||||||
if [ $change_domain -eq 1 ]
|
|
||||||
then
|
|
||||||
# Delete file checksum for the old conf file location
|
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
|
||||||
# Store file checksum for the new config file location
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# ...
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
|
||||||
# START SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# END OF SCRIPT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
|
132
scripts/install
132
scripts/install
|
@ -9,50 +9,20 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
# Retrieve some values from selected Synapse instance and store them
|
||||||
# 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)
|
|
||||||
server_name=$(ynh_app_setting_get --app "$synapse_instance" --key server_name)
|
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"
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
||||||
#=================================================
|
synapse_db_name="matrix_$synapse_instance"
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
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=botname --value=$botname
|
||||||
ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance
|
ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance
|
||||||
ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET CONSTANTS
|
# SET CONSTANTS
|
||||||
|
@ -60,95 +30,53 @@ ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
|
||||||
|
|
||||||
enable_relaybot=true
|
enable_relaybot=true
|
||||||
bot_synapse_db_user="@$botname:$server_name"
|
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
|
# 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_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
ynh_use_nodejs
|
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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files and building the app..." --weight=3
|
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
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:$app "$final_path"
|
chown -R "$app:$app" "$install_dir"
|
||||||
|
(
|
||||||
pushd "$final_path" >/dev/null || ynh_die
|
cd "$install_dir"
|
||||||
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm i
|
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" i
|
||||||
popd >/dev/null || ynh_die
|
)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml"
|
ynh_add_config --template="../conf/config.yaml" --destination="$install_dir/config.yaml"
|
||||||
ynh_store_file_checksum --file="$final_path/config.yaml"
|
|
||||||
chmod 400 "$final_path/config.yaml"
|
chmod 400 "$install_dir/config.yaml"
|
||||||
chown $app:$app "$final_path/config.yaml"
|
chown "$app:$app" "$install_dir/config.yaml"
|
||||||
|
|
||||||
# Generate the password encryption key
|
# Generate the password encryption key
|
||||||
openssl genpkey -out $final_path/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
|
openssl genpkey -out "$install_dir/passkey.pem" -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
|
||||||
chmod 400 "$final_path/passkey.pem"
|
chmod 400 "$install_dir/passkey.pem"
|
||||||
chown $app:$app "$final_path/passkey.pem"
|
chown "$app:$app" "$install_dir/passkey.pem"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REGISTER SYNAPSE APP-SERVICE
|
# REGISTER SYNAPSE APP-SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Registering Synapse app-service" --weight=1
|
||||||
|
|
||||||
$final_path/bin/matrix-appservice-irc -r \
|
__ynh_register_matrix_app_service
|
||||||
-c $final_path/config.yaml \
|
|
||||||
-u "http://localhost:$port" \
|
|
||||||
-f $final_path/appservice-registration-irc.yaml
|
|
||||||
|
|
||||||
ynh_store_file_checksum --file=$final_path/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
|
|
||||||
|
|
||||||
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|
|
||||||
|| ynh_die "Synapse can't restart with the appservice configuration"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -166,17 +94,17 @@ ynh_add_systemd_config
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# 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 -R 600 "/var/log/$app"
|
||||||
chmod 700 "/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
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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
|
# START SYSTEMD SERVICE
|
||||||
|
@ -184,10 +112,10 @@ yunohost service add $app --description="$app daemon for bridging IRC and Matrix
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# 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 "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
|
# END OF SCRIPT
|
||||||
|
|
|
@ -9,17 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -29,14 +18,14 @@ synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..." --time --weight=1
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP AND REMOVE SERVICE
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
@ -44,34 +33,16 @@ ynh_remove_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..." --time --weight=1
|
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
|
||||||
ynh_psql_remove_db --db_user=$db_name --db_name=$db_name
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing app main directory..." --time --weight=1
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing dependencies..." --time --weight=1
|
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
ynh_remove_nodejs
|
ynh_remove_nodejs
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -81,26 +52,15 @@ ynh_remove_nodejs
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing synapse app service..." --weight=6
|
ynh_script_progression --message="Removing synapse app service..." --weight=6
|
||||||
|
|
||||||
|
# Remove a directory securely
|
||||||
ynh_secure_remove --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
ynh_secure_remove --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
||||||
|
"/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh" || ynh_die --message="Synapse can't restart with the appservice configuration"
|
||||||
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|
|
||||||
|| ynh_die "Synapse can't restart with the appservice configuration"
|
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --time --last
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
102
scripts/restore
102
scripts/restore
|
@ -10,126 +10,76 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
synapse_db_name="matrix_$synapse_instance"
|
||||||
true
|
bot_synapse_db_user="@$botname:$server_name"
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD RESTORATION STEPS
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --time --weight=1
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R 750 "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R "$app:$app" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --time --weight=1
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
|
|
||||||
ynh_psql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# REGISTER SYNAPSE APP-SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring various files..." --time --weight=1
|
ynh_script_progression --message="Registering Synapse app-service" --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
__ynh_register_matrix_app_service
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/$app/"
|
chmod 400 "$install_dir/config.yaml"
|
||||||
|
chown "$app:$app" "$install_dir/config.yaml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable "$app.service" --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1
|
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
mkdir --parents "/var/log/$app"
|
||||||
|
chmod -R 600 "/var/log/$app"
|
||||||
|
chmod 700 "/var/log/$app"
|
||||||
|
chown -R "$app:$app" "/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="A short description of the app" --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
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX AND PHP-FPM
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --time --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --time --last
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
|
@ -9,43 +9,12 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
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)
|
|
||||||
botadmin=$(ynh_app_setting_get --app=$app --key=botadmin)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -60,14 +29,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -77,21 +38,19 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading 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_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -101,9 +60,10 @@ ynh_use_nodejs
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading the app..." --weight=1
|
ynh_script_progression --message="Upgrading the app..." --weight=1
|
||||||
|
|
||||||
pushd "$final_path" >/dev/null || ynh_die
|
(
|
||||||
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm i
|
cd "$install_dir"
|
||||||
popd >/dev/null || ynh_die
|
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" i
|
||||||
|
)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
|
@ -111,42 +71,31 @@ popd >/dev/null || ynh_die
|
||||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
configured_servers=$(python3 -c "import yaml
|
configured_servers=$(python3 -c "import yaml
|
||||||
with open('$final_path/config.yaml') as c: c = yaml.load(c, Loader=yaml.SafeLoader)
|
with open('$install_dir/config.yaml') as c: c = yaml.load(c, Loader=yaml.SafeLoader)
|
||||||
print(yaml.dump(c['ircService']['servers']))")
|
print(yaml.dump(c['ircService']['servers']))")
|
||||||
|
|
||||||
### Same as during install
|
### Same as during install
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml"
|
ynh_add_config --template="../conf/config.yaml" --destination="$install_dir/config.yaml"
|
||||||
|
|
||||||
# Try to recover the previously configured IRC servers.
|
# Try to recover the previously configured IRC servers.
|
||||||
python3 -c "import yaml
|
python3 -c "import yaml
|
||||||
with open('$final_path/config.yaml') as c: c = yaml.load(c, Loader=yaml.SafeLoader)
|
with open('$install_dir/config.yaml') as c: c = yaml.load(c, Loader=yaml.SafeLoader)
|
||||||
servers = yaml.safe_load('''$configured_servers''')
|
servers = yaml.safe_load('''$configured_servers''')
|
||||||
c['ircService']['servers'] = servers
|
c['ircService']['servers'] = servers
|
||||||
print(yaml.dump(c))" > $final_path/config.yaml.temp
|
print(yaml.dump(c))" > $install_dir/config.yaml.temp
|
||||||
mv $final_path/config.yaml.temp $final_path/config.yaml
|
mv $install_dir/config.yaml.temp $install_dir/config.yaml
|
||||||
|
|
||||||
chmod 400 "$final_path/config.yaml"
|
chmod 400 "$install_dir/config.yaml"
|
||||||
chown $app:$app "$final_path/config.yaml"
|
chown $app:$app "$install_dir/config.yaml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REGISTER SYNAPSE APP-SERVICE
|
# REGISTER SYNAPSE APP-SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file=$final_path/appservice-registration-irc.yaml
|
ynh_backup_if_checksum_is_different --file=$install_dir/appservice-registration-irc.yaml
|
||||||
|
|
||||||
$final_path/bin/matrix-appservice-irc -r \
|
__ynh_register_matrix_app_service
|
||||||
-c $final_path/config.yaml \
|
|
||||||
-u "http://localhost:$port" \
|
|
||||||
-f $final_path/appservice-registration-irc.yaml
|
|
||||||
|
|
||||||
ynh_store_file_checksum --file=$final_path/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
|
|
||||||
|
|
||||||
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|
|
||||||
|| ynh_die "Synapse can't restart with the appservice configuration"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -171,7 +120,7 @@ ynh_use_logrotate --non-append --specific_user $app/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="A short description of the app" --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
|
# START SYSTEMD SERVICE
|
||||||
|
|
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