Any news about how to run prefect with a predefine...
# prefect-community
m
Any news about how to run prefect with a predefined postgres database? I have a client running on windows and it works pretty well except that all flow and logs disappear on restart due to the mount volume parameter doesn’t work on windows. This is a general docker on windows bug but if you can specify your own postgres db prefect would run fine.
j
Hi @Mikael - would you mind opening a ticket for this in Github. I don't think it's currently on our horizon but if you can open the issue, other can add their thoughts and it's easier for you and us to track it there.
Actually @Mikael - I'm told this may be possible by setting the host/port combo in the config. Have you tried that?
m
Thanks! I have not tried. Have not heard of it 😀. Do you have a link to docs?
j
Hi @Mikael - I think you've inspired us to write this into the docs. There's an example/standard config.toml in the prefect repo here. If you have a postgres instance set up elsewhere then providing a connection string like this through the config var:
Copy code
[server.database]
connection_url = ...
will override the default
I would really welcome you letting us know if it works for you and any feedback so we can make sure we update the docs correctly and help future users.
m
I will test and report back. Thanks!
j
That's great. Thank you!
m
This works great! I just changed the server.server.database.host to my local IP. It still starts the Postgres image but uses my.
j
Thank you for letting us know.
I'm adding a pr to update the docs for this. Feel free to add any other information you think might be helpful. https://github.com/PrefectHQ/prefect/pull/3411
👏 1
c
Hi @Jenny! thanks for the PR to the docs - i was wondering, if i change the config as specified, will docker-compose still spin up a container of a postgres db that is idle?
j
Great question - I'm going to need to check that and get back to you.
Hi @Charles Leung - yes it would still spin up an empty DB. The 
prefect server start
 command does not currently expose a way of disabling postgres in the docker compose. If you don't want to have that spun up, you could use the docker compose file directly and start it up without the CLI command and with postgres removed. For reference, the
prefect server start
code is here: https://github.com/PrefectHQ/prefect/blob/8f786f1e82a42aa818d4f9330dd152e448a39b8d/src/prefect/cli/server.py And the docker-compose.yml is here: https://github.com/PrefectHQ/prefect/blob/8f786f1e82a42aa818d4f9330dd152e448a39b8d/src/prefect/cli/docker-compose.yml
c
got it - thank you!
👍 1