1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/facilmap_ynh.git synced 2024-09-03 18:36:07 +02:00
This commit is contained in:
ericgaspar 2021-06-26 21:26:52 +02:00
parent 24c7b78331
commit 8f16a0cd66
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 24 additions and 55 deletions

View file

@ -1,6 +1,3 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
@ -22,7 +19,6 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email=squeak@eauchat.org Email=squeak@eauchat.org

View file

@ -15,7 +15,7 @@
"url": "https://squeak.eauchat.org" "url": "https://squeak.eauchat.org"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.7" "yunohost": ">= 4.2.4"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -80,21 +80,8 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=6 ynh_script_progression --message="Installing dependencies..." --weight=6
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
### Those deb packages will be installed as dependencies of this package.
### If you're not using this helper:
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
### - Remove the variable "pkg_dependencies" in _common.sh
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=30
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
@ -104,20 +91,31 @@ ynh_script_progression --message="Creating a MySQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name db_user=$db_name
db_pwd= # Will be set by facilmap_create_db
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
facilmap_create_db ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
#ynh_script_progression --message="Setting up source files..." --weight=100 ynh_script_progression --message="Setting up source files..." --weight=100
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
#ynh_setup_source --dest_dir="$final_path" #ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -126,14 +124,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
facilmap_create_user
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
@ -141,7 +131,12 @@ facilmap_create_user
#================================================= #=================================================
ynh_script_progression --message="Building node dependencies..." --weight=200 ynh_script_progression --message="Building node dependencies..." --weight=200
facilmap_install_app mkdir -p $final_path
chown -R $app $final_path
pushd $final_path
ynh_exec_as $app "$ynh_node_load_PATH" $ynh_npm install --prefix "$final_path" -g facilmap-server@"$facilmap_version"
popd
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -149,24 +144,15 @@ facilmap_install_app
ynh_script_progression --message="Configuring a systemd service..." --weight=2 ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --others_var="ynh_node_load_PATH" ynh_add_systemd_config
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding configuration..." --weight=2 ynh_script_progression --message="Adding configuration..." --weight=2
facilmap_add_config mkdir -p $final_path/etc
ynh_add_config --template="../conf/config.env" --destination="$final_path/etc/facilmap.env"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Setting app files permissions.." --weight=2
# Set permissions on app files
facilmap_set_permissions
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -199,22 +185,9 @@ ynh_script_progression --message="Configuring app permissions..." --weight=2
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi fi
# ### N.B. : the following extra permissions only make sense if your app
# ### does have for example an admin interface or an api.
#
# # Only the admin can access the admin panel of the app (if the app has an admin panel)
# ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
#
# # Everyone can access to the api part
# # We don't want to display the tile in the sso so we put --show_tile="false"
# # And we don't want that the YunoHost Admin can remove visitors group to this permission, so we put --protected="true"
# ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================