Open kshitijrajsharma opened 2 years ago
I fail to run the project with the docker-compose, it seems it doesn't find my database whereas I found it in local
In fact, if I connect to the app docker, install postgresql-client, I get the error.
How should I configure app to have access to my database ?
For information, I run postgis with docker-compose which works well in develop branch. I added the postgis service in the depends_on section of app but it changed nothing.
postgis:
image: postgis/postgis:14-3.3
container_name: "postgis"
ports:
- "5439:5432"
environment:
- POSTGRES_DB=test
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=admin
restart: on-failure
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
I fail to run the project with the docker-compose, it seems it doesn't find my database whereas I found it in local
In fact, if I connect to the app docker, install postgresql-client, I get the error.
How should I configure app to have access to my database ?
For information, I run postgis with docker-compose which works well in develop branch. I added the postgis service in the depends_on section of app but it changed nothing.
postgis: image: postgis/postgis:14-3.3 container_name: "postgis" ports: - "5439:5432" environment: - POSTGRES_DB=test - POSTGRES_USER=postgres - POSTGRES_PASSWORD=admin restart: on-failure logging: driver: "json-file" options: max-size: "200k" max-file: "10"
Oh ! I think i know the problem , For me it works because I use ssh tunnel , But may not work for the postgres lying on local machine. Since docker container is requesting connection outside the network when we specify localhost : container reference to it's own locahost instead , Try replacing it with your device network ip address it should be able to connect ! ( I use ifconfig to know ip ) . Let me know if it works ! I will include this in docs as well
Update : Replacing my network ip with localhost worked for me with my local Postgres ! I found this article as well
Resolve #318
Resolve #336 Adds Docker for Easy installation with redis , celery and flower
Resolve #337 Setup tests with sample data and database so that future test integrations can use sample requests
Resolve #338 Updates docs with installation instruction
Resolve #336 Adds a build workflow to showcase successful build of API with celery and redis in ubuntu here
Resolve #339, Uses Slowapi for rate limiting , Accepts value from config for limiting and can be extended to other endpoints
This will also solve failing Github action issue of https://github.com/hotosm/galaxy-api/pull/326
Features :
Implementation details :
Test This PR :
Simply checkout this
feature/celery
branch and start from docs/GETTING_SARTED_WITH_DOCKER hereThis PR involves some major changes on documentation so I recommend going through docs will be very useful to test it
Once the API is up and running , post Sample request provided on rawdata endpoint It should give you your unique task id.
Follow the steps to track status
Meanwhile navigate to flower To see what worker is doing and job status / info
You can hit the /current-snapshot/ multiple times when you reach more than 5 request per min ,API will block the request and You should see too many requests error