Coder.comC
Coder.com4y ago
3 replies
Max

Issues with external Postgres DB

When I run Coder with the internal DB, it works flawlessly. As soon as I try with an external Postgres database, I get 401 errors such as "the API key is invalid" and 404 errors such as "Resource not found or you do not have access to this resource". Template creation fails with logs: decode body: invalid character '<' looking for beginning of value.

version: "3.8"

networks:
  t2_external:
    external: true

services:
  coder:
    image: ghcr.io/coder/coder:latest
    
    command: chmod 666 /var/run/docker.sock

    networks:
      - t2_external

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

    environment:
      CODER_PG_CONNECTION_URL: "postgresql://coder-user:CoderTempPW!@10.34.12.1:5432/coder?sslmode=disable"
      CODER_ADDRESS: "0.0.0.0:7080"
      CODER_ACCESS_URL: "https://coder.mydomain.com"
      CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS: "true"
      CODER_OAUTH2_GITHUB_ALLOWED_ORGS: "my-org"
      CODER_OAUTH2_GITHUB_CLIENT_ID: "12345"
      CODER_OAUTH2_GITHUB_CLIENT_SECRET: "abcde"

    deploy:
      labels:
        - traefik.enable=true
        - traefik.docker.network=t2_external
        - traefik.http.routers.coder-rtr.entrypoints=https
        - traefik.http.routers.coder-rtr.rule=Host(`coder.mydomain.com`)
        - traefik.http.services.coder.loadbalancer.server.port=7080


The only difference between a working and non working implementation is the CODER_PG_CONNECTION_URL line.
Was this page helpful?