graphprotocol / block-oracle

MIT License
5 stars 11 forks source link

Refactor docker compose #166

Closed tilacog closed 1 year ago

tilacog commented 1 year ago

For automatic volume disposal, we need to either invoke docker compose up with the --renew-anon-volumes flag:

-V, --renew-anon-volumes    Recreate anonymous volumes instead of retrieving data from the previous containers.

Or invoke 'docker compose downwith the--volumes` flag:

-v, --volumes volumes    Remove named volumes declared in the volumes section of the Compose file and anonymous
                         volumes attached to containers.
neysofu commented 1 year ago

Is there a way to force data deletion without asking users to provide that flag? I feel like it's too easy to forget, and then waste time figuring out why docker compose up is not working...

tilacog commented 1 year ago

I don't think there is a native way to cleanup volumes on docker compose (other than the two methods disclosed above), but we could wrap the postgres invocation in a startup/entrypoint script that calls dropdb before the service starts.

tilacog commented 1 year ago

Found a way to always remove the database before starting postgres in 3956c49.