Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.8k
Cannot propagate alembic revision from container to file tree with docker watch#1370
-
First Check
Commit to Help
Example CodeDescriptionWith the new recommended Operating SystemLinux, Windows Operating System Detailswsl2 on w11 Python Version3.12.6 Additional ContextNo response |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 3 comments 8 replies
-
I am facing the same issue. As suggested byDocker documentation, sync only works one way: from host to container. With the current watch setup and not mounting the directory as a volume, generated alembic revision files are not synced back to the host. I tried adding back the volume mapping but it resulted in the following error: |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I have found a working workaround (should have thought of it when I made the original comment): Warning: This kinda breaks Change the backend volume to include the alembic folder: You could drill down more to only the versions folder. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
I'm having this same issue. When I added those backend volumes, my docker didn't build so I still wasn't able to get it to work - see error message below. Can we make this into an issue?
|
BetaWas this translation helpful?Give feedback.
All reactions
-
@josephna76 It's been a while since I did that but I believe adding only the alembic folder (and not the whole backend folder) is how I solved it when I encountered that issue. The drawback of this is that live reload of fastapi will not work. I am developing it locally in the meantime but yes, I would want this to be an issue as well. Looks like the maintainers are not actively looking at discussions anyway. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Try excluding the alembic folder from watch to fix the refresh |
BetaWas this translation helpful?Give feedback.
All reactions
👍 3
-
Great, thanks yohaoquan and meme8383! I tried your solutions and it seemed to work, but I went with the documented solution of using SQLModel directly without Alembic while this gets resolved. |
BetaWas this translation helpful?Give feedback.
All reactions
-
As@yohaoquan mentioned correctly I would suggest to update the documentation where the alembic revisions are still advised to be run in the container. Actually actions should be done from now on the host. As well adding packages should be done on the host (This actually is adjusted in the docs, thx@tiangolo :)). Again run the following actions on yourHOST not in the docker container.
I was in the lucky position to delete all my databases and start from scratch so I had no issues after doing it accidentally in the docker container. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 4
-
I created this small script to expose the vars in .env so that the settings instance can work even when running locally. then u can do |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I did the steps you mentioned but I am getting this error have you by any chance faced the same issue? I am sure of the credentials I checked them several times. Also the credentials work properly in the adminer login. |
BetaWas this translation helpful?Give feedback.
All reactions
-
best guess, you've missed to start the shell in the docker container? Your script tries to connect to a database on your local machine on port 5432, but as far as I get thedocker-compose.yml, the port 5432 is never exposed outside the docker stack. |
BetaWas this translation helpful?Give feedback.
All reactions
-
For anyone still having issues. Firstly, the issue seems to arise mostly among SELinux distros. Secondly,@yohaoquan above is nearly there with his solution, however there is the"z"flag missing as shown below: I wrote a comprehensive solutionhere that allows you to have your alembic files in your container showing in your local files whilst not breaking your compose watch feature as in the solution by@yohaoquan |
BetaWas this translation helpful?Give feedback.