GitHub - akoserwal/authzed-postgresql: U...
# spicedb
o
Hi team I understand its pretty common to run migrate in a separate docker container, i did sth like this repo https://github.com/akoserwal/authzed-postgresql however we have some internal infra constraint, I see the base image has entrypoint to spicedb. Given bash is not available, I wonder if there's way to do spicedb migarte and serve in the same dockerfile?
v
you can use the debug container, which does have a shell available: https://hub.docker.com/layers/authzed/spicedb/v1.28.0-debug/images/sha256-aa003d598441b4b668c6fe0b29bdca9ae205306e0d8ef7b67cd234e18f4bed6e?context=explore What are the infra constraints? How are you running SpiceDB, is this inside kubernetes?
Also please note that it's not as simple as "running migrate". Some migrations need orchestration. That's one of the many reasons we recommend using the SpiceDB operator when possible, because it knows how to apply migrations via an "update graph".
If you just run
migrate
and there is a multi-phase migration, you will have downtime
o
thanks for the reply! Yeah but i guess debug container is not suitable for production environment? infra constraints - we are likely only able to do it without kubernetes. currently im running a api container, spicedb as a sidecar, the problem with migration container is that it completes migration and shutdown, which cannot pass our internal health check
appreciate if any suggestions
v
There are various options that occur to me, one is that you create your own SpiceDB container with whatever works for you. Another option is to create your own SpiceDB binary that runs Migration as part of the startup process. You can basically take SpiceDB's
main.go
and add a call to the migration API.
o
first option, is this sth multistage dockerfile can do? I wonder if you have any examples, thanks!
v
You don't need to build your own stuff if in the end you are going to tinker with the execution of the container. You could play around with entrypoints and stuff as described in https://www.baeldung.com/linux/docker-cmd-multiple-commands, and create a shell script that first runs migrate and then SpiceDB. Then you'll need to make sure that OS signals that are sent to the shell process are also sent to their children, https://veithen.io/2014/11/16/sigterm-propagation.html describes a bit how to do this
but this really seems like an important limitation of whatever in house platform you are using. short lived processes are fairly common.
Colleague also pointed to https://github.com/Yelp/dumb-init
o
is migrate command no longer available via zed?
v
I don't think migrate was ever available in zed? That'd be news to me
o
v
that was my bad, corrected my comment