https://dagster.io/ logo
#ask-community
Title
# ask-community
l

LaurentS

06/03/2022, 10:43 AM
Hi all! Question about database migrations (dagster's db and mine, both postgresql). I'm running everything in production on docker (swarm mode) and it's all happy, but I'm not sure how to manage database migrations (I use alembic for my own db, like dagster): I was running
alembic upgrade
manually, but I'm trying to do things a bit more cleanly. I tried setting the entrypoint of the dagster daemon container to something like
entrypoint: sh -c "alembic upgrade head && dagster-daemon run"
At first sight, it's fine, the migrations work, the daemon is alive, but it seems to have broken the dashboard in some weird ways (like the cool progress charts while a job is running are not updating anymore). What's the recommended way to run migrations?
d

daniel

06/03/2022, 1:14 PM
Hi - the recommended way to upgrade the dagster database is via the "dagster instance migrate" command. I don't necessarily recommend running that every time the daemon starts up though, since you should only need to do it when you upgrade and there has been a schema change. Are there any errors in the logs when the app isn't behaving the way you expect after doing a migration?
l

LaurentS

06/03/2022, 1:59 PM
OK, makes sense about the dagster migrations. What about the migrations I create, for my data?
I'm not seeing any obvious errors, but I'll dig a bit more
d

daniel

06/03/2022, 2:19 PM
I would need to know more about your setup to give recommendations for non-dagster databases, but we are generally pretty happy with alembic ("dagster instance migrate" uses alembic under the hood)
l

LaurentS

06/03/2022, 3:28 PM
Yeah, I'm using alembic already. I guess your answer implies there isn't any clear best practice then, I'll keep playing around. Thanks for your prompt reply, as always!