From c31bb72067d5192cbf8fb4ec523ee90ec32693d1 Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Wed, 24 Feb 2021 12:05:46 +0100 Subject: Add snekbox to the environment --- docker-compose.yml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docker-compose.yml') diff --git a/docker-compose.yml b/docker-compose.yml index d44b4e0..fd2eee4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,13 @@ services: MONGO_INITDB_ROOT_PASSWORD: forms-backend MONGO_INITDB_DATABASE: pydis_forms + snekbox: + image: ghcr.io/python-discord/snekbox:latest + ipc: none + ports: + - "127.0.0.1:8060:8060" + privileged: true + backend: build: context: . @@ -19,6 +26,7 @@ services: - "127.0.0.1:8000:8000" depends_on: - mongo + - snekbox tty: true volumes: - .:/app:ro -- cgit v1.2.3 From 3b20acf3d422f99f1cd36400aafc06fc73e1c5d9 Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Thu, 25 Feb 2021 14:48:37 +0100 Subject: Document the SNEKBOX_URL env var --- README.md | 2 ++ docker-compose.yml | 1 + 2 files changed, 3 insertions(+) (limited to 'docker-compose.yml') diff --git a/README.md b/README.md index 3e38ef5..be0c8b9 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ To start working on forms-backend, you'll need few things: 2. Poetry 3. Docker and docker-compose (optional) 4. Running MongoDB instance (when not using Docker) +5. Running [Snekbox](https://git.pydis.com/snekbox) instance (when not using Docker, optional) ### Running with Docker The easiest way to run forms-backend is using Docker (and docker-compose). @@ -29,6 +30,7 @@ Create a `.env` file with the same contents as the Docker section above and the - `FRONTEND_URL`: Forms frontend URL. - `DATABASE_URL`: MongoDB instance URI, in format `mongodb://(username):(password)@(database IP or domain):(port)`. - `MONGO_DB`: MongoDB database name, defaults to `pydis_forms`. +- `SNEKBOX_URL`: Snekbox evaluation endpoint. #### Running Simply run: `$ uvicorn --reload --host 0.0.0.0 --debug backend:app`. diff --git a/docker-compose.yml b/docker-compose.yml index fd2eee4..4e58ef7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,7 @@ services: - .:/app:ro environment: - DATABASE_URL=mongodb://forms-backend:forms-backend@mongo:27017 + - SNEKBOX_URL=http://snekbox:8060/eval - OAUTH2_CLIENT_ID - OAUTH2_CLIENT_SECRET - ALLOWED_URL -- cgit v1.2.3 From c175279e4172160f0d119ddd93dce8a813fff69b Mon Sep 17 00:00:00 2001 From: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com> Date: Mon, 1 Mar 2021 16:51:25 +0300 Subject: Allows All CORS Requests On Development Signed-off-by: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com> --- backend/__init__.py | 4 ++-- docker-compose.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'docker-compose.yml') diff --git a/backend/__init__.py b/backend/__init__.py index d56edfb..5c91a65 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -16,8 +16,8 @@ ORIGINS = [ r"(https?://[^.?#]*.forms-frontend.pages.dev)", # Cloudflare Previews ] if not constants.PRODUCTION: - # Add localhost to allowed origins on non-production deployments - ORIGINS.append(r"(https?://localhost:\d{0,4})") + # Allow all hosts on non-production deployments + ORIGINS.append(r"(.*)") ALLOW_ORIGIN_REGEX = "|".join(ORIGINS) diff --git a/docker-compose.yml b/docker-compose.yml index 4e58ef7..8ee46be 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,3 +37,4 @@ services: - OAUTH2_CLIENT_SECRET - ALLOWED_URL - DEBUG=true + - PRODUCTION=false -- cgit v1.2.3