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

Update install

This commit is contained in:
ericgaspar 2020-12-27 13:24:44 +01:00
parent 2a8ac9c8ee
commit 789b895a25
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -33,45 +33,67 @@ script_dir=$PWD
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
if sudo yunohost domain list | grep -q $domain # Vérifie la liste des domaines
then # Si le domaine existe dans Yunohost
if sudo yunohost app map | grep -q $domain # Vérifie la liste des apps par domaine
then # Si une app est installée sur ce domaine.
WARNING echo "An app is already installed on the domain $domain. Mypads needs a whole domain or subdomain to himself."
fi
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_app_setting_set $app domain $domain
ynh_app_setting_set $app is_public $is_public
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=is_public --value=$is_public
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=1
port=$(ynh_find_port 4000) # Cherche un port libre.
ynh_app_setting_set $app port $port
# Find an available port
port=$(ynh_find_port --port=4000)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=5
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"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
### `ynh_add_nginx_config` will use the file conf/nginx.conf
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --time --weight=1
ynh_system_user_create $app /home/$app # Créer un utilisateur système dédié à l'app
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# SPECIFIC SETUP
@ -94,21 +116,9 @@ ynh_use_logrotate
# Copy files to the right place
#=================================================
final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path
ynh_setup_source $final_path
# Files owned by root, www-data can just read
chown www-data:www-data $final_path -R
chmod 755 $final_path -R
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
chown -R www-data: $final_path
chmod -R 755 $final_path
#=================================================
# SETUP SYSTEMD
@ -134,7 +144,6 @@ popd
#=================================================
service redis-server start
yunohost firewall allow Both $port
#=================================================
# Configure init script