jonra1993 / fastapi-alembic-sqlmodel-async

This is a project template which uses FastAPI, Pydantic 2.0, Alembic and async SQLModel as ORM. It shows a complete async CRUD using authentication and role base access control.
MIT License
879 stars 143 forks source link

How to manage sub-domains? #3

Closed mbnoimi closed 1 year ago

mbnoimi commented 1 year ago

I want to modify sub-domains names and paths but I couldn't know where this template configure them? Usually I put sub-domains confg files in /etc/nginx/conf.d/ but I didn't see which script control them for this template!

mbnoimi commented 1 year ago

For example I failed to modify location of ./static path from http://localhost/static/ to http://localhost/ because there are some labels in docker-compose.yml control the traefik and fastapi routs

jonra1993 commented 1 year ago

Hello, @mbnoimi this template uses traefik I plan to remove nginx in a future update. It was added to host static files but the reality is that it is not needed on the ingress.

Traefik uses routing using hostnames https://doc.traefik.io/traefik/routing/routers/ You can change the labels on the docker-compose file. I am going to add this info on the README file

image image
mbnoimi commented 1 year ago

this template uses traefik I plan to remove nginx in a future update.

I totally agree with you, BTW, does this template is production ready? If yes; May you please add deployment instructions in README.md?

You can change the labels on the docker-compose file. I am going to add this info on the README file

Thanks a lot

jonra1993 commented 1 year ago

Yes it is production ready on my team we have to use it as a base to deploy on AWS using ECS, EC2 and ELB with minor changes but command on fastapi container should be changed by

command: "sh -c 'alembic upgrade head && gunicorn -w 3 -k uvicorn.workers.UvicornWorker app.main:app --bind 0.0.0.0:8000 --timeout 600'"

And database is not a container instead a RDS instance

It is a good idea include it on README

mbnoimi commented 1 year ago

Thanks a lot