igorbenav / FastAPI-boilerplate

An extendable async API using FastAPI, Pydantic V2, SQLAlchemy 2.0, PostgreSQL and Redis.
MIT License
589 stars 69 forks source link

nginx failed #113

Closed saakethtypes closed 7 months ago

saakethtypes commented 8 months ago

docker compose up

fastapi-boilerplate-db-1 | 2024-02-06 05:51:59.250 UTC [27] LOG: database system was shut down at 2024-02-06 05:51:57 UTC fastapi-boilerplate-db-1 | 2024-02-06 05:51:59.260 UTC [1] LOG: database system is ready to accept connections fastapi-boilerplate-web-1 | /bin/sh: 1: fastapi-boilerplate-web-1 | [gunicorn,: not found

igorbenav commented 8 months ago

Hey, @saakethtypes, can you please share the Dockerfile and docker-compose?

saakethtypes commented 8 months ago

https://gist.github.com/igorbenav/232c3b73339d6ca74e2bf179a5ef48a1#file-docker-compose-yml - along with other files mentioned in gist i also tried changing command: arq app.worker.WorkerSettings to command: arq app.core.worker.settings.WorkerSettings also the web-1 app is not able to connect to redis host . it keeps retrying.

igorbenav commented 8 months ago

@saakethtypes the project structured changed and I forgot to update the gists, sorry about that. Fixed the gists, tested here and it's working now. Please replace the old docker-compose with the fixed one and tell me if it's working properly.

saakethtypes commented 8 months ago
redis-1   | 1:M 06 Feb 2024 17:55:54.205 * DB loaded from disk: 0.004 seconds

redis-1   | 1:M 06 Feb 2024 17:55:54.205 * Ready to accept connections tcp

db-1      | 2024-02-06 17:55:54.198 UTC [1] LOG:  starting PostgreSQL 13.13 (Debian 13.13-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit

db-1      | 2024-02-06 17:55:54.199 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432

db-1      | 2024-02-06 17:55:54.199 UTC [1] LOG:  listening on IPv6 address "::", port 5432

db-1      | 2024-02-06 17:55:54.216 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"

db-1      | 2024-02-06 17:55:54.233 UTC [26] LOG:  database system was shut down at 2024-02-06 07:40:25 UTC

db-1      | 2024-02-06 17:55:54.253 UTC [1] LOG:  database system is ready to accept connections

web-1     | /bin/sh: 1: [gunicorn,: not found

web-1 exited with code 127

nginx-1   | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration

nginx-1   | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/

nginx-1   | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh

nginx-1   | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf

nginx-1   | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version

nginx-1   | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh

nginx-1   | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh

nginx-1   | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh

nginx-1   | /docker-entrypoint.sh: Configuration complete; ready for start up

nginx-1   | 2024/02/06 17:55:55 [emerg] 1#1: invalid port in upstream "web:port" in /etc/nginx/conf.d/default.conf:3

nginx-1   | nginx: [emerg] invalid port in upstream "web:port" in /etc/nginx/conf.d/default.conf:3

nginx-1 exited with code 1

worker-1  | 17:55:56: redis connection error redis:6379 TimeoutError Timeout connecting to server, 5 retries remaining...

worker-1  | 2024-02-06 17:55:56,421 - arq.connections - WARNING - redis connection error redis:6379 TimeoutError Timeout 
connecting to server, 5 retries remaining...

worker-1  | 17:55:58: redis connection error redis:6379 TimeoutError Timeout connecting to server, 4 retries remaining...

worker-1  | 2024-02-06 17:55:58,424 - arq.connections - WARNING - redis connection error redis:6379 TimeoutError Timeout connecting to server, 4 retries remaining...

worker-1  | 17:56:00: redis connection error redis:6379 TimeoutError Timeout connecting to server, 3 retries remaining...

worker-1  | 2024-02-06 17:56:00,427 - arq.connections - WARNING - redis connection error redis:6379 TimeoutError Timeout connecting to server, 3 retries remaining...

worker-1  | 17:56:02: redis connection error redis:6379 TimeoutError Timeout connecting to server, 2 retries remaining...

`worker-1  | 2024-02-06 17:56:02,431 - arq.connections - WARNING - redis connection error redis:6379 TimeoutError Timeout connecting to server, 2 retries remaining...`

worker-1  | 17:56:04: redis connection error redis:6379 TimeoutError Timeout connecting to server, 1 retries remaining...

getting this with new .env and other files

igorbenav commented 8 months ago

That's weird. Just cloned it from scratch with the new files here and it's working just fine. Try doing this:

1. Rebuilding

2. Doing from scratch

If it still doesn't work, share the code with me (if it's possible) and I'll take a look at it to see what might be wrong. Maybe there's a setup I'm missing or something.

From the error messages I see a few possibilities:

@saakethtypes please send me an update if you are able to fix it!

igorbenav commented 8 months ago

If you had to use fastapi-boilerplate-web-1, go to your .env and change POSTGRES_SERVER="db" to POSTGRES_SERVER="fastapi-boilerplate-db-1". Do the same for redis host name vars, fastapi-boilerplate-redis-1. @saakethtypes

igorbenav commented 8 months ago

Can you run it locally? Does it work locally?

saakethtypes commented 8 months ago

Yes, Its up now ! thank you