Skip to content

Commit 87822ef

Browse files
authored
Unix socket for the nginx and gunicorn communication (#3411)
* Unix socket for the nginx and gunicorn communication To avoid employing SSL certificates in NGINX and gunicorn we need to make them communicate over unix socket and not over TCP port. PBENCH-1139
1 parent 5feaef9 commit 87822ef

File tree

4 files changed

+3
-9
lines changed

4 files changed

+3
-9
lines changed

lib/pbench/cli/server/shell.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ def run_gunicorn(server_config: PbenchServerConfig, logger: Logger) -> int:
5353
if site.ENABLE_USER_SITE:
5454
find_the_unicorn(logger)
5555
try:
56-
host = server_config.get("pbench-server", "bind_host")
57-
port = str(server_config.get("pbench-server", "bind_port"))
5856
db_uri = server_config.get("database", "uri")
5957
db_wait_timeout = int(server_config.get("database", "wait_timeout"))
6058
es_uri = server_config.get("Indexing", "uri")
@@ -158,7 +156,7 @@ def run_gunicorn(server_config: PbenchServerConfig, logger: Logger) -> int:
158156
"--pid",
159157
"/run/pbench-server/gunicorn.pid",
160158
"--bind",
161-
f"{host}:{port}",
159+
"unix:/run/pbench-server/pbench-server.sock",
162160
"--log-syslog",
163161
"--log-syslog-prefix",
164162
"pbench-server",

lib/pbench/test/unit/server/test_shell_cli.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def run(args, cwd: Optional[str] = None) -> subprocess.CompletedProcess:
138138
"--pid",
139139
"/run/pbench-server/gunicorn.pid",
140140
"--bind",
141-
"0.0.0.0:8001",
141+
"unix:/run/pbench-server/pbench-server.sock",
142142
"--log-syslog",
143143
"--log-syslog-prefix",
144144
"pbench-server",
@@ -311,8 +311,6 @@ def get_server_config() -> PbenchServerConfig:
311311
@pytest.mark.parametrize(
312312
"option",
313313
[
314-
"bind_host",
315-
"bind_port",
316314
"uri",
317315
"wait_timeout",
318316
"workers",

server/lib/config/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ http {
105105
return 597;
106106
}
107107

108-
proxy_pass http://127.0.0.1:8001;
108+
proxy_pass http://unix:/run/pbench-server/pbench-server.sock;
109109
proxy_redirect off;
110110
proxy_connect_timeout 20s;
111111
proxy_read_timeout 120s;

server/lib/config/pbench-server-default.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ pbench-local-dir = %(pbench-top-dir)s
5353
pbench-tmp-dir = %(pbench-local-dir)s/tmp
5454

5555
# pbench-server rest api variables
56-
bind_host = 0.0.0.0
57-
bind_port = 8001
5856
rest_version = 1
5957
rest_uri = /api/v%(rest_version)s
6058

0 commit comments

Comments
 (0)