Open rithin opened 7 months ago
Hey, @rithin, I'll take a look and get back to you as soon as possible!
Ok, found the issue. It's this bug: #117 which was fixed in #118.
All you need to do is add this part: application.include_router(router)
in the if isinstance(settings, EnvironmentSettings):
condition in app/core/setup.py
if isinstance(settings, EnvironmentSettings):
if settings.ENVIRONMENT != EnvironmentOption.PRODUCTION:
docs_router = APIRouter()
if settings.ENVIRONMENT != EnvironmentOption.LOCAL:
docs_router = APIRouter(dependencies=[Depends(get_current_superuser)])
...
...
application.include_router(docs_router)
# --------------- adding this line fixes the bug ---------------
application.include_router(router)
Tell me if it works for you.
@igorbenav Thanks for the quick reply. That was the issue and it's resolved.
logs-create_tier
asyncio.exceptions.CancelledError
2024-02-21 07:51:19
2024-02-21 07:51:19 The above exception was the direct cause of the following exception:
2024-02-21 07:51:19
2024-02-21 07:51:19 Traceback (most recent call last):
2024-02-21 07:51:19 File "
create_superuser no logs but container is starting and exiting. is that the expected behaviour?
Weird. There are actually no logs indeed, but the tier should be created. I'm running it here and it's creating. Can you please share your docker-compose, Dockerfile and the relevant parts of your .env?
@igorbenav you can find it here -> https://github.com/rithin/kappitrails_api/tree/development_v1
I think you forgot to uncomment this part in docker-compose:
# # #-------- uncomment to create first tier --------
# create_tier:
# build:
# context: .
# dockerfile: Dockerfile
# env_file:
# - ./src/.env
# depends_on:
# - db
# - web
# command: python -m src.scripts.create_first_tier
# volumes:
# - ./src:/code/src
If you want logging, the latest update I merged adds it to the scripts. Just replace the old scripts with the new ones
@igorbenav sorry i didn't push the latest code to git. I enabled and the container got created. But its keep exiting Now i have pushed the code -> https://github.com/rithin/kappitrails_api/tree/development_v1
Weird. Can you please replace the script with the new one and try again so we can see the logs? Run a docker compose build --no-cache
, then docker compose up
Same, it's started and exited. Logs 2024-02-22 16:57:19 ERROR:main:Error creating tier:
I can't reproduce the error, so it might be something with your network setup. Something I see that you can fix is this:
# app/core/setup.py
def create_application(
router: APIRouter,
settings: (
DatabaseSettings
| RedisCacheSettings
| AppSettings
| ClientSideCacheSettings
| RedisQueueSettings
| RedisRateLimiterSettings
| EnvironmentSettings
),
create_tables_on_start: bool = True,
**kwargs: Any,
) -> FastAPI:
...
application = FastAPI(lifespan=lifespan, **kwargs)
# --------- add the following line here ---------
application.include_router(router)
This was fixed in #118
Edit: we went through this already, sorry
Yeah, when I remove the networks
part in docker-compose it works:
kappitrails_api-development_v1-create_tier-1 | INFO:__main__:Tier 'free' created successfully.
kappitrails_api-development_v1-create_tier-1 exited with code 0
So there's something wrong with your docker-compose networks settings, when you let docker do it automatically it works. Not actually a boilerplate issue, but I'll leave it open for now to see if you can fix, then maybe convert into a discussion.
@igorbenav , thanks for reply. When I remove the network setting from docker compose am get another error.
version: '3.8' services: db: image: postgres:13 env_file:
"8000:8000"
depends_on:
./src/.env:/code/.env
worker: build: context: . dockerfile: Dockerfile command: arq app.core.worker.settings.WorkerSettings env_file:
./src/.env:/code/.env
redis: image: redis:alpine volumes:
"6379"
pgadmin: container_name: pgadmin4 image: dpage/pgadmin4:latest restart: always ports:
db
create_superuser: build: context: . dockerfile: Dockerfile env_file:
./src:/code/src
create_tier: build: context: . dockerfile: Dockerfile env_file:
volumes: postgres-data: redis-data: pgadmin-data:
@rithin were you able to fix this? Sorry, I missed the last reply
@igorbenav no, still create_superuser-1 and create_tier-1 not running and trhowing error.
2024-03-10 16:53:05 ERROR:main:Error creating tier: 2024-03-17 17:13:46 ERROR:main:Error creating tier:
create_superuser I guess it is a valid error, there is one user called "rithin" already there as a superuser. But surprisingly it's starting and exiting.
API's giving 404. I build using docker-compose
My latest code can see here-> https://github.com/rithin/kappitrails_api/tree/development_v1
Description only apis are working if i wrote in the main.py but what in api/v1/users.py or any other
Screenshots
Additional context Add any other context about the problem here.