diff --git a/README.md b/README.md index 6e7582d..3687af8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Ergo for YunoHost -[![Integration level](https://dash.yunohost.org/integration/ergo.svg)](https://dash.yunohost.org/appci/app/ergo) ![](https://ci-apps.yunohost.org/ci/badges/ergo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ergo.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/ergo.svg)](https://dash.yunohost.org/appci/app/ergo) ![Working status](https://ci-apps.yunohost.org/ci/badges/ergo.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/ergo.maintain.svg) [![Install Ergo with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ergo) *[Lire ce readme en français.](./README_fr.md)* @@ -26,47 +26,41 @@ Ergo (formerly known as Oragono) is a modern IRC server written in Go. Its core -**Shipped version:** 2.9.1~ynh1 +**Shipped version:** 2.10.0~ynh1 **Demo:** https://testnet.ergo.chat/ ## Screenshots -![](./doc/screenshots/example.jpg) +![Screenshot of Ergo](./doc/screenshots/example.jpg) ## Disclaimers / important information -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * requiring a full dedicated domain ? - * architectures not supported ? - * not-working single-sign on or LDAP integration ? - * the app requires an important amount of RAM / disk / .. to install or to work properly - * etc... +* Known Limitations: + * WebIRC has not been setup correctly for now -* Other infos that people should be aware of, such as: - * any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...) - * how to configure / administrate the application if it ain't obvious - * upgrade process / specificities / things to be aware of ? - * security considerations ? +* Other Information + * Command to become operator is `/OPER admin password_set_during_install` ## Documentation and resources -* Official app website: https://ergo.chat/ -* Official user documentation: https://github.com/ergochat/ergo/blob/stable/docs/USERGUIDE.md -* Official admin documentation: https://github.com/ergochat/ergo/blob/stable/docs/MANUAL.md -* Upstream app code repository: https://github.com/ergochat/ergo -* YunoHost documentation for this app: https://yunohost.org/app_ergo -* Report a bug: https://github.com/YunoHost-Apps/ergo_ynh/issues +* Official app website: +* Official user documentation: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/ergo_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/ergo_ynh/tree/testing --debug or sudo yunohost app upgrade ergo -u https://github.com/YunoHost-Apps/ergo_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index b565580..5c92c8a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Ergo pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/ergo.svg)](https://dash.yunohost.org/appci/app/ergo) ![](https://ci-apps.yunohost.org/ci/badges/ergo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ergo.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/ergo.svg)](https://dash.yunohost.org/appci/app/ergo) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/ergo.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/ergo.maintain.svg) [![Installer Ergo avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ergo) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Ergo rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -22,47 +26,41 @@ Ergo (formerly known as Oragono) is a modern IRC server written in Go. Its core -**Version incluse :** 2.9.1~ynh1 +**Version incluse :** 2.10.0~ynh1 **Démo :** https://testnet.ergo.chat/ ## Captures d'écran -![](./doc/screenshots/example.jpg) +![Capture d'écran de Ergo](./doc/screenshots/example.jpg) ## Avertissements / informations importantes -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * requiring a full dedicated domain ? - * architectures not supported ? - * not-working single-sign on or LDAP integration ? - * the app requires an important amount of RAM / disk / .. to install or to work properly - * etc... +* Known Limitations: + * WebIRC has not been setup correctly for now -* Other infos that people should be aware of, such as: - * any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...) - * how to configure / administrate the application if it ain't obvious - * upgrade process / specificities / things to be aware of ? - * security considerations ? +* Other Information + * Command to become operator is `/OPER admin password_set_during_install` ## Documentations et ressources -* Site officiel de l'app : https://ergo.chat/ -* Documentation officielle utilisateur : https://github.com/ergochat/ergo/blob/stable/docs/USERGUIDE.md -* Documentation officielle de l'admin : https://github.com/ergochat/ergo/blob/stable/docs/MANUAL.md -* Dépôt de code officiel de l'app : https://github.com/ergochat/ergo -* Documentation YunoHost pour cette app : https://yunohost.org/app_ergo -* Signaler un bug : https://github.com/YunoHost-Apps/ergo_ynh/issues +* Site officiel de l'app : +* Documentation officielle utilisateur : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/ergo_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/ergo_ynh/tree/testing --debug ou sudo yunohost app upgrade ergo -u https://github.com/YunoHost-Apps/ergo_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** diff --git a/check_process b/check_process index 9f8650a..82e81ae 100644 --- a/check_process +++ b/check_process @@ -3,13 +3,15 @@ domain="domain.tld" path="/path" is_public=1 - language="fr" - admin="john" + language="en" + network_name="ErgoYunohost" + server_name="ergo.yunohost" password="1Strong-Password" + enable_ldap=0 ; Checks pkg_linter=1 setup_sub_dir=1 - setup_root=1 + setup_root=0 setup_nourl=0 setup_private=1 setup_public=1 diff --git a/conf/amd64.src b/conf/amd64.src index 05d4325..bd9c504 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ergochat/ergo/releases/download/v2.9.1/ergo-2.9.1-linux-x86_64.tar.gz -SOURCE_SUM=38ce7738a05b8e9980e86a26a3508b56771ef651c6d823146059776c95a9579f +SOURCE_URL=https://github.com/ergochat/ergo/releases/download/v2.10.0/ergo-2.10.0-linux-x86_64.tar.gz +SOURCE_SUM=8ee98e8c391b587c9e9e2fd17c11ee031ab1cae8dfebf2ba5f05f69d83457b9d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/arm64.src b/conf/arm64.src index a19ba78..45279d0 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ergochat/ergo/releases/download/v2.9.1/ergo-2.9.1-linux-arm64.tar.gz -SOURCE_SUM=1173dd01762e28710235491a8a2c3b786bf2848ca672b7d104ee870cdafd334b +SOURCE_URL=https://github.com/ergochat/ergo/releases/download/v2.10.0/ergo-2.10.0-linux-arm64.tar.gz +SOURCE_SUM=7713c4a454ec3cfd55abebe3a1e114c47c338293bc3b9803ace045f860aef751 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/armhf.src b/conf/armhf.src index b421d41..5d02c88 100644 --- a/conf/armhf.src +++ b/conf/armhf.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ergochat/ergo/releases/download/v2.9.1/ergo-2.9.1-linux-armv6.tar.gz -SOURCE_SUM=384261cf506ee0ac561807d500c878d012cc7c5c45a3b9996013a58aa642542b +SOURCE_URL=https://github.com/ergochat/ergo/releases/download/v2.10.0/ergo-2.10.0-linux-armv6.tar.gz +SOURCE_SUM=d6a113551551ceab5905578873fe3597710fd6ee22ddc4fec1ff5fc05502bca2 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/default.yaml b/conf/default.yaml index 76e94a0..2c612db 100644 --- a/conf/default.yaml +++ b/conf/default.yaml @@ -25,30 +25,28 @@ # network configuration network: # name of the network - name: ErgoTest + name: __NETWORK_NAME__ # server configuration server: # server name - name: ergo.YunoHost + name: __SERVER_NAME__ # addresses to listen on listeners: # The standard plaintext port for IRC is 6667. Allowing plaintext over the # public Internet poses serious security and privacy issues. Accordingly, # we recommend using plaintext only on local (loopback) interfaces: - "127.0.0.1:6667": # (loopback ipv4, localhost-only) - "[::1]:6667": # (loopback ipv6, localhost-only) # If you need to serve plaintext on public interfaces, comment out the above # two lines and uncomment the line below (which listens on all interfaces): - # ":6667": + ":__PORT__": # Alternately, if you have a TLS certificate issued by a recognized CA, # you can configure port 6667 as an STS-only listener that only serves # "redirects" to the TLS port, but doesn't allow chat. See the manual # for details. # The standard SSL/TLS port for IRC is 6697. This will listen on all interfaces: - ":6697": + ":__SECURE_PORT__": # this is a standard TLS configuration with a single certificate; # see the manual for instructions on how to configure SNI tls: @@ -113,7 +111,7 @@ server: duration: 1mo2d5m # tls port - you should be listening on this port above - port: 6697 + port: __SECURE_PORT__ # should clients include this STS policy when they ship their inbuilt preload lists? preload: false @@ -169,7 +167,7 @@ server: # motd filename # if you change the motd, you should move it to ircd.motd - motd: ergo.motd + motd: ircd.motd # motd formatting codes # if this is true, the motd is escaped using formatting codes like $c, $b, and $i @@ -399,9 +397,9 @@ accounts: # options for email verification of account registrations email-verification: enabled: false - sender: "admin@my.network" + sender: "ergoadmin@__DOMAIN__" require-tls: true - helo-domain: "my.network" # defaults to server name if unset + helo-domain: "__DOMAIN__" # defaults to server name if unset # options to enable DKIM signing of outgoing emails (recommended, but # requires creating a DNS entry for the public key): # dkim: @@ -409,19 +407,19 @@ accounts: # selector: "20200229" # key-file: "dkim.pem" # to use an MTA/smarthost instead of sending email directly: - # mta: - # server: localhost - # port: 25 - # username: "admin" - # password: "hunter2" + mta: + server: 127.0.0.1 + port: 25 + #username: "" + #password: "" blacklist-regexes: # - ".*@mailinator.com" timeout: 60s # email-based password reset: password-reset: - enabled: false + enabled: true # time before we allow resending the email - cooldown: 1h + cooldown: 4h # time for which a password reset code is valid timeout: 1d @@ -431,10 +429,10 @@ accounts: enabled: true # window - duration: 1m + duration: 10m # number of attempts allowed within the window - max-attempts: 3 + max-attempts: 5 # some clients (notably Pidgin and Hexchat) offer only a single password field, # which makes it impossible to specify a separate server password (for the PASS @@ -558,7 +556,7 @@ accounts: # pluggable authentication mechanism, via subprocess invocation # see the manual for details on how to write an authentication plugin script auth-script: - enabled: false + enabled: __LDAPOPTION__ command: "__FINALPATH__/ergo-ldap" # constant list of args to pass to the command; the actual authentication # data is transmitted over stdin/stdout: @@ -676,7 +674,7 @@ opers: # or by certificate fingerprint, or both. if a password hash is set, then a # password is required to oper up (e.g., /OPER dan mypassword). to generate # the hash, use `ergo genpasswd`. - password: "$2a$04$0123456789abcdef0123456789abcdef0123456789abcdef01234" + password: "__PASSWORDHASH__" #ergo@YunoHost # if a SHA-256 certificate fingerprint is configured here, then it will be # required to /OPER. if you comment out the password hash above, then you can @@ -772,9 +770,9 @@ datastore: port: 3306 # if socket-path is set, it will be used instead of host:port #socket-path: "/var/run/mysqld/mysqld.sock" - user: "ergo" - password: "hunter2" - history-database: "ergo_history" + user: "__DB_USER__" + password: "__DB_PWD__" + history-database: "__DB_NAME__" timeout: 3s max-conns: 4 # this may be necessary to prevent middleware from closing your connections: @@ -790,7 +788,7 @@ languages: default: __LANGUAGE__ # which directory contains our language files - path: languages + path: "__FINALPATH__/languages" # limits - these need to be the same across the network limits: diff --git a/conf/ircd.motd b/conf/ircd.motd new file mode 100644 index 0000000..848b915 --- /dev/null +++ b/conf/ircd.motd @@ -0,0 +1,36 @@ +__ __ _ _ _ +\ \ / / | | | | | | + \ V / _ _ __ ___ | |_| | ___ ___| |_ + \ / | | | '_ \ / _ \| _ |/ _ \/ __| __| + | | |_| | | | | (_) | | | | (_) \__ \ |_ + \_/\__,_|_| |_|\___/\_| |_/\___/|___/\__| + + +Welcome to an IRC Server (powered by Ergo Chat) running on YunoHost + + +If motd-formatting is enabled in the config file, you can use the dollarsign character to +create special formatting such as bold, italics and color codes. + +For example, here are a few formatted lines (enable motd-formatting to see these in action): + +- this is $bbold text$r. +- this is $iitalics text$r. +- this is $c[red]red$c and $c[blue]blue$c text. +- this is $c[red,light blue]red text with a light blue background$c. +- this is a normal escaped dollarsign: $$ + +And now a few fun colour charts! + +$c1,0 00 $c0,1 01 $c0,2 02 $c0,3 03 $c1,4 04 $c0,5 05 $c0,6 06 $c1,7 07 +$c1,8 08 $c1,9 09 $c0,10 10 $c1,11 11 $c0,12 12 $c1,13 13 $c1,14 14 $c1,15 15 + +$c0,16 16 $c0,17 17 $c0,18 18 $c0,19 19 $c0,20 20 $c0,21 21 $c0,22 22 $c0,23 23 $c0,24 24 $c0,25 25 $c0,26 26 $c0,27 27 +$c0,28 28 $c0,29 29 $c0,30 30 $c0,31 31 $c0,32 32 $c0,33 33 $c0,34 34 $c0,35 35 $c0,36 36 $c0,37 37 $c0,38 38 $c0,39 39 +$c0,40 40 $c0,41 41 $c0,42 42 $c0,43 43 $c0,44 44 $c0,45 45 $c0,46 46 $c0,47 47 $c0,48 48 $c0,49 49 $c0,50 50 $c0,51 51 +$c0,52 52 $c0,53 53 $c1,54 54 $c1,55 55 $c1,56 56 $c1,57 57 $c1,58 58 $c0,59 59 $c0,60 60 $c0,61 61 $c0,62 62 $c0,63 63 +$c0,64 64 $c1,65 65 $c1,66 66 $c1,67 67 $c1,68 68 $c1,69 69 $c1,70 70 $c1,71 71 $c0,72 72 $c0,73 73 $c0,74 74 $c0,75 75 +$c1,76 76 $c1,77 77 $c1,78 78 $c1,79 79 $c1,80 80 $c1,81 81 $c1,82 82 $c1,83 83 $c1,84 84 $c1,85 85 $c1,86 86 $c1,87 87 +$c0,88 88 $c0,89 89 $c0,90 90 $c0,91 91 $c0,92 92 $c0,93 93 $c0,94 94 $c0,95 95 $c1,96 96 $c1,97 97 $c1,98 98 $c99,99 99 + +For more information on using these, see MOTDFORMATTING.md diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index aded581..df3ed68 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,12 +1,5 @@ -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * requiring a full dedicated domain ? - * architectures not supported ? - * not-working single-sign on or LDAP integration ? - * the app requires an important amount of RAM / disk / .. to install or to work properly - * etc... +* Known Limitations: + * WebIRC has not been setup correctly for now -* Other infos that people should be aware of, such as: - * any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...) - * how to configure / administrate the application if it ain't obvious - * upgrade process / specificities / things to be aware of ? - * security considerations ? +* Other Information + * Command to become operator is `/OPER admin password_set_during_install` diff --git a/doc/screenshots/example.jpg b/doc/screenshots/example.jpg index a1efa1a..e23888e 100644 Binary files a/doc/screenshots/example.jpg and b/doc/screenshots/example.jpg differ diff --git a/manifest.json b/manifest.json index 2be20c4..102af46 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A modern IRC server (daemon/ircd) written in Go", "fr": "A modern IRC server (daemon/ircd) written in Go" }, - "version": "2.9.1~ynh1", + "version": "2.10.0~ynh1", "url": "https://ergo.chat/", "upstream": { "license": "MIT", @@ -18,8 +18,8 @@ }, "license": "MIT", "maintainer": { - "name": "", - "email": "" + "name": "Navan Chauhan", + "email": "ergochat_ynh@navan.email" }, "requirements": { "yunohost": ">= 4.3.0" @@ -44,7 +44,10 @@ { "name": "is_public", "type": "boolean", - "default": true + "default": true, + "help": { + "en": "Enable WebIRC For Public" + } }, { "name": "language", @@ -55,6 +58,37 @@ }, "choices": ["en", "en-AU", "el", "es", "fr-FR", "no", "pl", "pt-BR", "ro", "tr-TR", "zh-CN"], "default": "fr-FR" + }, + { + "name": "network_name", + "type": "string", + "default": "ErgoYunohost", + "ask": { + "en": "Network Name" + } + }, + { + "name": "server_name", + "type": "string", + "default": "ergo.yunohost", + "ask": { + "en": "Server Name" + } + }, + { + "name": "password", + "type": "password", + "help": { + "en": "For using /OPER admin" + } + }, + { + "name": "enable_ldap", + "type": "boolean", + "default": false, + "ask": { + "en": "Enable ldap authentication script" + } } ] } diff --git a/scripts/backup b/scripts/backup index 563b8b2..636048c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -29,9 +29,9 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) +final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -44,11 +44,7 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -#================================================= -# BACKUP THE DATA DIR -#================================================= - -ynh_backup --src_path="$datadir" --is_big +ynh_backup --src_path="$final_path_www" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -70,6 +66,16 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP THE MYSQL DATABASE +#================================================= +ynh_print_info --message="Backing up the MySQL database..." + +### (However, things like MySQL dumps *do* take some time to run, though the +### copy of the generated dump to the archive still happens later) + +ynh_mysql_dump_db --database="$db_name" > db.sql + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index aa5bf2e..6ce91d7 100755 --- a/scripts/install +++ b/scripts/install @@ -27,17 +27,24 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC +enable_ldap=$YNH_APP_ARG_ENABLE_LDAP language=$YNH_APP_ARG_LANGUAGE +architecture=$YNH_ARCH +network_name=$YNH_APP_ARG_NETWORK_NAME +server_name=$YNH_APP_ARG_SERVER_NAME +password=$YNH_APP_ARG_PASSWORD app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/var/www/$app +final_path=/opt/yunohost/$app +final_path_www=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +test ! -e "$final_path_www" || ynh_die --message="This path already contains a folder" # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -45,56 +52,83 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --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=path --value=$path_url ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=network_name --value=$network_name +ynh_app_setting_set --app=$app --key=server_name --value=$server_name +ynh_app_setting_set --app=$app --key=final_path_www --value=$final_path_www +ynh_app_setting_set --app=$app --key=final_path --value=$final_path #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --time --weight=1 +ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port -port=$(ynh_find_port --port=6667) +port=$(ynh_find_port --port=6667) # Plaintext Port +secure_port=$(ynh_find_port --port=6697) # Secure Port + ynh_app_setting_set --app=$app --key=port --value=$port +ynh_app_setting_set --app=$app --key=secure_port --value=$secure_port -#================================================= -# INSTALL DEPENDENCIES -#================================================= -# ynh_script_progression --message="Installing dependencies..." --time --weight=1 - -# ynh_install_app_dependencies $pkg_dependencies +ynh_script_progression --message="Configuring firewall..." --weight=1 +ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port +ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $secure_port #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_system_user_create --username=$app --home_dir="$final_path" --groups="ssl-cert" + +#================================================= +# CREATE A MYSQL DATABASE +#================================================= +ynh_script_progression --message="Creating a MySQL database..." --weight=1 + +db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=10 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH +ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" ynh_setup_source --dest_dir="$final_path" --source_id=ldap chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +chmod +x "$final_path/ergo" + +# Copy help file +mkdir -p "$final_path_www/help" +if test -e "$YNH_APP_BASEDIR/sources/extra_files/help"; then + cp --archive "$YNH_APP_BASEDIR/sources/extra_files/help/." "$final_path_www/help" +fi +ynh_replace_vars --file="$final_path_www/help/index.html" + +chmod 750 "$final_path_www" +chmod -R o-rwx "$final_path_www" +chown -R "www-data":"www-data" "$final_path_www" + #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -102,11 +136,25 @@ ynh_add_nginx_config #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --time --weight=1 + +ynh_script_progression --message="Adding a configuration file..." --weight=2 + +# Get Password Hash +passwordhash=$((echo "$password"; echo "$password") | $final_path/ergo genpasswd) + +# Enable ldap authentication if necessary + +ldapoption=false + +if [ $enable_ldap -eq 1 ] +then + ldapoption=true +fi server=$domain ynh_add_config --template="../conf/default.yaml" --destination="$final_path/ircd.yaml" ynh_add_config --template="../conf/ldap-config.yaml" --destination="$final_path/ldap-config.yaml" +ynh_add_config --template="../conf/ircd.motd" --destination="$final_path/ircd.motd" chmod 400 "$final_path/ircd.yaml" chown $app: "$final_path/ircd.yaml" @@ -114,7 +162,7 @@ chown $app: "$final_path/ircd.yaml" #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --time --weight=1 +ynh_script_progression --message="Configuring a systemd service..." --weight=3 # Create a dedicated systemd config ynh_add_systemd_config @@ -124,7 +172,7 @@ ynh_add_systemd_config #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --time --weight=1 +ynh_script_progression --message="Configuring log rotation..." --weight=2 # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -132,14 +180,20 @@ ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 -yunohost service add $app --description="A modern IRC server" --log="/var/log/$app/$app.log" +# Build the ports list +needed_ports=() +needed_ports+=( "$port" ) +needed_ports+=( "$secure_port" ) + +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="A modern IRC server" --log="/var/log/$app/$app.log" ${needed_ports:+--needs_exposed_ports} "${needed_ports[@]}" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" @@ -147,7 +201,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --time --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] @@ -160,7 +214,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -168,4 +222,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 6d900f3..1949f99 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,13 +12,17 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME +db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) +secure_port=$(ynh_app_setting_get --app=$app --key=secure_port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www) #================================================= # STANDARD REMOVE @@ -29,14 +33,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # 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 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 fi #================================================= # 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 ynh_remove_systemd_config @@ -44,7 +48,7 @@ ynh_remove_systemd_config #================================================= # 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 ynh_remove_logrotate @@ -52,33 +56,59 @@ ynh_remove_logrotate #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" +ynh_secure_remove --file="$final_path_www" + #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE THE MYSQL DATABASE +#================================================= +ynh_script_progression --message="Removing the MySQL database..." --weight=1 + +# Remove a database if it exists, along with the associated user +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name + #================================================= # 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 +#================================================= +# CLOSE A PORT +#================================================= + +if yunohost firewall list | grep -q "\- $port$" +then + ynh_script_progression --message="Closing port $port..." --weight=1 + ynh_exec_warn_less yunohost firewall disallow TCP $port +fi + +if yunohost firewall list | grep -q "\- $secure_port$" +then + ynh_script_progression --message="Closing port $secure_port..." --weight=1 + ynh_exec_warn_less yunohost firewall disallow TCP $secure_port +fi + #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -87,4 +117,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 4e4651e..62f664f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -24,35 +24,43 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www) +port=$(ynh_app_setting_get --app=$app --key=port) +secure_port=$(ynh_app_setting_get --app=$app --key=secure_port) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path_www \ + || ynh_die --message="There is already a directory: $final_path_www " + #================================================= # STANDARD RESTORATION STEPS #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" @@ -60,28 +68,32 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # 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="$final_path_www" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 +chmod 750 "$final_path_www" +chmod -R o-rwx "$final_path_www" +chown -R $app:www-data "$final_path_www" -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE MYSQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 + +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # 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" systemctl enable $app.service --quiet @@ -89,21 +101,26 @@ systemctl enable $app.service --quiet #================================================= # 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" #================================================= # 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 modern IRC server" --log="/var/log/$app/$app.log" +# Build the ports list +needed_ports=() +needed_ports+=( "$port" ) +needed_ports+=( "$secure_port" ) + +yunohost service add $app --description="A modern IRC server" --log="/var/log/$app/$app.log" ${needed_ports:+--needs_exposed_ports} "${needed_ports[@]}" #================================================= # 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" @@ -112,7 +129,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -120,4 +137,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 43dbb64..097c441 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) +secure_port=$(ynh_app_setting_get --app=$app --key=secure_port) #================================================= # CHECK VERSION @@ -30,7 +31,7 @@ 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)..." --time --weight=1 +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 @@ -46,14 +47,14 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +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" #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +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" @@ -64,7 +65,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH --keep="$final_path/ircd.yaml" @@ -77,7 +78,7 @@ chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -85,14 +86,14 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -# ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +# ynh_script_progression --message="Upgrading dependencies..." --weight=1 # ynh_install_app_dependencies $pkg_dependencies #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config @@ -102,7 +103,7 @@ ynh_add_systemd_config #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -110,21 +111,26 @@ ynh_use_logrotate --non-append #================================================= # 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 modern IRC server" --log="/var/log/$app/$app.log" +# Build the ports list +needed_ports=() +needed_ports+=( "$port" ) +needed_ports+=( "$secure_port" ) + +yunohost service add $app --description="A modern IRC server" --log="/var/log/$app/$app.log" ${needed_ports:+--needs_exposed_ports} "${needed_ports[@]}" #================================================= # 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" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -132,4 +138,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of $app completed" --last diff --git a/sources/extra_files/help/index.html b/sources/extra_files/help/index.html new file mode 100644 index 0000000..eaf3dd1 --- /dev/null +++ b/sources/extra_files/help/index.html @@ -0,0 +1,50 @@ + + + + + Ergo Chat IRC Server + + + +

Ergo Chat IRC Server

+

To join __NETWORK_NAME__

+
+

+ IRC Instructions: +

+
    + Server Details: +
      +
    • __DOMAIN__ on __PORT__ / __SECURE_PORT__ (SSL) +
    +
+
+ +