#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers secret_key_base=$(ynh_string_random --length=24) signing_salt=$(ynh_string_random --length=24) encryption_salt=$(ynh_string_random --length=24) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app:$app "$install_dir/.env" #================================================= # SPECIFIC SETUP #================================================= # Configuration files #================================================= ynh_script_progression --message="Managing special dependencies..." --weight=1 ### Add just dependency # TODO : this is unsafe and should be dealt with in a better way. # There is currently no proper way to install it simply on Debian 11 https://github.com/casey/just#packages ynh_install_extra_app_dependencies --repo="https://proget.makedeb.org makedeb main" --package="just" --key='https://proget.makedeb.org/debian-feeds/makedeb.pub' apt update apt install makedeb git clone 'https://mpr.makedeb.org/just' cd just makedeb -si cd .. ynh_script_progression --message="Configuring..." --weight=1 ynh_exec_warn_less just config #================================================= # Configure the release #================================================= ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc mix deps.get --only prod ynh_exec_warn_less just js-deps-get ynh_exec_warn_less just assets-prepare ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc mix phx.digest # create an elexir release ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc mix release #================================================= # Run the release #================================================= release_folder="$install_dir/_build/prod/rel/bonfire/" # 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()'" # start bonfire as a daemon ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$release_folder/bin/bonfire start daemon" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last