diff --git a/conf/nginx.conf b/conf/nginx.conf index 052fae5..94cf9b3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,6 +2,9 @@ location __PATH__ { include uwsgi_params; uwsgi_pass unix:///run/uwsgi/app/pgadmin/socket; + uwsgi_read_timeout 180; + uwsgi_send_timeout 180; + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; -} \ No newline at end of file +} diff --git a/conf/pgadmin.ini b/conf/pgadmin.ini index 32cb96c..1bf6997 100644 --- a/conf/pgadmin.ini +++ b/conf/pgadmin.ini @@ -12,7 +12,7 @@ chmod-socket = 666 # Plugin to use and interpretor config single-interpreter = true master = true -plugin = python +plugin = python3 # Manage the subpath manage-script-name = true @@ -21,7 +21,7 @@ mount = __PATH__=pgAdmin4.py # Virtualenv and python path virtualenv = __FINALPATH__ pythonpath = __FINALPATH__ -chdir = __FINALPATH__/lib/python2.7/site-packages/pgadmin4 +chdir = __FINALPATH__/lib/python__PYTHON_VERSION__/site-packages/pgadmin4 # The variable holding flask application -callable = app \ No newline at end of file +callable = app diff --git a/manifest.json b/manifest.json index fd931fb..738cd9e 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,7 @@ "url": "https://www.pgadmin.org", "license": "PostgreSQL", "maintainer": { - "name": "Josué", + "name": "Josué Tille", "email": "josue@tille.ch" }, "requirements": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 8c016be..a0224c9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,6 +5,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=/opt/yunohost/$app pgadmin_user="pgadmin" +python_version="3.5" [[ -e "../settings/manifest.json" ]] || [[ -e "../manifest.json" ]] && \ APP_VERSION=$(ynh_app_upstream_version) @@ -16,7 +17,7 @@ app_sub_version=$(echo $APP_VERSION | cut -d'-' -f2) #================================================= install_dependance() { - ynh_install_app_dependencies python-pip build-essential python-dev python-virtualenv postgresql uwsgi uwsgi-plugin-python expect + ynh_install_app_dependencies python3-pip build-essential python3-dev python3-venv postgresql uwsgi uwsgi-plugin-python3 expect } psql_create_admin() { @@ -42,14 +43,14 @@ install_source() { fi else # Install virtualenv if it don't exist - test -e $final_path/bin || virtualenv -p python2.7 $final_path + test -e $final_path/bin/python3 || python3 -m venv $final_path # Install pgadmin in virtualenv PS1="" cp ../conf/virtualenv_activate $final_path/bin/activate source $final_path/bin/activate - pip install --upgrade pip - pip install --upgrade https://ftp.postgresql.org/pub/pgadmin/pgadmin$app_main_version/v$app_sub_version/pip/pgadmin${APP_VERSION}-py2.py3-none-any.whl + pip3 install --upgrade pip + pip3 install --upgrade https://ftp.postgresql.org/pub/pgadmin/pgadmin$app_main_version/v$app_sub_version/pip/pgadmin${APP_VERSION}-py2.py3-none-any.whl deactivate fi } @@ -63,9 +64,9 @@ set_permission() { } config_pgadmin() { - cp ../conf/config_local.py $final_path/lib/python2.7/site-packages/pgadmin4/config_local.py - ynh_replace_string __USER__ $pgadmin_user $final_path/lib/python2.7/site-packages/pgadmin4/config_local.py - ynh_replace_string __DOMAIN__ $domain $final_path/lib/python2.7/site-packages/pgadmin4/config_local.py + cp ../conf/config_local.py $final_path/lib/python$python_version/site-packages/pgadmin4/config_local.py + ynh_replace_string __USER__ $pgadmin_user $final_path/lib/python$python_version/site-packages/pgadmin4/config_local.py + ynh_replace_string __DOMAIN__ $domain $final_path/lib/python$python_version/site-packages/pgadmin4/config_local.py } config_uwsgi() { @@ -73,5 +74,6 @@ config_uwsgi() { ynh_replace_string __USER__ $pgadmin_user /etc/uwsgi/apps-enabled/pgadmin.ini ynh_replace_string __FINALPATH__ $final_path /etc/uwsgi/apps-enabled/pgadmin.ini ynh_replace_string __PATH__ $path_url /etc/uwsgi/apps-enabled/pgadmin.ini + ynh_replace_string __PYTHON_VERSION__ $python_version /etc/uwsgi/apps-enabled/pgadmin.ini } diff --git a/scripts/config_database.py b/scripts/config_database.py index 85e6837..7b60626 100644 --- a/scripts/config_database.py +++ b/scripts/config_database.py @@ -5,7 +5,7 @@ import sqlite3 import sys # Import crypto from pgadmin project -crypto = imp.load_source('crypt', '/opt/yunohost/pgadmin/lib/python2.7/site-packages/pgadmin4/pgadmin/utils/crypto.py') +crypto = imp.load_source('crypt', '/opt/yunohost/pgadmin/lib/python__PYTHON_VERSION__/site-packages/pgadmin4/pgadmin/utils/crypto.py') # Get arguments username = sys.argv[1] @@ -38,4 +38,4 @@ cursor.execute('''INSERT INTO `server`( conn.commit() # Close connection -conn.close() \ No newline at end of file +conn.close() diff --git a/scripts/install b/scripts/install index 67ca521..15e9e4a 100644 --- a/scripts/install +++ b/scripts/install @@ -82,14 +82,15 @@ chmod +x ../conf/setup.exp PS1="" source $final_path/bin/activate ynh_replace_special_string "__ADMIN_PASSWORD__" "$admin_pwd" "../conf/setup.exp" -../conf/setup.exp "$final_path/bin/python2.7" "$final_path/lib/python2.7/site-packages/pgadmin4/setup.py" "$email" +../conf/setup.exp "$final_path/bin/python3" "$final_path/lib/python$python_version/site-packages/pgadmin4/setup.py" "$email" # POPULATE THE DATABASE ynh_psql_test_if_first_run su --command="psql -c\"CREATE USER ${db_user} WITH PASSWORD '${db_pwd}' SUPERUSER CREATEDB CREATEROLE REPLICATION\"" postgres # Add Server In PGadmin database -$final_path/bin/python2.7 config_database.py "$db_user" "$db_pwd" +ynh_replace_string "__PYTHON_VERSION__" "$python_version" config_database.py +$final_path/bin/python3 config_database.py "$db_user" "$db_pwd" deactivate #=================================================