diff --git a/README.md b/README.md index 42d7e5a..39bde3d 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Rocket.Chat is an open-source fully customizable communications platform develop - Mobile Apps for [iOS](https://apps.apple.com/app/rocket-chat/id1148741252) and [Android](https://play.google.com/store/apps/details?id=chat.rocket.android) - Desktop Apps for [macOS](https://apps.apple.com/br/app/rocket-chat/id1086818840), [Linux](https://snapcraft.io/rocketchat-desktop) and [Windows](https://releases.rocket.chat/desktop/latest/download) -**Shipped version:** 6.0.1~ynh1 +**Shipped version:** 6.1.2~ynh1 **Demo:** https://cloud.rocket.chat/trial @@ -35,29 +35,6 @@ Rocket.Chat is an open-source fully customizable communications platform develop ![Screenshot of Rocket.Chat](./doc/screenshots/screenshot.jpg) -## Disclaimers / important information - -### E-mail Configuration - -To enable E-mail for address verification, go to Rocket.Chat Administration panel under Settings -> E-mail -> SMTP and set as follow: - -- Protocole: `smtp` -- Host: `localhost` -- Port: `25` -- From -mail: `rocketchat@domain.tld` - - -### Configure and activate federation for Rocket.Chat - -https://support.indie.host/help/fr-fr/13/40 - - -### Mobile Apps - -In addition to the web interface, you can also download Rocket.Chat clients for: - -[![Rocket.Chat on Apple App Store](https://user-images.githubusercontent.com/551004/29770691-a2082ff4-8bc6-11e7-89a6-964cd405ea8e.png)](https://itunes.apple.com/us/app/rocket-chat/id1148741252?mt=8) [![Rocket.Chat on Google Play](https://user-images.githubusercontent.com/551004/29770692-a20975c6-8bc6-11e7-8ab0-1cde275496e0.png)](https://play.google.com/store/apps/details?id=chat.rocket.android) [![](https://user-images.githubusercontent.com/551004/48210349-50649480-e35e-11e8-97d9-74a4331faf3a.png)](https://f-droid.org/en/packages/chat.rocket.android) - ## :red_circle: Antifeatures - **Not totally free upstream**: The packaged app is under an overall free licence, but with clauses that restrict its use. diff --git a/README_fr.md b/README_fr.md index 9735697..1a2057d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,7 +27,7 @@ Rocket.Chat est une plate-forme de communication open source entièrement person - Applications mobiles pour [iOS](https://apps.apple.com/app/rocket-chat/id1148741252) et [Android](https://play.google.com/store/apps/details?id=chat.rocket.android) - Applications de bureau pour [macOS](https://apps.apple.com/br/app/rocket-chat/id1086818840), [Linux](https://snapcraft.io/rocketchat-desktop) et [Windows](https://releases.rocket.chat/desktop/latest/download) -**Version incluse :** 6.0.1~ynh1 +**Version incluse :** 6.1.2~ynh1 **Démo :** https://cloud.rocket.chat/trial @@ -35,30 +35,6 @@ Rocket.Chat est une plate-forme de communication open source entièrement person ![Capture d’écran de Rocket.Chat](./doc/screenshots/screenshot.jpg) -## Avertissements / informations importantes - -### Configuration de l'e-mail - -Pour activer l'e-mail pour la vérification des adresses, accédez au panneau d'administration de Rocket.Chat sous Paramètres -> E-mail -> SMTP et définissez comme suit : - -- Protocole : `smtp` -- Hôte : `localhost` -- Port : `25` -- De l'e-mail : `rocketchat@domain.tld` - - -### Configurer et activer la fédération pour Rocket.Chat - -https://support.indie.host/help/fr-fr/13/40 - - -### Applications Mobiles - -En plus de l'interface Web, vous pouvez également télécharger les clients Rocket.Chat pour : - -[![Rocket.Chat on Apple App Store](https://user-images.githubusercontent.com/551004/29770691-a2082ff4-8bc6-11e7-89a6-964cd405ea8e.png)](https://itunes.apple.com/us/app/rocket-chat/id1148741252?mt=8) [![Rocket.Chat on Google Play](https://user-images.githubusercontent.com/551004/29770692-a20975c6-8bc6-11e7-8ab0-1cde275496e0.png)](https://play.google.com/store/apps/details?id=chat.rocket.android) [![](https://user-images.githubusercontent.com/551004/48210349-50649480-e35e-11e8-97d9-74a4331faf3a.png)](https://f-droid.org/en/packages/chat.rocket.android) - - ## :red_circle: Fonctions indésirables - **Not totally free upstream**: The packaged app is under an overall free licence, but with clauses that restrict its use. diff --git a/check_process b/check_process deleted file mode 100644 index 289e52e..0000000 --- a/check_process +++ /dev/null @@ -1,28 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - admin="john" - password="1Strong-Password" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - 5.4.3~ynh1 - upgrade=1 from_commit=8c5ad8d9b6aecf50c0d7241a1729dcf172c88fde - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=8c5ad8d9b6aecf50c0d7241a1729dcf172c88fde - name=Merge pull request #166 - manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index b390c17..0000000 --- a/conf/app.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://releases.rocket.chat/6.0.1/download -SOURCE_SUM=b927af1a3d5e82abcdb1c54f5965daa2a5d4c3e28a5919bad90d72ee732c834e -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=rocket.chat.tgz -SOURCE_EXTRACT=true diff --git a/conf/rocketchat_ldap.js b/conf/rocketchat_ldap.js deleted file mode 100644 index 23de9a0..0000000 --- a/conf/rocketchat_ldap.js +++ /dev/null @@ -1,81 +0,0 @@ -use rocketchat - - -db.rocketchat_settings.update( - { "_id" : "LDAP_Enable" }, - { - $set: { "value": true } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_Login_Fallback" }, - { - $set: { "value": false } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_Host" }, - { - $set: { "value": "localhost" } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_Port" }, - { - $set: { "value": "389" } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_Reconnect" }, - { - $set: { "value": true } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_BaseDN" }, - { - $set: { "value": "dc=yunohost,dc=org" } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_Username_Field" }, - { - $set: { "value": "uid" } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_Unique_Identifier_Field" }, - { - $set: { "value": "uid" } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_Domain_Search_Object_Class" }, - { - $set: { "value": "inetOrgPerson" } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_Sync_User_Data" }, - { - $set: { "value": true } - } -) -db.rocketchat_settings.update( - { "_id" : "Accounts_RegistrationForm" }, - { - $set: { "value": "Enabled" } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_User_Search_Filter" }, - { - $set: { "value": "(objectclass=inetOrgPerson)" } - } -) -db.rocketchat_settings.update( - { "_id" : "LDAP_User_Search_Field" }, - { - $set: { "value": "uid" } - } -) diff --git a/conf/systemd.service b/conf/systemd.service index ae02c6d..b63fa19 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,9 +7,9 @@ After=network.target remote-fs.target nss-lookup.target nginx.service __MONGODB_ User=__APP__ Group=__APP__ Environment="NODE_ENV=production" -WorkingDirectory=__FINALPATH__/ +WorkingDirectory=__INSTALL_DIR__/ Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__YNH_NODE__ __FINALPATH__/main.js +ExecStart=__YNH_NODE__ __INSTALL_DIR__/main.js SyslogIdentifier=__APP__ Environment=MONGO_URL=mongodb://localhost:27017/__APP__?replicaSet=rs01 Environment=MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index ee3232d..0000000 --- a/manifest.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "Rocket.Chat", - "id": "rocketchat", - "packaging_format": 1, - "description": { - "en": "Team collaboration communication platform", - "fr": "Plateforme de communication collaborative en équipe" - }, - "version": "6.0.1~ynh1", - "url": "https://rocket.chat", - "upstream": { - "license": "GPL-3.0", - "website": "https://rocket.chat/", - "demo": "https://cloud.rocket.chat/trial", - "admindoc": "https://docs.rocket.chat/", - "userdoc": "https://docs.rocket.chat/guides/user-guides", - "code": "https://github.com/RocketChat/Rocket.Chat" - }, - "license": "GPL-3.0", - "maintainer": { - "name": "eric_G", - "email": "" - }, - "requirements": { - "yunohost": ">= 11.1.14" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/rocketchat", - "default": "/rocketchat" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "You must activate public site if you want to connect a Mobile or desktop client to Rocket.Chat. This can be changed later via the webadmin.", - "fr": "Vous devez activer site public si vous souhaitez connecter un client mobile ou desktop à Rocket.Chat. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "password", - "type": "password" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..4222621 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,74 @@ +packaging_format = 2 + +id = "rocketchat" +name = "Rocket.Chat" +description.en = "Team collaboration communication platform" +description.fr = "Plateforme de communication collaborative en équipe" + +version = "6.1.2~ynh1" + +maintainers = ["eric_G"] + +[upstream] +license = "GPL-3.0" +website = "https://rocket.chat/" +demo = "https://cloud.rocket.chat/trial" +admindoc = "https://docs.rocket.chat/" +userdoc = "https://docs.rocket.chat/guides/user-guides" +code = "https://github.com/RocketChat/Rocket.Chat" + +[integration] +yunohost = ">= 11.1.15" +architectures = ["amd64"] +multi_instance = true +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" + +[install] + [install.domain] + type = "domain" + + [install.path] + type = "path" + default = "/rocketchat" + + [install.init_main_permission] + help.en = "You must activate 'Visitors' if you want to connect a Mobile or desktop client to Rocket.Chat. This can be changed later via the webadmin." + help.fr = "Vous devez activer 'Visiteurs' si vous souhaitez connecter un client mobile ou desktop à Rocket.Chat. Vous pourrez changer ceci plus tard via la webadmin." + type = "group" + default = "visitors" + + [install.admin] + type = "user" + + [install.password] + type = "password" + +[resources] + [resources.sources] + + [resources.sources.main] + url = "https://releases.rocket.chat/6.1.2/download" + sha256 = "2600755e7c2b9f8cd072662368469b6fa03ba34efba3fccd813d4287c7086965" + in_subdir = true + extract = true + rename = "rocket.chat.tgz" + + [resources.system_user] + + [resources.install_dir] + + [resources.ports] + + [resources.permissions] + main.url = "/" + + [resources.apt] + packages = "apt-transport-https build-essential gzip curl fontconfig graphicsmagick" + + 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" diff --git a/scripts/_common.sh b/scripts/_common.sh index e8498e3..08da309 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,9 +8,6 @@ nodejs_version=14 mongo_version=5.0 -# dependencies used by the app -pkg_dependencies="apt-transport-https build-essential gzip curl fontconfig graphicsmagick" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 5a3266b..3f4ba63 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +10,6 @@ source ../settings/scripts/_common.sh 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) -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) - #================================================= # 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 #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index f441582..f5cd86d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,63 +9,6 @@ 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 -port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=48 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # 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 #================================================= @@ -80,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= 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 +ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS @@ -121,13 +42,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=16 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="SERVER RUNNING" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 2726a6c..b370abb 100644 --- a/scripts/install +++ b/scripts/install @@ -9,86 +9,27 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC -admin=$YNH_APP_ARG_ADMIN password=$YNH_APP_ARG_PASSWORD - -app=$YNH_APP_INSTANCE_NAME - email=$(ynh_user_get_info --username=$admin --key=mail) -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -# Check machine architecture (in particular, we don't support ARM and 32bit machines) -if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armel" ] || [ $YNH_ARCH == "armhf" ] || [ $YNH_ARCH == "arm64" ] -then - ynh_die --message="Sorry, but this app can only be installed on a x86, 64 bits machine :(" -fi - -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 -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=admin --value=$admin ynh_app_setting_set --app=$app --key=password --value="$password" ynh_app_setting_set --app=$app --key=email --value=$email -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=2 - -# Find an available port -port=$(ynh_find_port --port=3000) -ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Installing dependencies..." --weight=48 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_mongo --mongo_version=$mongo_version -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=3 - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # CREATE A MONGODB DATABASE @@ -105,25 +46,15 @@ ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name #================================================= 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" +ynh_setup_source --dest_dir="$install_dir" mkdir "/tmp/ufs" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" chown -R $app:$app "/tmp/ufs" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=3 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # SPECIFIC SETUP #================================================= @@ -141,41 +72,31 @@ if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep - ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval fi -#============================================== -# INSTALL ROCKETCHAT -#============================================== -ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=29 - -pushd $final_path/programs/server - ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --unsafe-perm -popd - #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 +# Create a dedicated NGINX config +ynh_add_nginx_config + # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - # Use logrotate to manage application logfile(s) ynh_use_logrotate - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Team collaboration communication platform" +#============================================== +# INSTALL ROCKETCHAT +#============================================== +ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=29 + +pushd $install_dir/programs/server + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --unsafe-perm +popd + #================================================= # START SYSTEMD SERVICE #================================================= @@ -183,26 +104,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=29 ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="SERVER RUNNING" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index c1cbb8e..99d5c9a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -14,13 +14,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE @@ -35,22 +30,22 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate +if [ -d "/tmp/ufs" ]; then + ynh_secure_remove --file="/tmp/ufs" +fi + +# Remove the dedicated NGINX config +ynh_remove_nginx_config + +# Remove metapackage and its dependencies +ynh_remove_nodejs + #================================================= # REMOVE THE MONGODB DATABASE #================================================= @@ -65,46 +60,8 @@ ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mo # Remove a database if it exists, along with the associated user ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=2 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - -if [ -d "/tmp/ufs" ]; then - ynh_secure_remove --file="/tmp/ufs" -fi - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - -# Remove the dedicated NGINX config -ynh_remove_nginx_config - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=4 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies -ynh_remove_nodejs ynh_remove_mongo -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 93e5ed1..30680e7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,58 +10,23 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # 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) -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 mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version) -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --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..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # RESTORE THE APP MAIN DIR #================================================= 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 -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # SPECIFIC RESTORATION @@ -71,17 +36,8 @@ chown -R $app:$app "$final_path" ynh_script_progression --message="Reinstalling dependencies..." --weight=40 # Define and install dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_mongo --mongo_version=$mongo_version -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MONGODB DATABASE @@ -112,21 +68,13 @@ fi #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -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..." --weight=1 - yunohost service add $app --description="Team collaboration communication platform" #================================================= @@ -136,13 +84,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=19 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="SERVER RUNNING" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fa55c62..bfc0a40 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,16 +14,8 @@ source /usr/share/yunohost/helpers #================================================= 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) -admin=$(ynh_app_setting_get --app=$app --key=admin) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -port=$(ynh_app_setting_get --app=$app --key=port) password=$(ynh_app_setting_get --app=$app --key=password) -admin=$(ynh_app_setting_get --app=$app --key=admin) email=$(ynh_app_setting_get --app=$app --key=email) mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version) @@ -33,21 +25,6 @@ mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version) 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=45 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # 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 #================================================= @@ -62,33 +39,12 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - # If mongo_version doesn't exist, create it if [ -z "$mongo_version" ]; then mongo_version="$(mongod --version | grep -oP 'db version v\K.{0,3}')" ynh_app_setting_set --app=$app --key=mongo_version --value=$mongo_version fi -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=4 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -97,32 +53,21 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=22 # Remove the app directory securely - ynh_secure_remove --file="$final_path" + ynh_secure_remove --file="$install_dir" # 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 -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=7 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_mongo --mongo_version=$mongo_version -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config #================================================= # SPECIFIC UPGRADE @@ -146,7 +91,7 @@ fi #============================================== ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=29 -pushd $final_path/programs/server +pushd $install_dir/programs/server ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --unsafe-perm popd @@ -156,24 +101,15 @@ popd #================================================= ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 +# Create a dedicated NGINX config +ynh_add_nginx_config + # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Team collaboration communication platform" #================================================= @@ -183,13 +119,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=19 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="SERVER RUNNING" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..0d6070f --- /dev/null +++ b/tests.toml @@ -0,0 +1,10 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.8c5ad8d9.name = "Upgrade from 5.4.3" + \ No newline at end of file