From 45a6b6231d8f0a35a6c37040c173b6677af26fe5 Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 30 Dec 2023 10:52:22 +0100 Subject: [PATCH] Npm (#93) * fix * fix --- conf/.env.example | 14 +++++++------- manifest.toml | 1 + scripts/_common.sh | 2 ++ scripts/install | 19 +++++++++++++++++++ scripts/remove | 3 +++ scripts/restore | 8 ++++++++ scripts/upgrade | 19 +++++++++++++++++++ 7 files changed, 59 insertions(+), 7 deletions(-) diff --git a/conf/.env.example b/conf/.env.example index 4289340..efe6539 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -75,13 +75,13 @@ REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp -MAIL_HOST= -MAIL_PORT= -MAIL_USERNAME= -MAIL_PASSWORD= -MAIL_ENCRYPTION= -MAIL_FROM_NAME= -MAIL_FROM_ADDRESS= +MAIL_HOST=localhost +MAIL_PORT=25 +MAIL_USERNAME=__APP__ +MAIL_PASSWORD=__MAIL_PWD__ +MAIL_ENCRYPTION=false +MAIL_FROM_NAME=lychee +MAIL_FROM_ADDRESS=lychee@__DOMAIN__ # The trusted proxies if Lychee is behind a reverse proxy # Accepted values: diff --git a/manifest.toml b/manifest.toml index 6821ece..9c9ff56 100644 --- a/manifest.toml +++ b/manifest.toml @@ -51,6 +51,7 @@ ram.runtime = "50M" autoupdate.strategy = "latest_github_tag" [resources.system_user] + allow_email = true [resources.install_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index 1a7049a..27567b9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,6 +7,8 @@ # Composer version YNH_COMPOSER_VERSION="2.5.4" +nodejs_version=16 + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 5207195..cb20b54 100755 --- a/scripts/install +++ b/scripts/install @@ -19,6 +19,14 @@ fpm_usage="low" timezone="$(cat /etc/timezone)" +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=7 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -69,6 +77,17 @@ ynh_script_progression --message="Installing app with Composer..." --weight=15 ynh_install_composer +#================================================= +# INSTALL LYCHEE +#================================================= +ynh_script_progression --message="Installing $app..." --weight=10 + +pushd $install_dir + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $ynh_npm run build +popd + #================================================= # ADD A CONFIGURATION #================================================= diff --git a/scripts/remove b/scripts/remove index 61db822..04e45b2 100755 --- a/scripts/remove +++ b/scripts/remove @@ -20,6 +20,9 @@ ynh_remove_nginx_config # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +# Remove NodeJS +ynh_remove_nodejs + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 869b1ca..6f464d2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -30,6 +30,14 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory chown -R $app:www-data "$data_dir" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=7 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index afe1053..e5bad4e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,6 +57,14 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod -R 755 $data_dir +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=5 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -87,6 +95,17 @@ ynh_script_progression --message="Installing app with Composer..." --weight=1 ynh_install_composer +#================================================= +# INSTALL LYCHEE +#================================================= +ynh_script_progression --message="Installing $app..." --weight=10 + +pushd $install_dir + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $ynh_npm run build +popd + #================================================= # BUILDING #=================================================