2024-01-30 11:37:53 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# SET ALL CONSTANTS
|
|
|
|
#=================================================
|
|
|
|
|
2020-04-20 15:32:01 +02:00
|
|
|
python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
|
2022-03-13 15:22:35 +01:00
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# DEFINE ALL COMMON FONCTIONS
|
|
|
|
#=================================================
|
|
|
|
|
2017-11-16 21:10:21 +01:00
|
|
|
setup_dir() {
|
|
|
|
# Create empty dir for pgadmin
|
|
|
|
mkdir -p /var/lib/pgadmin
|
|
|
|
mkdir -p /var/log/pgadmin
|
|
|
|
}
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2017-11-16 21:10:21 +01:00
|
|
|
set_permission() {
|
|
|
|
# Set permission
|
2024-01-30 11:36:14 +01:00
|
|
|
chown $app:root -R $install_dir
|
|
|
|
chown $app:root -R /var/lib/pgadmin
|
2022-03-19 12:19:38 +01:00
|
|
|
mkdir -p /var/log/pgadmin
|
2024-01-30 11:36:14 +01:00
|
|
|
chown $app:root -R /var/log/pgadmin
|
|
|
|
chown $app:root /var/log/uwsgi/$app
|
|
|
|
chown $app:root /etc/uwsgi/apps-available/$app.ini
|
2018-01-29 18:48:14 +01:00
|
|
|
chmod u=rwX,g=rX,o= -R /var/lib/pgadmin
|
2017-11-16 21:10:21 +01:00
|
|
|
}
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2024-01-30 15:32:09 +01:00
|
|
|
_install_pgadmin_venv() {
|
|
|
|
ynh_exec_as "$app" python3 -m venv --upgrade "$install_dir/venv"
|
|
|
|
venvpy="$install_dir/venv/bin/python3"
|
|
|
|
|
|
|
|
ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir pip wheel
|
|
|
|
ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir --ignore-installed "psycopg[c]"
|
|
|
|
|
2024-01-30 15:36:17 +01:00
|
|
|
cp "$YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt" "$install_dir/requirements.txt"
|
|
|
|
ynh_exec_as "$app" "$venvpy" -m pip install --upgrade -r "$install_dir/requirements.txt"
|
2024-01-30 15:32:09 +01:00
|
|
|
}
|