#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # INSTALLĀ GO #================================================= ynh_script_progression --message="Installing Go..." --weight=10 ynh_install_go --go_version="$go_version" #================================================= # INSTALLĀ NODEJS #================================================= ynh_script_progression --message="Installing NodeJS..." --weight=10 ynh_install_nodejs --nodejs_version="$node_version" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=10 ynh_setup_source --dest_dir="$install_dir/sources" mkdir -p "$install_dir/output/"{data,ui} chown -R "$app:$app" "$install_dir" chown -R "$app:$app" "$data_dir" #================================================= # BUILD APP #================================================= ynh_script_progression --message="Compiling Go API..." --weight=10 build_api ynh_script_progression --message="Building static UI files..." --weight=10 build_ui cleanup_sources #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding $app's configuration file..." ynh_add_config --template=".env" --destination="$install_dir/output/.env" chown "$app:$app" "$install_dir/output/.env" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config yunohost service add "$app" --description="Photoview photo manager API" --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting $app's systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last