2022-12-27 17:59:56 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
2024-01-04 15:53:06 +01:00
|
|
|
|
2023-01-09 19:07:33 +01:00
|
|
|
mongo_version=6.0
|
2023-01-02 19:03:27 +01:00
|
|
|
|
2022-12-30 10:21:10 +01:00
|
|
|
# List of services to be installed
|
|
|
|
SERVICES_LIST=(ide preview project data)
|
|
|
|
|
|
|
|
# List of Mongo databases to manage
|
2024-04-01 11:42:02 +02:00
|
|
|
MONGO_DB_LIST=(Projects Data)
|
2022-12-30 10:21:10 +01:00
|
|
|
|
2024-01-03 23:19:38 +01:00
|
|
|
# The list of port in the same order than the list of services
|
|
|
|
PORT_LIST=("$port_ide" "$port_preview" "$port_project" "$port_data")
|
|
|
|
|
2024-01-04 15:53:06 +01:00
|
|
|
java_version=17
|
|
|
|
ynh_java="/usr/lib/jvm/java-${java_version}-openjdk-amd64/bin/java"
|
|
|
|
|
2022-12-27 17:59:56 +01:00
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
2023-01-04 14:35:25 +01:00
|
|
|
append_uri() {
|
2024-01-05 16:27:40 +01:00
|
|
|
local return="";
|
|
|
|
if [[ $1 == */ ]]; then
|
|
|
|
return=$1$2;
|
|
|
|
else
|
|
|
|
return=$1/$2
|
|
|
|
fi
|
|
|
|
echo "$return";
|
|
|
|
}
|
|
|
|
|
|
|
|
_install_restart_script_and_sudoers() {
|
|
|
|
# Enable restarting of services from ssh
|
|
|
|
ynh_add_config --template="restart-services.sh" --destination="$install_dir/restart-services.sh"
|
|
|
|
chown "$app:$app" "$install_dir/restart-services.sh"
|
|
|
|
chmod o-rwx,gu=rwx "$install_dir/restart-services.sh"
|
|
|
|
|
|
|
|
# Add sudoers file for this specific command
|
|
|
|
ynh_add_config --template="dont-code-sudoers" --destination="/etc/sudoers.d/$app-sudoers"
|
|
|
|
chown root:root "/etc/sudoers.d/$app-sudoers"
|
|
|
|
chmod o-rwx,gu=r "/etc/sudoers.d/$app-sudoers"
|
|
|
|
}
|
|
|
|
|
|
|
|
_remove_restart_script_and_sudoers() {
|
|
|
|
if [ -f "/etc/sudoers.d/$app-sudoers" ]; then
|
|
|
|
ynh_secure_remove --file="/etc/sudoers.d/$app-sudoers"
|
|
|
|
fi
|
2023-01-04 14:35:25 +01:00
|
|
|
}
|
2022-12-27 17:59:56 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|