From b5bdf95c11bda8b8a9bb53fa6fa1347fee44091a Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 20 Dec 2023 11:16:28 +0100 Subject: [PATCH 1/6] Development: use `wrangler` locally (Docker container) Start a new `wrangler` Docker container for the development worker/server process that executes the JS file. Related https://github.com/readthedocs/addons/issues/217 --- dockerfiles/docker-compose.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml index 8c11f62..fa762e4 100644 --- a/dockerfiles/docker-compose.yml +++ b/dockerfiles/docker-compose.yml @@ -22,6 +22,9 @@ services: - web - proxito - storage + - wrangler + networks: + readthedocs: volumes: - ${PWD}/dockerfiles/nginx:/etc/nginx/templates # Disable logs for NGINX by default because they are too noisy and we have @@ -29,6 +32,26 @@ services: logging: driver: "none" + wrangler: + build: + context: ${PWD} + dockerfile: ${PWD}/dockerfiles/Dockerfile.wrangler + volumes: + - ${PWD}/../readthedocs-ops/terraform/prod/cloudflare/workers/force-readthedocs-addons.js:/usr/src/app/docker/force-readthedocs-addons.js + networks: + readthedocs: + command: [ + "wrangler", + "dev", + "/usr/src/app/docker/force-readthedocs-addons.js", + "--name=force-addons", + "--latest", + "--log-level=info", + "--host=nginx:8080", + "--ip=0.0.0.0", + "--port=8000", + ] + proxito: volumes: - ${PWD}/common/dockerfiles/entrypoints/common.sh:/usr/src/app/docker/common.sh From 6b0d500256a9d9fc01655c839c0523f221e7b582 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 6 Feb 2024 13:17:52 +0100 Subject: [PATCH 2/6] Update wrangler host --- dockerfiles/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml index fa762e4..405d4ff 100644 --- a/dockerfiles/docker-compose.yml +++ b/dockerfiles/docker-compose.yml @@ -47,7 +47,7 @@ services: "--name=force-addons", "--latest", "--log-level=info", - "--host=nginx:8080", + "--host=wrangler:8080", "--ip=0.0.0.0", "--port=8000", ] From 997711f70d77535b14f0f23a001554c9db48a472 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 6 Feb 2024 13:19:43 +0100 Subject: [PATCH 3/6] Use `proxito` as server_name --- dockerfiles/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml index 405d4ff..c638422 100644 --- a/dockerfiles/docker-compose.yml +++ b/dockerfiles/docker-compose.yml @@ -47,7 +47,7 @@ services: "--name=force-addons", "--latest", "--log-level=info", - "--host=wrangler:8080", + "--host=proxito:8080", "--ip=0.0.0.0", "--port=8000", ] From 45da1922af2df4f768db4636d807adc4b48d7dcb Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 6 Feb 2024 13:38:29 +0100 Subject: [PATCH 4/6] Minor updates --- dockerfiles/docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml index c638422..0751be3 100644 --- a/dockerfiles/docker-compose.yml +++ b/dockerfiles/docker-compose.yml @@ -37,7 +37,7 @@ services: context: ${PWD} dockerfile: ${PWD}/dockerfiles/Dockerfile.wrangler volumes: - - ${PWD}/../readthedocs-ops/terraform/prod/cloudflare/workers/force-readthedocs-addons.js:/usr/src/app/docker/force-readthedocs-addons.js + - ${PWD}/dockerfiles/force-readthedocs-addons.js:/usr/src/app/docker/force-readthedocs-addons.js networks: readthedocs: command: [ @@ -46,8 +46,8 @@ services: "/usr/src/app/docker/force-readthedocs-addons.js", "--name=force-addons", "--latest", - "--log-level=info", - "--host=proxito:8080", + "--log-level=error", + "--host=nginx:8080", "--ip=0.0.0.0", "--port=8000", ] From 7065507e62699d698bb6ca195009053ffc917380 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 6 Feb 2024 13:41:42 +0100 Subject: [PATCH 5/6] Define the Addons version via environment variable --- dockerfiles/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml index 0751be3..b852937 100644 --- a/dockerfiles/docker-compose.yml +++ b/dockerfiles/docker-compose.yml @@ -25,6 +25,8 @@ services: - wrangler networks: readthedocs: + environment: + - NGINX_ADDONS_GITHUB_TAG=0.9.5 volumes: - ${PWD}/dockerfiles/nginx:/etc/nginx/templates # Disable logs for NGINX by default because they are too noisy and we have From ddcbb80be0550c8024d9c710e8dd65ef10cb70f6 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 13 Feb 2024 11:18:24 +0100 Subject: [PATCH 6/6] Add a small comment about on the `--host` parameter --- dockerfiles/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml index b852937..40a415b 100644 --- a/dockerfiles/docker-compose.yml +++ b/dockerfiles/docker-compose.yml @@ -49,7 +49,7 @@ services: "--name=force-addons", "--latest", "--log-level=error", - "--host=nginx:8080", + "--host=nginx:8080", # El Proxito on NGINX configuration "--ip=0.0.0.0", "--port=8000", ]