1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/plainpad_ynh.git synced 2024-09-03 20:05:53 +02:00
plainpad_ynh/scripts/install

80 lines
2.5 KiB
Text
Raw Normal View History

2021-08-14 12:46:57 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
key=$(ynh_string_random --length=32)
2021-08-14 13:53:49 +02:00
ynh_app_setting_set --app=$app --key=key --value=$key
2021-08-14 12:46:57 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
2023-03-27 18:56:29 +02:00
ynh_setup_source --dest_dir="$install_dir"
2021-08-14 12:46:57 +02:00
2023-03-27 18:56:29 +02:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-08-14 12:46:57 +02:00
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated PHP-FPM config
2023-03-27 19:03:15 +02:00
ynh_add_fpm_config --usage=low --footprint=low
2021-08-14 12:46:57 +02:00
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
2023-03-27 18:56:29 +02:00
ynh_add_config --template="../conf/.env.example" --destination="$install_dir/.env"
2021-08-14 12:46:57 +02:00
2023-03-27 18:56:29 +02:00
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
2021-08-14 12:46:57 +02:00
#=================================================
# SPECIFIC SETUP
#=================================================
ynh_script_progression --message="Migrating database..." --weight=1
2023-03-27 18:56:29 +02:00
pushd "$install_dir"
2022-04-05 12:35:42 +02:00
php$phpversion artisan migrate:fresh -n --seed
2021-08-14 12:46:57 +02:00
popd
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last