evidence-dev / docker-devenv

This repo builds a Docker image whose container instances can be used as a development environment for Evidence projects via a mounted directory
MIT License
13 stars 6 forks source link

403 forbidden when changing database #11

Open AmsellemJoseph opened 1 year ago

AmsellemJoseph commented 1 year ago

Hey, I'm facing for a new issue.

I deployed evidence with docker compose, and everything seems ok, but when I'm going to settings to change database, when I choose postgres or else, I put my credentials, when I save them, I got a 403 forbidden error, and on log from chrome I have this:

POST https://my-domain.com/api/settings.json 403 (Forbidden)

But when I'm clickin on thus url i get this:

{
    "settings": {
        "database": "duckdb",
        "credentials": {
            "filename": "needful_things.duckdb",
            "gitignoreDuckdb": null
        }
    },
    "gitIgnore": ".evidence/template\n.svelte-kit\nbuild\nnode_modules\n.DS_Store\n.vscode/settings.json\n"
}

here is my docker-compose file:

version: "3.3"
services:
  evidence:
    image: evidencedev/devenv:ubuntu
    command: "--init"
    restart: always
    environment:
      EVIDENCE_DATABASE: evidence
      EVIDENCE_POSTGRES_USER: postgres
      EVIDENCE_POSTGRES_HOST: postgres
      EVIDENCE_POSTGRES_DATABASE: evidence
      EVIDENCE_POSTGRES_PASSWORD: ${ADMIN_PASSWORD}
      EVIDENCE_POSTGRES_PORT: 5432
    volumes:
      - "./my-project:/evidence-workspace"
    ports:
      - "172.17.0.1:55558:3000"

  postgres:
    image: "elestio/postgres:15"
    container_name: postgres
    restart: always
    environment:
      - "POSTGRES_DB=evidence"
      - "POSTGRES_PASSWORD=${AP_POSTGRES_PASSWORD}"
      - "POSTGRES_USER=postgres"
      - "POSTGRES_HOST_AUTH_METHOD=trust"
    volumes:
      - "./postgres_data:/var/lib/postgresql/data"
    ports:
      - 172.17.0.1:42962:5432

  pgadmin4:
    image: dpage/pgadmin4:latest
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: ${ADMIN_EMAIL}
      PGADMIN_DEFAULT_PASSWORD: ${ADMIN_PASSWORD}
      PGADMIN_LISTEN_PORT: 8080
    ports:
      - "172.17.0.1:17371:8080"
    volumes:
      - ./servers.json:/pgadmin4/servers.json

Thx a lot for your work and for your responses 😊

mgmorcos commented 1 year ago

I get the 403 as well, with CORS error.

ud3sh commented 1 year ago

@AmsellemJoseph @mgmorcos it seems like the new Ubuntu image is more peculiar about CORS issues. Proper fix may involve something like this but particular to the image we are using

If you are looking to connect to an external DB that is not DuckDB/Mother Duck, replacing the evidencedev/devenv image with evidencedev/devenv-lite should do. I just tested this out with an external big query connection and it works

mgmorcos commented 1 year ago

Hi @ud3sh thank you for taking a look. This workaround did not resolve the issue for me, I still see 403's.

AmsellemJoseph commented 1 year ago

hey @ud3sh, thanks for your response, but I have the same issue with 403... I'm already use a reverse proxy NGINX, but event when adding

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';

I still have this issue. thx a lot for your job and your responses.