mirror of
https://github.com/YunoHost-Apps/lstu_ynh.git
synced 2024-09-03 19:36:12 +02:00
Adding ynh_print_info
This commit is contained in:
parent
129708d6d3
commit
a210a14679
1 changed files with 20 additions and 2 deletions
|
@ -36,9 +36,8 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
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 provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
||||
|
@ -53,6 +52,7 @@ ynh_webpath_register $app $domain $path_url
|
|||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_print_info "Configuring firewall..."
|
||||
|
||||
# Find a free port
|
||||
port=$(ynh_find_port 8095)
|
||||
|
@ -62,6 +62,7 @@ yunohost firewall allow --no-upnp TCP $port 2>&1
|
|||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_print_info "Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app is_public $is_public
|
||||
|
@ -74,6 +75,7 @@ ynh_app_setting_set $app hashed_password $hashed_password
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Installing dependencies..."
|
||||
|
||||
ynh_install_app_dependencies build-essential libssl-dev zlib1g-dev libpng-dev libpq-dev memcached postgresql cpanminus
|
||||
# Install Carton
|
||||
|
@ -82,6 +84,7 @@ echo yes | cpanm Carton
|
|||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Creating a PostgreSQL database..."
|
||||
|
||||
# Create postgresql database
|
||||
ynh_psql_test_if_first_run
|
||||
|
@ -95,6 +98,7 @@ db_pwd=$(ynh_app_setting_get $app psqlpwd) # Password created in ynh_psql_setup_
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Setting up source files..."
|
||||
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
|
@ -103,6 +107,7 @@ ynh_setup_source "$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Configuring nginx web server..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
@ -110,6 +115,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
|
@ -117,6 +123,7 @@ ynh_system_user_create $app
|
|||
#=================================================
|
||||
## Copy and fix variable into lstu config
|
||||
#=================================================
|
||||
ynh_print_info "Configuring lstu..."
|
||||
|
||||
cp ../conf/lstu.conf.template "${final_path}/lstu.conf"
|
||||
ynh_replace_string "__DOMAIN__" "$domain" "${final_path}/lstu.conf"
|
||||
|
@ -142,6 +149,7 @@ ynh_store_file_checksum "${final_path}/lstu.conf"
|
|||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Configuring a systemd service..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
@ -149,6 +157,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
# Install lstu's dependencies via carton
|
||||
#=================================================
|
||||
ynh_print_info "Installing lstu..."
|
||||
|
||||
pushd $final_path
|
||||
carton install --deployment --without=sqlite --without=mysql
|
||||
|
@ -157,6 +166,7 @@ popd
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Configuring log rotation..."
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
@ -170,6 +180,7 @@ yunohost service add $app --log "/var/log/$app.log" --log "/var/www/$app/log/pro
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info "Configuring SSOwat..."
|
||||
|
||||
# Make app public or private
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
|
@ -196,7 +207,14 @@ ynh_systemd_action -n $app -a start -l "Server available at" -p "systemd"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
# Reload Nginx
|
||||
systemctl reload nginx
|
||||
yunohost app ssowatconf
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Installation of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue