#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source experimental_helper.sh source _common.sh source /usr/share/yunohost/helpers #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_script_progression --message="Installing sources files..." --weight=10 setup_dir install_source #================================================= # SPECIFIC SETUP #================================================= # ... #================================================= ynh_script_progression --message="Configuring application..." # CONFIGURE PGADMIN config_pgadmin # Config uwsgi ynh_add_uwsgi_service ynh_script_progression --message="Configuring sqlite database..." # initialisation sqlite database for pgadmin chmod +x ../conf/setup.exp set +u; source $install_dir/bin/activate set -u; ynh_replace_special_string --match_string "__ADMIN_PASSWORD__" --replace_string "$admin_pwd" --target_file "../conf/setup.exp" ../conf/setup.exp "$install_dir/bin/python3" "$install_dir/lib/python$python_version/site-packages/pgadmin4/setup.py" "$email" # POPULATE THE DATABASE ynh_script_progression --message="Configuring Postgresql database..." #REMOVEME? ynh_psql_test_if_first_run ynh_psql_execute_as_root \ --sql "CREATE USER ${db_user} WITH PASSWORD '${db_pwd}' SUPERUSER CREATEDB CREATEROLE REPLICATION" # Add Server In PGadmin database $install_dir/bin/python3 config_database.py "$db_user" "$db_pwd" set +u; deactivate set -u; # Set permission after initialisation ynh_script_progression --message="Protecting directory" set_permission #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config ynh_use_logrotate --logfile="/var/log/pgadmin" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_systemd_action --service_name "uwsgi-app@$app.service" --action="restart" --line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log" sleep 10 #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last