1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bonfire_ynh.git synced 2024-09-03 18:16:01 +02:00

package v2 : install_dir instead of final_path

This commit is contained in:
lapineige 2023-02-05 18:14:48 +01:00 committed by GitHub
parent 343633820d
commit 7ad9054ae7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,8 +56,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app"
final_path=/var/www/$app test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -112,7 +111,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Configuring system user..." --weight=1 ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
@ -135,9 +134,9 @@ ynh_script_progression --message="Setting up source files..." --weight=1
### downloaded from an upstream source, like a git repository. ### downloaded from an upstream source, like a git repository.
### `ynh_setup_source` use the file conf/app.src ### `ynh_setup_source` use the file conf/app.src
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$install_dir"
# FIXME: this should be managed by the core in the future # FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions # Here, as a packager, you may have to tweak the ownerhsip/permissions
@ -145,9 +144,9 @@ ynh_setup_source --dest_dir="$final_path"
# files in some cases. # files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue. # this will be treated as a security issue.
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -165,8 +164,8 @@ ynh_add_nginx_config
# Configuration files # Configuration files
#================================================= #=================================================
config="$final_path/.config" config="$install_dir/.config"
env_file="$final_path/.env" env_file="$install_dir/.env"
export MIX_ENV=prod FLAVOUR=classic export MIX_ENV=prod FLAVOUR=classic
@ -205,7 +204,7 @@ ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc mix release
#================================================= #=================================================
# Run the release # Run the release
#================================================= #=================================================
release_folder="$final_path/_build/prod/rel/bonfire/" release_folder="$install_dir/_build/prod/rel/bonfire/"
# Database created before, let's run the migrations # Database created before, let's run the migrations
ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$release_folder/bin/bonfire eval 'EctoSparkles.Migrator.migrate()'" ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$release_folder/bin/bonfire eval 'EctoSparkles.Migrator.migrate()'"