Skip to content

Commit 022507c

Browse files
authored
Merge branch 'pgadmin-org:master' into master
2 parents 702e4c2 + 9ce0e77 commit 022507c

678 files changed

Lines changed: 61373 additions & 41872 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/run-feature-tests-pg.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ jobs:
3232
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
3333
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
3434
35+
- name: Uninstall PostgreSQL if already present
36+
run: |
37+
if [ -n "$(ls /etc/postgresql/*/*/postgresql.conf 2>/dev/null)" ]; then
38+
# Extract the major version from pg_config
39+
installed_pg_version=$( pg_config --version | cut -d ' ' -f 2 | cut -d '.' -f 1 )
40+
echo "Installed PostgreSQL version: $installed_pg_version"
41+
if [ $installed_pg_version != ${{ matrix.pgver }} ]; then
42+
sudo pg_dropcluster $installed_pg_version main --stop
43+
sudo apt-get -y remove "postgresql-${installed_pg_version}"
44+
fi
45+
fi
46+
3547
- name: Install platform dependencies
3648
run: |
3749
sudo apt update
@@ -119,7 +131,7 @@ jobs:
119131
"comment": "PostgreSQL ${{ matrix.pgver }} Server",
120132
"db_username": "postgres",
121133
"host": "/var/run/postgresql",
122-
"db_password": "postgres",
134+
"db_password": "",
123135
"db_port": 59${{ matrix.pgver }},
124136
"maintenance_db": "postgres",
125137
"sslmode": "prefer",

.github/workflows/run-python-tests-epas.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
if: ${{ matrix.os == 'ubuntu-22.04' }}
4949
run: |
5050
sudo apt update
51-
sudo apt install -y libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev edb-as${{ matrix.pgver }}-server edb-as${{ matrix.pgver }}-server-pldebugger
51+
sudo apt install -y libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev edb-as${{ matrix.pgver }}-server edb-as${{ matrix.pgver }}-server-pldebugger edb-as${{ matrix.pgver }}-postgis34
5252
5353
- name: Install pgagent on Linux
5454
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.pgver <= 16 }}
@@ -105,6 +105,10 @@ jobs:
105105
- name: Create pgagent extension on Linux
106106
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.pgver <= 16 }}
107107
run: psql -U enterprisedb -d postgres -p 58${{ matrix.pgver }} -c 'CREATE EXTENSION IF NOT EXISTS pgagent;'
108+
109+
- name: Create postgis extension on Linux
110+
if: ${{ matrix.os == 'ubuntu-22.04' }}
111+
run: psql -U enterprisedb -d postgres -p 58${{ matrix.pgver }} -c 'CREATE EXTENSION IF NOT EXISTS postgis;'
108112

109113
- name: Install Python dependencies on Linux
110114
if: ${{ matrix.os == 'ubuntu-22.04' }}

.github/workflows/run-python-tests-pg.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,32 @@ jobs:
3434
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
3535
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
3636
37+
- name: Uninstall PostgreSQL if already present on linux
38+
if: ${{ matrix.os == 'ubuntu-22.04' }}
39+
run: |
40+
if [ -n "$(ls /etc/postgresql/*/*/postgresql.conf 2>/dev/null)" ]; then
41+
# Extract the major version from pg_config
42+
installed_pg_version=$( pg_config --version | cut -d ' ' -f 2 | cut -d '.' -f 1 )
43+
echo "Installed PostgreSQL version: $installed_pg_version"
44+
if [ $installed_pg_version != ${{ matrix.pgver }} ]; then
45+
sudo pg_dropcluster $installed_pg_version main --stop
46+
sudo apt-get -y remove "postgresql-${installed_pg_version}"
47+
fi
48+
fi
49+
3750
- name: Install platform dependencies on Linux
3851
if: ${{ matrix.os == 'ubuntu-22.04' }}
3952
run: |
4053
sudo apt update
41-
sudo apt install -y libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev postgresql-${{ matrix.pgver }} postgresql-${{ matrix.pgver }}-pldebugger pgagent
54+
sudo apt install -y libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev postgresql-${{ matrix.pgver }} postgresql-${{ matrix.pgver }}-pldebugger pgagent postgresql-${{ matrix.pgver }}-postgis-3
4255
4356
- name: Install platform dependencies on macOS
4457
if: ${{ matrix.os == 'macos-latest' }}
4558
run: |
4659
brew install postgresql@${{ matrix.pgver }}
4760
echo "/opt/homebrew/opt/postgresql@${{ matrix.pgver }}/bin" >> $GITHUB_PATH
4861
49-
- name: Uninstall PostgreSQL if already present
62+
- name: Uninstall PostgreSQL if already present on windows
5063
if: ${{ matrix.os == 'windows-latest' }}
5164
run: |
5265
if exist "C:\Program Files\PostgreSQL\{{ matrix.pgver }}\uninstall-postgresql.exe" (
@@ -100,6 +113,7 @@ jobs:
100113
101114
psql -U postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION pgagent;'
102115
psql -U postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION pldbgapi;'
116+
psql -U postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION postgis;'
103117
104118
- name: Start PostgreSQL on macOS
105119
if: ${{ matrix.os == 'macos-latest' }}

.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ RUN apk add --no-cache \
208208
libedit \
209209
libldap \
210210
libcap && \
211-
/venv/bin/python3 -m pip install --no-cache-dir gunicorn==22.0.0 && \
211+
/venv/bin/python3 -m pip install --no-cache-dir gunicorn==23.0.0 && \
212212
find / -type d -name '__pycache__' -exec rm -rf {} + && \
213213
useradd -r -u 5050 -g root -s /sbin/nologin pgadmin && \
214214
mkdir -p /run/pgadmin /var/lib/pgadmin && \
@@ -222,7 +222,7 @@ RUN apk add --no-cache \
222222
echo "pgadmin ALL = NOPASSWD: /usr/sbin/postfix start" > /etc/sudoers.d/postfix && \
223223
echo "pgadminr ALL = NOPASSWD: /usr/sbin/postfix start" >> /etc/sudoers.d/postfix
224224

225-
USER pgadmin
225+
USER 5050
226226

227227
# Finish up
228228
VOLUME /var/lib/pgadmin

Make.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ REM Main build sequence Ends
5252

5353
:SET_ENVIRONMENT
5454
ECHO Configuring the environment...
55-
IF "%PGADMIN_PYTHON_DIR%" == "" SET "PGADMIN_PYTHON_DIR=C:\Python312"
55+
IF "%PGADMIN_PYTHON_DIR%" == "" SET "PGADMIN_PYTHON_DIR=C:\Python313"
5656
IF "%PGADMIN_KRB5_DIR%" == "" SET "PGADMIN_KRB5_DIR=C:\Program Files\MIT\Kerberos"
5757
IF "%PGADMIN_POSTGRES_DIR%" == "" SET "PGADMIN_POSTGRES_DIR=C:\Program Files\PostgreSQL\17"
5858
IF "%PGADMIN_INNOTOOL_DIR%" == "" SET "PGADMIN_INNOTOOL_DIR=C:\Program Files (x86)\Inno Setup 6"
@@ -164,7 +164,7 @@ REM Main build sequence Ends
164164
CALL "%TMPDIR%\venv\Scripts\activate" || EXIT /B 1
165165

166166
ECHO Installing dependencies...
167-
CALL python -m pip install --upgrade pip || EXIT /B 1
167+
CALL python -m pip install --upgrade pip==24.2 || EXIT /B 1
168168
CALL pip install --only-binary=cryptography -r "%WD%\requirements.txt" || EXIT /B 1
169169

170170
CD %WD%

README.md

Lines changed: 90 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,51 @@ and ReactJS, HTML5 with CSS for the client side processing and UI.
1515
Although developed using web technologies, pgAdmin 4 can be deployed either on
1616
a web server using a browser, or standalone on a workstation. The runtime/
1717
subdirectory contains an Electron based runtime application intended to allow this,
18-
which will execute the Python server and display the UI.
18+
which will fork a Python server process and display the UI.
1919

20-
## Building the Runtime
21-
22-
To build the runtime, the following packages must be installed:
20+
## Prerequisites
21+
1. Install Node.js 20 and above (https://nodejs.org/en/download)
22+
2. yarn (https://yarnpkg.com/getting-started/install)
23+
3. Python 3.8 and above (https://www.python.org/downloads/)
24+
4. PostgreSQL server (https://www.postgresql.org/download)
2325

24-
* NodeJS 16+
25-
* Yarn
26+
Start by enabling Corepack, if it isn't already;
27+
this will add the yarn binary to your PATH:
28+
```bash
29+
corepack enable
30+
```
2631

27-
Change into the runtime directory, and run *yarn install*. This will install the
28-
dependencies required.
32+
# Building the Web Assets
2933

30-
In order to use the runtime in a development environment, you'll need to copy
31-
*dev_config.json.in* file to *dev_config.json*, and edit the paths to the Python
32-
executable and *pgAdmin.py* file, otherwise the runtime will use the default
33-
paths it would expect to find in the standard package for your platform.
34+
pgAdmin is dependent on a number of third party Javascript libraries. These,
35+
along with it's own Javascript code, CSS code and images must be
36+
compiled into a "bundle" which is transferred to the browser for execution
37+
and rendering. This is far more efficient than simply requesting each
38+
asset as it's needed by the client.
3439

35-
You can then execute the runtime by running something like:
40+
To create the bundle, you will need the 'yarn' package management tool to be
41+
installed. Then, you can run the following commands on a *nix system to
42+
download the required packages and build the bundle:
3643

3744
```bash
38-
yarn run start
45+
$ cd $PGADMIN4_SRC
46+
$ make install-node
47+
$ make bundle
48+
```
49+
50+
On Windows systems (where "make" is not available), the following commands
51+
can be used:
52+
53+
```
54+
C:\> cd $PGADMIN4_SRC\web
55+
C:\$PGADMIN4_SRC\web> yarn install
56+
C:\$PGADMIN4_SRC\web> yarn run bundle
3957
```
4058

4159
# Configuring the Python Environment
4260

4361
In order to run the Python code, a suitable runtime environment is required.
44-
Python version 3.7 and later are currently supported. It is recommended that a
62+
Python version 3.8 and later are currently supported. It is recommended that a
4563
Python Virtual Environment is setup for this purpose, rather than using the
4664
system Python environment. On Linux and Mac systems, the process is fairly
4765
simple - adapt as required for your distribution:
@@ -63,7 +81,7 @@ simple - adapt as required for your distribution:
6381
so update that to the latest:
6482

6583
```bash
66-
$ pip install --upgrade pip
84+
(venv) $ pip install --upgrade pip
6785
```
6886

6987
4. Ensure that a PostgreSQL installation's bin/ directory is in the path (so
@@ -88,36 +106,44 @@ simple - adapt as required for your distribution:
88106
configuration may look like:
89107

90108
```python
91-
from config import *
92-
93-
# Debug mode
94-
DEBUG = True
95-
96-
# App mode
97-
SERVER_MODE = True
98-
99-
# Enable the test module
100-
MODULE_BLACKLIST.remove('test')
101-
102-
# Log
103-
CONSOLE_LOG_LEVEL = DEBUG
104-
FILE_LOG_LEVEL = DEBUG
105-
106-
DEFAULT_SERVER = '127.0.0.1'
107-
108-
UPGRADE_CHECK_ENABLED = True
109-
110-
# Use a different config DB for each server mode.
111-
if SERVER_MODE == False:
112-
SQLITE_PATH = os.path.join(
113-
DATA_DIR,
114-
'pgadmin4-desktop.db'
115-
)
116-
else:
117-
SQLITE_PATH = os.path.join(
118-
DATA_DIR,
119-
'pgadmin4-server.db'
120-
)
109+
import os
110+
import logging
111+
112+
# Change pgAdmin data directory
113+
DATA_DIR = '/Users/myuser/.pgadmin_dev'
114+
115+
#Change pgAdmin server and port
116+
DEFAULT_SERVER = '127.0.0.1'
117+
DEFAULT_SERVER_PORT = 5051
118+
119+
# Switch between server and desktop mode
120+
SERVER_MODE = True
121+
122+
#Change pgAdmin config DB path in case external DB is used.
123+
CONFIG_DATABASE_URI="postgresql://postgres:postgres@localhost:5436/pgadmin"
124+
125+
#Setup SMTP
126+
MAIL_SERVER = 'smtp.gmail.com'
127+
MAIL_PORT = 465
128+
MAIL_USE_SSL = True
129+
MAIL_USERNAME = 'user@gmail.com'
130+
MAIL_PASSWORD = 'xxxxxxxxxx'
131+
132+
# Change log level
133+
CONSOLE_LOG_LEVEL = logging.INFO
134+
FILE_LOG_LEVEL = logging.INFO
135+
136+
# Use a different config DB for each server mode.
137+
if SERVER_MODE == False:
138+
SQLITE_PATH = os.path.join(
139+
DATA_DIR,
140+
'pgadmin4-desktop.db'
141+
)
142+
else:
143+
SQLITE_PATH = os.path.join(
144+
DATA_DIR,
145+
'pgadmin4-server.db'
146+
)
121147
```
122148

123149
This configuration allows easy switching between server and desktop modes
@@ -137,9 +163,9 @@ simple - adapt as required for your distribution:
137163
(venv) $ python3 $PGADMIN4_SRC/web/pgAdmin4.py
138164
```
139165

140-
Whilst it is possible to automatically run setup in desktop mode by running
141-
the runtime, that will not work in server mode as the runtime doesn't allow
142-
command line interaction with the setup program.
166+
Whilst it is possible to automatically run setup in desktop mode by running
167+
the runtime, that will not work in server mode as the runtime doesn't allow
168+
command line interaction with the setup program.
143169

144170
At this point you will be able to run pgAdmin 4 from the command line in either
145171
server or desktop mode, and access it from a web browser using the URL shown in
@@ -148,49 +174,6 @@ the terminal once pgAdmin has started up.
148174
Setup of an environment on Windows is somewhat more complicated unfortunately,
149175
please see *pkg/win32/README.txt* for complete details.
150176

151-
# Building the Web Assets
152-
153-
pgAdmin is dependent on a number of third party Javascript libraries. These,
154-
along with it's own Javascript code, SCSS/CSS code and images must be
155-
compiled into a "bundle" which is transferred to the browser for execution
156-
and rendering. This is far more efficient than simply requesting each
157-
asset as it's needed by the client.
158-
159-
To create the bundle, you will need the 'yarn' package management tool to be
160-
installed. Then, you can run the following commands on a *nix system to
161-
download the required packages and build the bundle:
162-
163-
```bash
164-
(venv) $ cd $PGADMIN4_SRC
165-
(venv) $ make install-node
166-
(venv) $ make bundle
167-
```
168-
169-
On Windows systems (where "make" is not available), the following commands
170-
can be used:
171-
172-
```
173-
C:\> cd $PGADMIN4_SRC\web
174-
C:\$PGADMIN4_SRC\web> yarn install
175-
C:\$PGADMIN4_SRC\web> yarn run bundle
176-
```
177-
178-
# Creating pgAdmin themes
179-
180-
To create a pgAdmin theme, you need to create a directory under
181-
*web/pgadmin/static/scss/resources*.
182-
Copy the sample file *_theme.variables.scss.sample* to the new directory and
183-
rename it to *_theme.variables.scss*. Change the desired hexadecimal values of
184-
the colors and bundle pgAdmin. You can also add a preview image in the theme
185-
directory with the name as *\<dir name>_preview.png*. It is recommended that the
186-
preview image should not be larger in size as it may take time to load on slow
187-
networks. Run the *yarn run bundle* and you're good to go. No other changes are
188-
required, pgAdmin bundle will read the directory and create other required
189-
entries to make them available in preferences.
190-
191-
The name of the theme is derived from the directory name. Underscores (_) and
192-
hyphens (-) will be replaced with spaces and the result will be camel cased.
193-
194177
# Building the documentation
195178

196179
In order to build the docs, an additional Python package is required in the
@@ -210,6 +193,21 @@ The docs can then be built using the Makefile in *$PGADMIN4_SRC*, e.g.
210193

211194
The output can be found in *$PGADMIN4_SRC/docs/en_US/_build/html/index.html*
212195

196+
## Building the Runtime
197+
Change into the runtime directory, and run *yarn install*. This will install the
198+
dependencies required.
199+
200+
In order to use the runtime in a development environment, you'll need to copy
201+
*dev_config.json.in* file to *dev_config.json*, and edit the paths to the Python
202+
executable and *pgAdmin.py* file, otherwise the runtime will use the default
203+
paths it would expect to find in the standard package for your platform.
204+
205+
You can then execute the runtime by running something like:
206+
207+
```bash
208+
yarn run start
209+
```
210+
213211
# Building packages
214212

215213
Most packages can be built using the Makefile in $PGADMIN4_SRC, provided all

0 commit comments

Comments
 (0)