1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rocketchat_ynh.git synced 2024-09-03 20:16:25 +02:00

Set admin (#85)

* Add admin
This commit is contained in:
Éric Gaspar 2021-11-19 13:47:53 +01:00 committed by GitHub
parent 548e23a28c
commit a1283ee80a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 10 deletions

View file

@ -2,7 +2,9 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
is_public=1
password="1Strong-Password"
; Checks
pkg_linter=1
setup_sub_dir=1

View file

@ -17,6 +17,10 @@ Environment=MONGO_URL=mongodb://localhost:27017/__APP__?replicaSet=rs01
Environment=MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01
Environment=ROOT_URL=https://__DOMAIN____PATH__
Environment=PORT=__PORT__
Environment=ADMIN_USERNAME=__ADMIN__
Environment=ADMIN_PASS=__PASSWORD__
Environment=ADMIN_EMAIL=__EMAIL__
Environment=OVERWRITE_SETTING_Show_Setup_Wizard=completed
[Install]
WantedBy=multi-user.target

View file

@ -39,10 +39,18 @@
"example": "/rocketchat",
"default": "/rocketchat"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
"default": true
},
{
"name": "password",
"type": "password"
}
]
}

View file

@ -357,7 +357,7 @@ ynh_remove_mongo() {
# Only remove the mongodb service if it is not installed.
if ! ynh_package_is_installed --package="mongodb*"
then
ynh_print_info --message="Removing MongoDB service..."
ynh_script_progression --message="Removing MongoDB service..." --weight=2
# Define Mongo Service Name
if [ "$(lsb_release --codename --short)" = "buster" ]; then
MONGODB_SERVICENAME=$MONGO_CE_SERVICENAME

View file

@ -26,6 +26,9 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
password=$YNH_APP_ARG_PASSWORD
admin=$YNH_APP_ARG_ADMIN
email=$(ynh_user_get_info --username=$admin --key=mail)
app=$YNH_APP_INSTANCE_NAME
@ -47,6 +50,9 @@ 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
@ -80,8 +86,6 @@ db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name
#mongo < ../conf/rocketchat_ldap.js
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -101,7 +105,7 @@ ynh_setup_source --dest_dir=$final_path
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
@ -120,7 +124,7 @@ ynh_script_progression --message="Building $app... (this will take some time and
pushd $final_path/programs/server
ynh_use_nodejs
ynh_exec_as $app env $ynh_node_load_PATH npm install 2>/dev/null
ynh_exec_as $app env $ynh_node_load_PATH npm install --unsafe-perm 2>/dev/null
popd
#=================================================
@ -179,7 +183,7 @@ ynh_systemd_action --service_name=$mongodb_servicename --action=restart
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
sleep 120
sleep 100
#=================================================
# SETUP SSOWAT

View file

@ -77,6 +77,10 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
# 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
#=================================================

View file

@ -65,7 +65,7 @@ ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# SPECIFIC RESTORATION

View file

@ -22,6 +22,9 @@ 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)
#=================================================
# CHECK VERSION
@ -93,7 +96,7 @@ fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
@ -119,7 +122,7 @@ ynh_script_progression --message="Building $app... (this will take some time and
pushd $final_path/programs/server
ynh_use_nodejs
ynh_exec_as $app env $ynh_node_load_PATH npm install 2>/dev/null
ynh_exec_as $app env $ynh_node_load_PATH npm install --unsafe-perm 2>/dev/null
popd
#=================================================
@ -169,7 +172,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=10
ynh_systemd_action --service_name=$mongodb_servicename --action=restart --log_path=systemd
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
sleep 120
sleep 100
#=================================================
# RELOAD NGINX