Don't use git anymore

This commit is contained in:
Florent 2023-02-06 12:04:29 +01:00 committed by Florent F
parent c5b234066e
commit fbeeb6083e
4 changed files with 16 additions and 25 deletions

View file

@ -8,9 +8,10 @@ Requires=elasticsearch8.service
Type=simple Type=simple
Environment=NODE_ENV=production Environment=NODE_ENV=production
Environment=NODE_CONFIG_DIR=__FINALPATH__/config Environment=NODE_CONFIG_DIR=__FINALPATH__/config
Environment="__YNH_NODE_LOAD_PATH__"
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
ExecStart=__YNH_NPM__ start ExecStart=__YNH_NODE__ __FINALPATH__/dist/server.js
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__FINALPATH__/
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog

View file

@ -5,7 +5,7 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="git" pkg_dependencies=""
app_dependencies="elasticsearch8" app_dependencies="elasticsearch8"
extra_pkg_dependencies="elasticsearch-oss" extra_pkg_dependencies="elasticsearch-oss"

View file

@ -64,9 +64,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." ynh_script_progression --message="Installing dependencies..."
ynh_install_apps --apps="$app_dependencies" ynh_install_apps --apps="$app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
@ -85,16 +83,12 @@ ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
git clone $REPOSITORY $final_path --quiet ynh_setup_source --dest_dir="$final_path" --keep="config/local.yaml"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path" chown -R $app:$app "$final_path"
pushd "$final_path"
ynh_exec_as $app git checkout $COMMIT --quiet
popd
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -111,13 +105,16 @@ ynh_add_nginx_config
ynh_script_progression --message="Building..." ynh_script_progression --message="Building..."
pushd "$final_path" pushd "$final_path"
ynh_exec_as $app git submodule update --init --recursive
ynh_use_nodejs ynh_use_nodejs
yarn install --pure-lockfile yarn install --pure-lockfile
ynh_exec_as $app mkdir "$final_path/dist"
$ynh_npm run build $ynh_npm run build
popd popd
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================

View file

@ -79,12 +79,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --full_replace=1 --dest_dir="$final_path" --keep="config/local.yaml"
pushd "$final_path"
ynh_exec_as $app git checkout master
ynh_exec_as $app git pull --quiet
ynh_exec_as $app git checkout $COMMIT --quiet
popd
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -105,17 +100,11 @@ ynh_add_nginx_config
ynh_script_progression --message="Upgrading dependencies..." ynh_script_progression --message="Upgrading dependencies..."
if ynh_compare_current_package_version --comparison lt --version 0.0.1.2023-01-04~ynh1; then if ynh_compare_current_package_version --comparison lt --version 0.0.1.2023-01-04~ynh1; then
# Remove elasticsearch from repositories # Remove elasticsearch and git from dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
# Fix rights
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
fi fi
ynh_install_apps --apps="$app_dependencies" ynh_install_apps --apps="$app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
@ -127,12 +116,16 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
ynh_script_progression --message="Building..." ynh_script_progression --message="Building..."
pushd "$final_path" pushd "$final_path"
ynh_exec_as $app git submodule update --init --recursive
ynh_use_nodejs ynh_use_nodejs
yarn install --pure-lockfile yarn install --pure-lockfile
$ynh_npm run build $ynh_npm run build
popd popd
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================