my_idlers_ynh/scripts/install

78 lines
2.6 KiB
Text
Raw Normal View History

2014-10-20 18:55:53 +02:00
#!/bin/bash
2017-06-02 18:23:51 +02:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-06-05 13:11:48 +02:00
source _common.sh
2017-06-02 18:23:51 +02:00
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-06-20 23:49:43 +02:00
ynh_script_progression "Setting up source files..."
2017-06-02 18:23:51 +02:00
ynh_setup_source --dest_dir="$install_dir"
2023-12-30 03:02:42 +01:00
chown -R "$app:www-data" "$install_dir"
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
2024-06-20 23:49:43 +02:00
ynh_script_progression "Adding $app's configuration files..."
ynh_config_add --template=.env --destination="$install_dir/.env"
chmod 640 "$install_dir/.env"
chown "$app:www-data" "$install_dir/.env"
2017-06-02 18:23:51 +02:00
#=================================================
# SYSTEM CONFIGURATION
2017-06-02 18:23:51 +02:00
#=================================================
2024-06-20 23:49:43 +02:00
ynh_script_progression "Adding system configurations related to $app..."
2017-06-02 18:23:51 +02:00
2024-06-20 23:49:43 +02:00
ynh_config_add_nginx
2022-05-31 01:56:33 +02:00
#=================================================
# INSTALL APP WITH COMPOSER
#=================================================
ynh_script_progression "Installing app with Composer..."
ynh_composer_install
ynh_composer_exec install --no-dev
#=================================================
# BUILDING
#=================================================
ynh_script_progression "configuring $app..."
pushd "$install_dir"
"php$php_version" artisan key:generate -n --force --env
"php$php_version" artisan make:database $app
"php$php_version" artisan migrate:fresh --seed -n --force
"php$php_version" artisan config:clear -n
"php$php_version" artisan config:cache -n
popd
2025-03-03 14:09:06 +01:00
2025-03-03 22:10:40 +01:00
# file was touched by artisan, create a new key (copy/paste from Lychee)
ynh_store_file_checksum "$install_dir/.env"
app_key=$(cat $install_dir/.env | grep -e ^APP_KEY | cut -c 9-)
ynh_app_setting_set --key=app_key --value=$app_key
2025-03-01 10:59:53 +01:00
# group only, make it www-data vs user/group $app:www-data
chgrp "www-data" -R "$install_dir/storage" "$install_dir/public"
chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public" "$install_dir/bootstrap/"
2017-06-02 18:23:51 +02:00
#=================================================
2017-06-17 17:49:26 +02:00
# SETUP APPLICATION WITH CURL
2017-06-02 18:23:51 +02:00
#=================================================
2024-06-20 23:49:43 +02:00
ynh_script_progression "Finalizing installation..."
2025-03-03 22:10:40 +01:00
# Installation with curl: set up the first/single user
ynh_local_curl "/INSTALL_PATH" "key1=$user" "key2=$email" "key3=$password" "key4=$password"
2019-05-02 20:44:22 +02:00
2019-02-10 15:02:38 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2024-06-20 23:49:43 +02:00
ynh_script_progression "Installation of $app completed"