Fix install_dir/sources

This commit is contained in:
Salamandar 2024-02-28 13:33:07 +01:00
parent 397bb7402e
commit 1b1b5ccefa
4 changed files with 14 additions and 14 deletions

View file

@ -2,7 +2,7 @@
location __PATH__/ { location __PATH__/ {
# Path to source # Path to source
alias __INSTALL_DIR__/; alias __INSTALL_DIR__/sources/;
proxy_pass http://localhost:__PORT__; proxy_pass http://localhost:__PORT__;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;

View file

@ -5,11 +5,11 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
Environment=NODE_ENV=production Environment=NODE_ENV=production
Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/sources/config
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
ExecStart=__YNH_NPM__ start ExecStart=__YNH_NPM__ start
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/sources/
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog
SyslogIdentifier=__APP__ SyslogIdentifier=__APP__

View file

@ -38,10 +38,10 @@ chown -R "$app:$app" "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Building..." ynh_script_progression --message="Building..."
pushd "$install_dir" pushd "$install_dir/sources"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile
ynh_exec_as "$app" mkdir -p "$install_dir/dist" ynh_exec_as "$app" mkdir -p "dist"
ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run build ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run build
popd popd
@ -50,10 +50,10 @@ popd
#================================================= #=================================================
ynh_script_progression --message="Adding a config file..." ynh_script_progression --message="Adding a config file..."
ynh_add_config --template="default.yaml" --destination="$install_dir/config/production.yaml" ynh_add_config --template="default.yaml" --destination="$install_dir/sources/config/production.yaml"
chmod 400 "$install_dir/config/production.yaml" chmod 400 "$install_dir/sources/config/production.yaml"
chown "$app:$app" "$install_dir/config/production.yaml" chown "$app:$app" "$install_dir/sources/config/production.yaml"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION

View file

@ -39,7 +39,7 @@ ynh_script_progression --message="Ensuring downward compatibility..."
# Move git repository one step lower # Move git repository one step lower
if [ -d "$install_dir/.git" ]; then if [ -d "$install_dir/.git" ]; then
mkdir "${install_dir}__tmp__" mkdir "${install_dir}__tmp__"
mv "$install_dir" "${install_dir}__tmp__" mv "$install_dir" "${install_dir}__tmp__/sources"
mv "${install_dir}__tmp__" "$install_dir" mv "${install_dir}__tmp__" "$install_dir"
fi fi
@ -62,10 +62,10 @@ chown -R "$app:$app" "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Building..." ynh_script_progression --message="Building..."
pushd "$install_dir" pushd "$install_dir/sources"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile
ynh_exec_as "$app" mkdir -p "$install_dir/dist" ynh_exec_as "$app" mkdir -p "dist"
ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run build ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run build
popd popd
@ -74,10 +74,10 @@ popd
#================================================= #=================================================
ynh_script_progression --message="Updating a config file..." ynh_script_progression --message="Updating a config file..."
ynh_add_config --template="default.yaml" --destination="$install_dir/config/production.yaml" ynh_add_config --template="default.yaml" --destination="$install_dir/sources/config/production.yaml"
chmod 400 "$install_dir/config/production.yaml" chmod 400 "$install_dir/sources/config/production.yaml"
chown "$app:$app" "$install_dir/config/production.yaml" chown "$app:$app" "$install_dir/sources/config/production.yaml"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS