Closed bete7512 closed 1 year ago
@bete7512 it is docker networking issue, I used host.docker.internal
network to connect postgres running locally and that worked
Example Started postgres using docker:
docker run --name pg -e POSTGRES_PASSWORD=admin -p 5432:5432 -d postgres
Then started authorizer
docker run --name authorizer --network=host -p 8080:8080 lakhansamani/authorizer:latest ./build/server --database_type=postgres --database_url=postgresql://postgres:admin@host.docker.internal:5432/postgres
Another quick way to run this is using docker-compose.
version: '3.3'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: 'admin'
volumes:
- db:/var/lib/postgresql/data
authorizer:
image: lakhansamani/authorizer
restart: always
ports:
- '8080:8080'
depends_on:
- db
environment:
DATABASE_TYPE: "postgres"
DATABASE_URL: "postgres://postgres:admin@db/postgres"
volumes:
db:
driver: local
So, it's not a bug related to the authorizer but something to do with the docker setup. Thanks for sharing it
@lakhansamani can you add this docker-compose and a full example with Redis and all default ENV variables in the official documentation ! (We always prefer one-command solution :) )
Sure @yescine can add this to doc 👍
Docker Authorizer doesnot connecting with my local Postgres but it connects to container db sudo docker run -p 8081:8080 --env-file .env -d --restart unless-stopped --name authorizer lakhansamani/authorizer:1.1.46