litestream-ruby
litestream-ruby copied to clipboard
Using Litestream with no Procfile (such as a dockerized Kamal deploy)
If not using a Procfile, need a way to get the Litestream initalize directive into the startup.
On my Kamal deploy, I am currently running my Litestream initializer in my Docker Entry file (bin/docker-entrypoint) like such:
#docker-entrypoint
#!/bin/bash -e
# If running the rails server then create or migrate existing database
if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
./bin/rails db:prepare
litestream replicate -config /rails/config/litestream.yml &
fi
exec "${@}"
Note, I am installing Litestream and running it with a command in my Dockerfile
# Litestream
ADD https://github.com/benbjohnson/litestream/releases/download/v0.3.13/litestream-v0.3.13-linux-amd64.tar.gz /tmp/litestream.tar.gz
RUN tar -C /usr/local/bin -xzf /tmp/litestream.tar.gz