1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mobilizon_ynh.git synced 2024-09-03 19:46:19 +02:00

switch to /live

This commit is contained in:
yalh76 2021-07-31 00:32:53 +02:00
parent 55c30b5a9d
commit f78e70977e
3 changed files with 24 additions and 17 deletions

View file

@ -113,7 +113,7 @@ fi
#=================================================
ynh_script_progression --message="Modifying a config file..."
config="$final_path/$app/config/runtime.exs"
config="$final_path/live/config/runtime.exs"
ynh_backup_if_checksum_is_different --file="$config"
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$config"

View file

@ -122,7 +122,7 @@ ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/$app"
ynh_setup_source --dest_dir="$final_path/live"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
@ -158,9 +158,9 @@ chown -R $app:$app "$datadir"
#=================================================
ynh_script_progression --message="Installing dependencies and building app..." --weight=5
config="$final_path/$app/config/runtime.exs"
config="$final_path/live/config/runtime.exs"
pushd $final_path/$app/js
pushd $final_path/live/js
ynh_use_nodejs
ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)"
sudo -u $app env PATH=$PATH yarn install
@ -168,10 +168,10 @@ pushd $final_path/$app/js
sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build
popd
ynh_secure_remove --file="$final_path/$app/js"
ynh_secure_remove --file="$final_path/live/js"
ynh_script_progression --message="Building Elixir application (this is going to take a while...)"
pushd $final_path/$app
pushd $final_path/live
sudo -u "$app" MIX_ENV=prod mix local.hex --force
sudo -u "$app" MIX_ENV=prod mix local.rebar --force
ynh_exec_warn_less sudo -u "$app" MIX_ENV=prod mix deps.get
@ -188,7 +188,7 @@ chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
pushd $final_path/$app
pushd $final_path/live
chmod o-rwx $config
ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="$config"
ynh_replace_string --match_string="__YNH_USER_PASSWORD__" --replace_string="${ynh_user_password}" --target_file="$config"

View file

@ -156,6 +156,13 @@ if [ ! -f "$final_path/$app/config/runtime.exs" ]; then
ynh_store_file_checksum --file="$final_path/$app/config/runtime.exs"
fi
if ynh_version_gt "1.2.3~ynh1" "${previous_version}" ; then
ynh_script_progression --message="Upgrade to 1.2.3~ynh1..."
ynh_delete_file_checksum --file="$final_path/$app/config/runtime.exs"
mv "$final_path/$app/" "$final_path/live/"
ynh_store_file_checksum --file="$final_path/live/config/runtime.exs"
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -176,16 +183,16 @@ then
tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir
cp -af "$final_path/$app/config/runtime.exs" "$tmpdir/runtime.exs"
cp -af "$final_path/live/config/runtime.exs" "$tmpdir/runtime.exs"
# Remove the app directory securely
ynh_secure_remove --file="$final_path/$app"
ynh_secure_remove --file="$final_path/live"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/$app"
ynh_setup_source --dest_dir="$final_path/live"
# Restore the config file
cp -af "$tmpdir/runtime.exs" "$final_path/$app/config/runtime.exs"
cp -af "$tmpdir/runtime.exs" "$final_path/live/config/runtime.exs"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
@ -233,7 +240,7 @@ ynh_script_progression --message="Create datadir folder..."
mkdir -p $datadir
mkdir -p "$datadir/uploads/"
config="$final_path/$app/config/runtime.exs"
config="$final_path/live/config/runtime.exs"
ynh_backup_if_checksum_is_different --file="$config"
@ -247,7 +254,7 @@ chown -R $app:$app "$datadir"
# MAKE SETUP
#=================================================
pushd $final_path/$app/js
pushd $final_path/live/js
ynh_use_nodejs
ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)"
sudo -u $app env PATH=$PATH yarn install
@ -256,10 +263,10 @@ pushd $final_path/$app/js
sudo -u $app env PATH=$PATH yarn cache clean --all
popd
ynh_secure_remove --file="$final_path/$app/js"
ynh_secure_remove --file="$final_path/live/js"
ynh_script_progression --message="Building Elixir application (this is going to take a while...)"
pushd $final_path/$app
pushd $final_path/live
sudo -u "$app" MIX_ENV=prod mix local.hex --force
sudo -u "$app" MIX_ENV=prod mix local.rebar --force
ynh_exec_warn_less sudo -u "$app" MIX_ENV=prod mix deps.get
@ -275,7 +282,7 @@ ynh_secure_remove --file="$final_path/.cache"
if ynh_version_gt "1.0.3~ynh1" "${previous_version}" ; then
ynh_script_progression --message="Mobilizon v1.0.3: Refresh remote profiles to save avatars locally"
pushd $final_path/$app
pushd $final_path/live
sudo -u "$app" MIX_ENV=prod mix mobilizon.actors.refresh --all
popd
fi
@ -285,7 +292,7 @@ fi
#=================================================
ynh_script_progression --message="Updating a configuration file..."
config="$final_path/$app/config/runtime.exs"
config="$final_path/live/config/runtime.exs"
ynh_backup_if_checksum_is_different --file="$config"
ynh_store_file_checksum --file="$config"