You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+94-26Lines changed: 94 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,26 +5,30 @@ Serves as a proper server that Postgresql clients can connect to. Can modify pac
5
5
Currently used for rewriting queries to force proper use of postgres-hll module by external proprietary software that doesn't know about that functionality
6
6
7
7
## Installing
8
-
### Linux
9
-
1. Make sure you have [python3 and pip3 installed on your system](https://stackoverflow.com/questions/6587507/how-to-install-pip-with-python-3#6587528). It has been tested with Python3.6 but should also run on Python3.5.
4. Make a copy of [config.yml.example](config.yml.example) called `config.yml` and configure your proxy instances. Create the log directories if they're not there.
3. Copy the example config and edit it for your environment:
21
+
```bash
22
+
cp config.yml.example config.yml
23
+
```
20
24
21
25
## Configuring
22
26
In the `config.yml` file you can define the following things
23
27
### Plugins
24
28
A list of dynamically loaded modules that reside in the [plugins](plugins) directory. These plugins can be used in later configuration, to intercept queries, commands, or responses. View plugin documentation for example plugins for more details on how to do that.
25
29
### Settings
26
30
General application settings. Currently the following settings are used
27
-
*`log-level` - the log level for the general log. See [python logging](https://docs.python.org/3.6/library/logging.html) for more details about the logging functionality
31
+
*`log-level` - the log level for the general log. See [python logging](https://docs.python.org/3/library/logging.html) for more details about the logging functionality
28
32
*`general-log` - the location for the general log. All general messages go in there.
29
33
*`intercept-log` - the location for the intercept log. Intercepted messages and return values from various enabled plugins will be written there. This log can be quite verbose as it contains the full binary messages being circulated.
30
34
@@ -42,19 +46,22 @@ Make sure to manage the logs yourself, as they accumulate and take up disk space
42
46
43
47
Each interceptor definition must have a `plugin`, which should also be present in the [plugins](#Plugins) configuration, and a `function`, that is found directly in that module, that will be called each time with the intercepted message as a byte string, and a context variable that is an instance of the `Proxy` class, that contains connection information and other useful stuff.
44
48
45
-
## Running in testing mode
46
-
If you want to test it, do this. Otherwise scroll down for instructions on how to install it as a service
47
-
### Linux
48
-
1. Activate the virtual environment
49
-
```
50
-
source .venv/bin/activate
51
-
```
52
-
2. Run it
53
-
```
54
-
python proxy.py
55
-
```
56
-
57
-
### Changelog
49
+
## Running
50
+
51
+
Activate the virtualenv and run the proxy directly:
52
+
53
+
```bash
54
+
source .venv/bin/activate
55
+
python -m postgresql_proxy
56
+
```
57
+
58
+
Or run it without activating the venv:
59
+
60
+
```bash
61
+
.venv/bin/python -m postgresql_proxy
62
+
```
63
+
64
+
## Changelog
58
65
- v0.3.1
59
66
- Fix SSL COPY stalls by draining pending SSL buffer after recv [#11](https://github.com/localstack/postgresql-proxy/pull/11)
60
67
- Fix intermittent `BlockingIOError` on macOS during SSL negotiation
@@ -81,3 +88,64 @@ If you want to test it, do this. Otherwise scroll down for instructions on how t
81
88
- add stop() method to proxy; refactor logging
82
89
- v0.0.2
83
90
- fix socket file descriptors under Linux
91
+
92
+
## Testing
93
+
94
+
All tests require a real PostgreSQL server and are organized at the top level:
95
+
96
+
-`test_proxy.py`: proxy behavior tests (connection, SSL, hang regressions)
0 commit comments