@@ -15,33 +15,51 @@ and ReactJS, HTML5 with CSS for the client side processing and UI.
1515Although developed using web technologies, pgAdmin 4 can be deployed either on
1616a web server using a browser, or standalone on a workstation. The runtime/
1717subdirectory 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+ (venv) $ cd $PGADMIN4_SRC
46+ (venv) $ make install-node
47+ (venv) $ 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
4361In 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
4563Python Virtual Environment is setup for this purpose, rather than using the
4664system Python environment. On Linux and Mac systems, the process is fairly
4765simple - adapt as required for your distribution:
@@ -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
144170At this point you will be able to run pgAdmin 4 from the command line in either
145171server 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.
148174Setup of an environment on Windows is somewhat more complicated unfortunately,
149175please 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
196179In 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
211194The 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
215213Most packages can be built using the Makefile in $PGADMIN4_SRC, provided all
0 commit comments