mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
commit
f553c4ed19
10 changed files with 60 additions and 37 deletions
|
@ -26,7 +26,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:** 4.8.1~ynh4
|
||||
**Shipped version:** 4.8.2~ynh1
|
||||
|
||||
**Demo:** https://cloud.rocket.chat/trial
|
||||
|
||||
|
|
|
@ -26,7 +26,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 :** 4.8.1~ynh4
|
||||
**Version incluse :** 4.8.2~ynh1
|
||||
|
||||
**Démo :** https://cloud.rocket.chat/trial
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://releases.rocket.chat/4.8.1/download
|
||||
SOURCE_SUM=8f4d16858e5ac4ef0a92b9ac0a9d30172e3ce80a1f598597cd5b714c36db4a27
|
||||
SOURCE_URL=https://releases.rocket.chat/4.8.2/download
|
||||
SOURCE_SUM=40ccc61c5dd7fb129f6816476203d8cbe3f804d5d172ea60420df6a344f90376
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -12,6 +12,8 @@ location ^~ __PATH__/ {
|
|||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
|
||||
client_max_body_size 200M;
|
||||
}
|
||||
|
||||
#https://geekgonecrazy.com/2022/05/30/rocketchat-and-the-matrix-protocol/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Team collaboration communication platform",
|
||||
"fr": "Plateforme de communication collaborative en équipe"
|
||||
},
|
||||
"version": "4.8.1~ynh4",
|
||||
"version": "4.8.2~ynh1",
|
||||
"url": "https://rocket.chat",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0",
|
||||
|
|
|
@ -9,6 +9,8 @@ nodejs_version=14
|
|||
# dependencies used by the app
|
||||
pkg_dependencies="apt-transport-https build-essential gzip curl fontconfig graphicsmagick"
|
||||
|
||||
YNH_MONGO_VERSION=4.4
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
@ -16,12 +18,12 @@ pkg_dependencies="apt-transport-https build-essential gzip curl fontconfig graph
|
|||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
#!/bin/bash
|
||||
|
||||
MONGO_CE_SERVICENAME="mongod"
|
||||
MONGO_CE_DEPENDENCIES="mongodb-org mongodb-org-server mongodb-org-tools mongodb-mongosh"
|
||||
MONGO_CE_CONFIG="/etc/mongod.conf"
|
||||
MONGO_CE_REPO="deb http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 main"
|
||||
MONGO_CE_KEY="https://www.mongodb.org/static/pgp/server-5.0.asc"
|
||||
readonly YNH_DEFAULT_MONGO_VERSION=4.4
|
||||
# Declare the actual MongoDB version to use: 4.4 ; 5.0
|
||||
# A packager willing to use another version of MongoDB can override the variable into its _common.sh.
|
||||
YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION}
|
||||
|
||||
# Execute a mongo command
|
||||
#
|
||||
|
@ -317,20 +319,33 @@ ynh_mongo_remove_db() {
|
|||
|
||||
# Install MongoDB and integrate MongoDB service in YunoHost
|
||||
#
|
||||
# usage: ynh_install_mongo
|
||||
# usage: ynh_install_mongo [--mongo_version=mongo_version]
|
||||
# | arg: -m, --mongo_version= - Version of MongoDB to install
|
||||
#
|
||||
#
|
||||
ynh_install_mongo() {
|
||||
ynh_script_progression --message="Installing MongoDB Community Edition..."
|
||||
ynh_install_extra_app_dependencies --repo="$MONGO_CE_REPO" --package="$MONGO_CE_DEPENDENCIES" --key="$MONGO_CE_KEY"
|
||||
mongodb_servicename=$MONGO_CE_SERVICENAME
|
||||
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=m
|
||||
local -A args_array=([m]=mongo_version=)
|
||||
local mongo_version
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
mongo_version="${mongo_version:-$YNH_MONGO_VERSION}"
|
||||
|
||||
ynh_print_info --message="Installing MongoDB Community Edition..."
|
||||
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian buster/mongodb-org/$mongo_version main" --package="mongodb-org mongodb-org-server mongodb-org-tools mongodb-mongosh" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc"
|
||||
mongodb_servicename=mongod
|
||||
|
||||
# Make sure MongoDB is started and enabled
|
||||
systemctl is-enabled $mongodb_servicename -q || systemctl enable $mongodb_servicename --quiet
|
||||
systemctl is-active $mongodb_servicename -q || ynh_systemd_action --service_name=$mongodb_servicename --action=restart --line_match="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log"
|
||||
|
||||
systemctl enable $mongodb_servicename --quiet
|
||||
systemctl daemon-reload --quiet
|
||||
ynh_systemd_action --service_name=$mongodb_servicename --action=restart --line_match="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log"
|
||||
|
||||
# Integrate MongoDB service in YunoHost
|
||||
yunohost service add $mongodb_servicename --description="MongoDB daemon" --log="/var/log/mongodb/$mongodb_servicename.log"
|
||||
|
||||
# Store mongo_version into the config of this app
|
||||
ynh_app_setting_set --app=$app --key=mongo_version --value=$mongo_version
|
||||
}
|
||||
|
||||
# Remove MongoDB
|
||||
|
@ -345,7 +360,7 @@ ynh_remove_mongo() {
|
|||
if ! ynh_package_is_installed --package="mongodb*"
|
||||
then
|
||||
ynh_print_info --message="Removing MongoDB service..."
|
||||
mongodb_servicename=$MONGO_CE_SERVICENAME
|
||||
mongodb_servicename=mongod
|
||||
# Remove the mongodb service
|
||||
yunohost service remove $mongodb_servicename
|
||||
ynh_secure_remove --file="/var/lib/mongodb"
|
||||
|
|
|
@ -80,6 +80,7 @@ ynh_script_progression --message="Installing dependencies..." --weight=20
|
|||
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
|
||||
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
|
||||
|
@ -108,9 +109,12 @@ 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"
|
||||
|
||||
mkdir "/tmp/ufs"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
chown -R $app:$app "/tmp/ufs"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -127,11 +131,11 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring mongod..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file="/etc/mongod.conf"
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file="/etc/mongod.conf"
|
||||
|
||||
ynh_exec_warn_less systemctl enable $MONGO_CE_SERVICENAME --quiet
|
||||
ynh_systemd_action --service_name=$MONGO_CE_SERVICENAME --action=restart --log_path=/var/log/mongodb/$MONGO_CE_SERVICENAME.log --line_match="Waiting for connections"
|
||||
ynh_exec_warn_less systemctl enable mongod --quiet
|
||||
ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --line_match="Waiting for connections"
|
||||
|
||||
if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
||||
|
@ -144,7 +148,7 @@ ynh_script_progression --message="Building $app... (this will take some time and
|
|||
|
||||
pushd $final_path/programs/server
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --unsafe-perm
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --unsafe-perm
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -56,11 +56,11 @@ ynh_remove_logrotate
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing the MongoDB database..." --weight=3
|
||||
|
||||
ynh_replace_string --match_string="engine: wiredTiger" --replace_string="# engine:" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="replication:" --replace_string="#replication:" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string=" replSetName: rs01" --replace_string="" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="engine: wiredTiger" --replace_string="# engine:" --target_file="/etc/mongod.conf"
|
||||
ynh_replace_string --match_string="replication:" --replace_string="#replication:" --target_file="/etc/mongod.conf"
|
||||
ynh_replace_string --match_string=" replSetName: rs01" --replace_string="" --target_file="/etc/mongod.conf"
|
||||
|
||||
ynh_systemd_action --service_name=$MONGO_CE_SERVICENAME --action=restart --log_path=/var/log/mongodb/$MONGO_CE_SERVICENAME.log --line_match="Waiting for connections"
|
||||
ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --line_match="Waiting for connections"
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
|
|
@ -73,6 +73,7 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
|||
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
|
||||
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
|
||||
|
@ -95,11 +96,11 @@ ynh_mongo_restore_db --database="$db_name" < ./dump.bson
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring mongod..." --weight=3
|
||||
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file="/etc/mongod.conf"
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file="/etc/mongod.conf"
|
||||
|
||||
ynh_exec_warn_less systemctl enable $MONGO_CE_SERVICENAME --quiet
|
||||
ynh_systemd_action --service_name=$MONGO_CE_SERVICENAME --action=restart --log_path=/var/log/mongodb/$MONGO_CE_SERVICENAME.log --line_match="Waiting for connections"
|
||||
ynh_exec_warn_less systemctl enable mongod --quiet
|
||||
ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --line_match="Waiting for connections"
|
||||
|
||||
if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
||||
|
|
|
@ -108,6 +108,7 @@ 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
|
||||
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
|
||||
|
@ -124,11 +125,11 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring mongod..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file="/etc/mongod.conf"
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file="/etc/mongod.conf"
|
||||
|
||||
ynh_exec_warn_less systemctl enable $MONGO_CE_SERVICENAME --quiet
|
||||
ynh_systemd_action --service_name=$MONGO_CE_SERVICENAME --action=restart --log_path=/var/log/mongodb/$MONGO_CE_SERVICENAME.log --line_match="Waiting for connections"
|
||||
ynh_exec_warn_less systemctl enable mongod --quiet
|
||||
ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --line_match="Waiting for connections"
|
||||
|
||||
if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
||||
|
@ -141,7 +142,7 @@ ynh_script_progression --message="Building $app... (this will take some time and
|
|||
|
||||
pushd $final_path/programs/server
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH npm install --unsafe-perm
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --unsafe-perm
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue