From 9cf4a649af7c16753b0fa3ccdcb91f131d829907 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Mon, 12 Jun 2023 17:40:30 -0400 Subject: [PATCH] chore(dev): fix internal static proxy + add /pgadmin to reverse-proxy --- .devcontainer/devcontainer.json | 6 +----- .devcontainer/docker-compose.extend.yml | 6 ------ docker-compose.yml | 2 +- docker/configs/nginx-502.html | 4 +++- docker/configs/nginx-proxy.conf | 9 ++++++++- docker/configs/settings_local.py | 2 +- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 422e77cf54..14a0d5ea90 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -67,7 +67,7 @@ }, // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": [3000, 5432, 5433, 8000], + "forwardPorts": [3000, 5432, 8000], "portsAttributes": { "3000": { @@ -78,10 +78,6 @@ "label": "PostgreSQL", "onAutoForward": "silent" }, - "5433": { - "label": "pgAdmin", - "onAutoForward": "silent" - }, "8000": { "label": "NGINX", "onAutoForward": "notify" diff --git a/.devcontainer/docker-compose.extend.yml b/.devcontainer/docker-compose.extend.yml index 1673e4e618..fa9a412cf2 100644 --- a/.devcontainer/docker-compose.extend.yml +++ b/.devcontainer/docker-compose.extend.yml @@ -15,11 +15,5 @@ services: # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. network_mode: service:db - pgadmin: - network_mode: service:db - - static: - network_mode: service:db - volumes: datatracker-vscode-ext: diff --git a/docker-compose.yml b/docker-compose.yml index f8f933527c..2889bce9b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,9 +53,9 @@ services: - PGADMIN_DEFAULT_EMAIL=dev@ietf.org - PGADMIN_DEFAULT_PASSWORD=dev - PGADMIN_CONFIG_LOGIN_BANNER="Login with dev@ietf.org / dev" - - PGADMIN_LISTEN_PORT=5433 - PGADMIN_DISABLE_POSTFIX=True - PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False + - SCRIPT_NAME=/pgadmin volumes: - ./docker/configs/pgadmin-servers.json:/pgadmin4/servers.json diff --git a/docker/configs/nginx-502.html b/docker/configs/nginx-502.html index 9d85600ecb..9e4374f3c0 100644 --- a/docker/configs/nginx-502.html +++ b/docker/configs/nginx-502.html @@ -23,7 +23,6 @@ background-color: #222; border-radius: 10px; padding: 10px 50px; - display: inline-block; } i { font-size: 64px; @@ -54,6 +53,9 @@

Could not connect to dev server.

Using VS Code, open the Run and Debug tab on the left and click the symbol (Run Server) to start the server.

Otherwise, run the command ietf/manage.py runserver 0.0.0.0:8001 from the terminal.

+
+

You can manage the database at /pgadmin.

+

For more information, check out the Datatracker Development in Docker guide.

diff --git a/docker/configs/nginx-proxy.conf b/docker/configs/nginx-proxy.conf index 02f5208caa..d5681fb239 100644 --- a/docker/configs/nginx-proxy.conf +++ b/docker/configs/nginx-proxy.conf @@ -8,7 +8,14 @@ server { server_name _; location /_static/ { - proxy_pass http://localhost:80/; + proxy_pass http://static/; + } + + location /pgadmin/ { + proxy_set_header X-Script-Name /pgadmin; + proxy_set_header Host $host; + proxy_pass http://pgadmin; + proxy_redirect off; } location / { diff --git a/docker/configs/settings_local.py b/docker/configs/settings_local.py index fc3052ff98..647fcd5b22 100644 --- a/docker/configs/settings_local.py +++ b/docker/configs/settings_local.py @@ -57,4 +57,4 @@ DE_GFM_BINARY = '/usr/local/bin/de-gfm' STATIC_IETF_ORG = "/_static" -STATIC_IETF_ORG_INTERNAL = "http://localhost:80" +STATIC_IETF_ORG_INTERNAL = "http://static"