|
|
@ -23,7 +23,6 @@ ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Retrieve arguments from the manifest ..."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
domain=$YNH_APP_ARG_DOMAIN
|
|
|
|
domain=$YNH_APP_ARG_DOMAIN
|
|
|
|
path_url=$YNH_APP_ARG_PATH
|
|
|
|
path_url=$YNH_APP_ARG_PATH
|
|
|
@ -47,7 +46,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
|
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Validating arguments ..."
|
|
|
|
ynh_print_info "Validating installation parameters..."
|
|
|
|
|
|
|
|
|
|
|
|
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
|
|
|
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
|
|
|
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
|
|
|
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
|
|
@ -63,7 +62,7 @@ ynh_webpath_register $app $domain $path_url
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# STORE SETTINGS FROM MANIFEST
|
|
|
|
# STORE SETTINGS FROM MANIFEST
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Store settings from manifest ..."
|
|
|
|
ynh_print_info "Storing installation settings..."
|
|
|
|
|
|
|
|
|
|
|
|
ynh_app_setting_set $app domain $domain
|
|
|
|
ynh_app_setting_set $app domain $domain
|
|
|
|
ynh_app_setting_set $app path $path_url
|
|
|
|
ynh_app_setting_set $app path $path_url
|
|
|
@ -76,7 +75,7 @@ ynh_app_setting_set $app language $language
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# FIND AND OPEN A PORT
|
|
|
|
# FIND AND OPEN A PORT
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Configuring firewall ..."
|
|
|
|
ynh_print_info "Configuring firewall..."
|
|
|
|
|
|
|
|
|
|
|
|
### Use these lines if you have to open a port for the application
|
|
|
|
### Use these lines if you have to open a port for the application
|
|
|
|
### `ynh_find_port` will find the first available port starting from the given port.
|
|
|
|
### `ynh_find_port` will find the first available port starting from the given port.
|
|
|
@ -92,7 +91,7 @@ ynh_app_setting_set $app port $port
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# INSTALL DEPENDENCIES
|
|
|
|
# INSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Installing dependencies ..."
|
|
|
|
ynh_print_info "Installing dependencies..."
|
|
|
|
|
|
|
|
|
|
|
|
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
|
|
|
### `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.
|
|
|
|
### Those deb packages will be installed as dependencies of this package.
|
|
|
@ -106,7 +105,7 @@ ynh_install_app_dependencies deb1 deb2
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# CREATE A MYSQL DATABASE
|
|
|
|
# CREATE A MYSQL DATABASE
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Creating a mysql database ..."
|
|
|
|
ynh_print_info "Creating a mysql database..."
|
|
|
|
|
|
|
|
|
|
|
|
### Use these lines if you need a database for the application.
|
|
|
|
### Use these lines if you need a database for the application.
|
|
|
|
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
|
|
|
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
|
|
@ -124,7 +123,7 @@ ynh_mysql_setup_db $db_name $db_name
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Setting up source files ..."
|
|
|
|
ynh_print_info "Setting up source files..."
|
|
|
|
|
|
|
|
|
|
|
|
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
|
|
|
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
|
|
|
### downloaded from an upstream source, like a git repository.
|
|
|
|
### downloaded from an upstream source, like a git repository.
|
|
|
@ -137,7 +136,7 @@ ynh_setup_source "$final_path"
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Configuring nginx ..."
|
|
|
|
ynh_print_info "Configuring nginx..."
|
|
|
|
|
|
|
|
|
|
|
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
|
|
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
|
|
|
|
|
|
|
|
|
|
@ -147,7 +146,7 @@ ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# CREATE DEDICATED USER
|
|
|
|
# CREATE DEDICATED USER
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Configuring system user ..."
|
|
|
|
ynh_print_info "Configuring system user..."
|
|
|
|
|
|
|
|
|
|
|
|
# Create a system user
|
|
|
|
# Create a system user
|
|
|
|
ynh_system_user_create $app
|
|
|
|
ynh_system_user_create $app
|
|
|
@ -155,7 +154,7 @@ ynh_system_user_create $app
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Configuring php-fpm ..."
|
|
|
|
ynh_print_info "Configuring php-fpm..."
|
|
|
|
|
|
|
|
|
|
|
|
### `ynh_add_fpm_config` is used to set up a PHP config.
|
|
|
|
### `ynh_add_fpm_config` is used to set up a PHP config.
|
|
|
|
### You can remove it if your app doesn't use PHP.
|
|
|
|
### You can remove it if your app doesn't use PHP.
|
|
|
@ -180,7 +179,7 @@ ynh_add_fpm_config
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# SETUP SYSTEMD
|
|
|
|
# SETUP SYSTEMD
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Configuring a systemd service ..."
|
|
|
|
ynh_print_info "Configuring a systemd service..."
|
|
|
|
|
|
|
|
|
|
|
|
### `ynh_systemd_config` is used to configure a systemd script for an app.
|
|
|
|
### `ynh_systemd_config` is used to configure a systemd script for an app.
|
|
|
|
### It can be used for apps that use sysvinit (with adaptation) or systemd.
|
|
|
|
### It can be used for apps that use sysvinit (with adaptation) or systemd.
|
|
|
@ -209,7 +208,7 @@ ynh_add_systemd_config
|
|
|
|
chown -R $app: $final_path
|
|
|
|
chown -R $app: $final_path
|
|
|
|
|
|
|
|
|
|
|
|
# Set the app as temporarily public for curl call
|
|
|
|
# Set the app as temporarily public for curl call
|
|
|
|
ynh_print_info "Configuring ssowat ..."
|
|
|
|
ynh_print_info "Configuring ssowat..."
|
|
|
|
ynh_app_setting_set $app skipped_uris "/"
|
|
|
|
ynh_app_setting_set $app skipped_uris "/"
|
|
|
|
# Reload SSOwat config
|
|
|
|
# Reload SSOwat config
|
|
|
|
yunohost app ssowatconf
|
|
|
|
yunohost app ssowatconf
|
|
|
@ -218,7 +217,7 @@ yunohost app ssowatconf
|
|
|
|
systemctl reload nginx
|
|
|
|
systemctl reload nginx
|
|
|
|
|
|
|
|
|
|
|
|
# Installation with curl
|
|
|
|
# Installation with curl
|
|
|
|
ynh_print_info "Finalizing install ..."
|
|
|
|
ynh_print_info "Finalizing install..."
|
|
|
|
ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
|
|
|
|
ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
|
|
|
|
|
|
|
|
|
|
|
|
# Remove the public access
|
|
|
|
# Remove the public access
|
|
|
@ -263,7 +262,7 @@ chown -R root: $final_path
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# SETUP LOGROTATE
|
|
|
|
# SETUP LOGROTATE
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Configuring log rotation ..."
|
|
|
|
ynh_print_info "Configuring log rotation..."
|
|
|
|
|
|
|
|
|
|
|
|
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
|
|
|
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
|
|
|
### Use this helper only if there is effectively a log file for this app.
|
|
|
|
### Use this helper only if there is effectively a log file for this app.
|
|
|
@ -295,7 +294,7 @@ yunohost service add $app --log "/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# SETUP SSOWAT
|
|
|
|
# SETUP SSOWAT
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring SSOwat ..."
|
|
|
|
ynh_script_progression --message="Configuring SSOwat..."
|
|
|
|
|
|
|
|
|
|
|
|
# Make app public if necessary
|
|
|
|
# Make app public if necessary
|
|
|
|
if [ $is_public -eq 1 ]
|
|
|
|
if [ $is_public -eq 1 ]
|
|
|
@ -307,7 +306,7 @@ fi
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX
|
|
|
|
# RELOAD NGINX
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Reloading nginx ..."
|
|
|
|
ynh_print_info "Reloading nginx..."
|
|
|
|
|
|
|
|
|
|
|
|
systemctl reload nginx
|
|
|
|
systemctl reload nginx
|
|
|
|
|
|
|
|
|
|
|
|