https://prefect.io logo
m

Mikael

09/29/2020, 2:13 PM
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

Jenny

09/29/2020, 2:56 PM
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

Mikael

09/29/2020, 4:00 PM
Thanks! I have not tried. Have not heard of it 😀. Do you have a link to docs?
j

Jenny

09/29/2020, 4:44 PM
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

Mikael

09/29/2020, 5:13 PM
I will test and report back. Thanks!
j

Jenny

09/29/2020, 5:15 PM
That's great. Thank you!
m

Mikael

09/30/2020, 8:13 AM
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

Jenny

09/30/2020, 12:09 PM
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

Charles Leung

10/07/2020, 5:26 PM
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

Jenny

10/07/2020, 5:28 PM
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

Charles Leung

10/07/2020, 7:04 PM
got it - thank you!
👍 1