diff --git a/scripts/install b/scripts/install index 1883492..194d251 100755 --- a/scripts/install +++ b/scripts/install @@ -11,31 +11,6 @@ source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key=username) - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=23 - -ynh_exec_warn_less python3 -m pip install pipenv - - - -#================================================= -# CONFIGURE THE INSTALL SCRIPT -#================================================= -ynh_script_progression --message="Installing service script..." --weight=1 - -# key for the .env __KEY__ -key=$(ynh_string_random --length=45 | base64) -ynh_app_setting_set --app=$app --key=key --value=$key - - -ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env" -chmod 600 $install_dir/.env - -chown -R $app:www-data "$install_dir" - #================================================= # LOGROTATE ynh_script_progression --message="Configuring logrotate to manage application logfiles" --weight=1 @@ -47,36 +22,43 @@ chown -R $app:www-data /var/log/$app/ set -a; source "$install_dir/.env"; set +a +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=23 + +ynh_exec_warn_less python3 -m pip install pipenv + + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +#================================================= +# CONFIGURE THE INSTALL SCRIPT +#================================================= - -# Set permissions to app files -# mkdir -p "$install_dir/.venv" -# chown -R $app:$app "$install_dir" -# chmod -R g=u,g-w,o-rwx "$install_dir" -# setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$install_dir/.venv" -# setfacl -n -m g:$app.main:x "$install_dir" - -# pushd "$install_dir" -# sudo -u $app PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyter-server jupyterhub-ldapauthenticator pyzmq sudospawner 2>&1 -# sudo -u $app python3 -m pipenv run jupyterhub upgrade-db 2>&1 -# popd +# key for the .env __KEY__ +key=$(ynh_string_random --length=45 | base64) +ynh_app_setting_set --app=$app --key=key --value=$key ynh_script_progression --message="Setting up source files..." --weight=64 +chown -R $app:www-data "$install_dir" + pushd $install_dir mkdir -p .venv PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install fittrackee==$fittrackee_version python-dotenv - ynh_exec_warn_less $install_dir/.venv/bin/ftcli db upgrade + pipenv shell + ftcli db upgrade popd + + #================================================= # INITIALIZE DATABASE #================================================= -ynh_script_progression --message="Initializing Fittrackee database..." --weight=1 +# ynh_script_progression --message="Initializing database..." --weight=1 # ynh_exec_warn_less $install_dir/.venv/bin/ftcli db upgrade @@ -120,7 +102,7 @@ ynh_script_progression --message="Starting the systemd services..." --weight=15 # Start a systemd service ynh_systemd_action --service_name="${app}" --action="start" --log_path="/var/log/$app/$app.log" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="${app}_workers" --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name="${app}_workers" --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started" #================================================= # END OF SCRIPT