From 288fc6dc4afca55c539f10728fc19328d51e9de9 Mon Sep 17 00:00:00 2001 From: Antoine Lima Date: Sat, 9 Mar 2024 22:06:10 +0100 Subject: [PATCH] Remove cache and temporary files from the install_dir (lighter backups) --- conf/crabfit-back.service | 2 +- scripts/_common.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/conf/crabfit-back.service b/conf/crabfit-back.service index 644013b..8188252 100644 --- a/conf/crabfit-back.service +++ b/conf/crabfit-back.service @@ -10,7 +10,7 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/api StandardOutput=append:/var/log/__APP__/__APP__-back.log StandardError=inherit -ExecStart=__INSTALL_DIR__/api/target/release/crabfit-api +ExecStart=__INSTALL_DIR__/crabfit-api # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/scripts/_common.sh b/scripts/_common.sh index c112a06..500756e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -34,12 +34,15 @@ function build_backend # Remove build files and rustup ynh_secure_remove --file="$install_dir/api/.cargo" ynh_secure_remove --file="$install_dir/api/.rustup" + mv target/release/crabfit-api .. + ynh_secure_remove --file="$install_dir/api/target" popd } function build_frontend { ynh_script_progression --message="Building crabfit frontend..." --weight=1 + pushd $install_dir/frontend # Paths are currently absolute, which breaks having a /api/ path prefix # TODO: MR to the upstream @@ -50,6 +53,8 @@ function build_frontend ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" $nodejs_path/yarn install --production --frozen-lockfile ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" $ynh_npm run build popd + + ynh_secure_remove --file="$install_dir/.cache" } #=================================================