s3rius / FastAPI-template

Feature rich robust FastAPI template.
MIT License
1.83k stars 161 forks source link

Can't seem to get alembic working #133

Closed elie-h closed 1 year ago

elie-h commented 1 year ago

Hi great template

I'm trying this out locally with Postgres + alembic.

I've added these environment variables:

MDS_RELOAD=True
MDS_DB_PORT=5432
MDS_DB_HOST=localhost
MDS_DB_PASS=mds
MDS_POSTGRES_PASSWORD=mds
MDS_POSTGRES_USER=mds
MDS_POSTGRES_DB=mds

Started the environment with docker compose:

docker-compose -f deploy/docker-compose.yml -f deploy/docker-compose.dev.yml --project-directory . up

When I try to run the migrations alembic revision --autogenerate I get an auth error:

asyncpg.exceptions.InvalidPasswordError: password authentication failed for user "mds"

Haven't changed any values in the env, mds should be the right password for the local setup. Any ideas?

s3rius commented 1 year ago

@eh-93 Hi and thanks for creating the issue.

What configuration did you use?

elie-h commented 1 year ago

For creating the project? REST+ Sqalchemy + Postgres

s3rius commented 1 year ago

@eh-93 Ok. I'll try to find out what happened tomorrow.

elie-h commented 1 year ago

Was just a case of exposing the port for the db in the docker-compose file. I was getting a password error because it was trying to connect to another instance of postgres running locally.

But I think it would be a good addition to the template otherwise you can't develop (and auto generate migrations) against your db locally.

s3rius commented 1 year ago

@eh-93 I'm glad you found out.

About exposing ports, I think, it seems like a good Idea. Can you provide more details about how you want it to be implemented?