diff --git a/scripts/install b/scripts/install index 47785f7..ef79997 100755 --- a/scripts/install +++ b/scripts/install @@ -26,33 +26,12 @@ source /usr/share/yunohost/helpers ### $app is the app id (i.e. 'example' for first install, ### or 'example__2', '__3'... for multi-instance installs) -#================================================= -# INITIALIZE AND STORE SETTINGS -#================================================= - -# If you need to, you can define custom settings -# (or remove this section entirely if not relevant for you) -#foo="bar" -#ynh_app_setting_set --key=foo --value=$foo - -#ynh_app_setting_set --key=php_upload_max_filesize --value=50M -#ynh_app_setting_set --key=php_post_max_size --value=50M - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression "Setting up source files..." -### `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. -### `ynh_setup_source` use the file manifest.toml - -# Download, check integrity, uncompress and patch the source from manifest.toml ynh_setup_source --dest_dir="$install_dir" - -### $install_dir will automatically be initialized with some decent -### permission by default... however, you may need to recursively reapply -### ownership to all files such as after the ynh_setup_source step chown -R "$app:www-data" "$install_dir" #================================================= @@ -65,27 +44,13 @@ ynh_script_progression "Adding $app's configuration files..." ### Typically, put your template conf file in ../conf/your_config_file ### The template may contain strings such as __FOO__ or __FOO_BAR__, ### which will automatically be replaced by the values of $foo and $foo_bar -### -### ynh_config_add will also keep track of the config file's checksum, -### which later during upgrade may allow to automatically backup the config file -### if it's found that the file was manually modified -### ### Check the documentation of `ynh_config_add` for more info. -#ynh_config_add --template="some_config_file" --destination="$install_dir/some_config_file" +ynh_config_add --template=.env --destination="$install_dir/.env" -# FIXME: this should be handled by the core in the future -### You may need to use chmod 600 instead of 400, -### for example if the app is expected to be able to modify its own config -#chmod 600 "$install_dir/some_config_file" -#chown "$app:$app" "$install_dir/some_config_file" +chmod 600 "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" -### For more complex cases where you want to replace stuff using regexes, -### you shoud rely on ynh_replace (which is basically a wrapper for sed) -### When doing so, you also need to manually call ynh_store_file_checksum -### -### ynh_replace --match="match_string" --replace="replace_string" --file="$install_dir/some_config_file" -### ynh_store_file_checksum "$install_dir/some_config_file" #================================================= # SYSTEM CONFIGURATION @@ -134,10 +99,6 @@ ynh_config_add_systemd ### Additional options starting with 3.8: ### -### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed -### which will then be checked by YunoHost's diagnosis system -### (N.B. DO NOT USE THIS if the port is only internal!!!) -### ### --test_status "some command" a custom command to check the status of the service ### (only relevant if 'systemctl status' doesn't do a good job) ### @@ -149,20 +110,43 @@ ynh_config_add_systemd ### service though so you should re-provide all relevant flags when doing so) yunohost service add "$app" --description="Web app for displaying, organizing and storing information about servers (VPS), shared hosting, reseller hosting, domains and more." --log="/var/log/$app/$app.log" -### `ynh_config_add_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. -### If you're not using this helper: -### - Remove the section "BACKUP LOGROTATE" in the backup script -### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script -### - And the section "SETUP LOGROTATE" in the upgrade script - -# Use logrotate to manage application logfile(s) -#ynh_config_add_logrotate - # Create a dedicated Fail2Ban config #ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" +#================================================= +# 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 -n --force --env + "php$php_version" artisan migrate:fresh --seed -n --force + "php$php_version" artisan config:clear -n + "php$php_version" artisan config:cache -n + #"php$php_version" artisan lychee:create_user "$admin" "$password" + +popd + +# copy/paste from lychee install, for what it's worth... +# file was touched by artisan, rehash it +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 + +chgrp "$app" -R "$install_dir/storage" "$install_dir/public" "$install_dir/public/sym" +chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public" "$install_dir/bootstrap/" + #================================================= # SETUP APPLICATION WITH CURL #=================================================