Starting with flyctl v0.3.82, fly launch
will now now offer to install a Tigris bucket whenever it detects an Phoenix application that makes use of ecto_sqlite3
. If that suggestion is accepted, fly launch
will modify the Dockerfile to install litestream, configure it for the sqlite3 database, and create a startup script which will restore databases from backups if they don’t exist, run migrations, and then launch litestream replicate with the phoenix application.
Additionally, the volume on which the sqlite3 database is places will be configured to start out at 1Gb, expand by an additional 1Gb each time it reaches 80%, up to a maximum of 10Gb. These parameters can be configured in your fly.toml
.
For example:
mix phx.new blogdemo --database=sqlite3
cd blogdemo
mix phx.gen.html Blog Post posts title:string body:text
sed -i.bak -e "/:home/a\\
resources \"/posts\", PostController" lib/blogdemo_web/router.ex
Visit /posts
, create a post then run:
fly machine list --json | jq -r ".[]|.id" | xargs fly machine destroy -f
fly volume list --json | jq -r ".[]|.id" | xargs fly volume destroy -y
(If you don’t have jq
, omit --json
and run the destroy commands directly. Or just brew install jq
/ apt-get install jq
)
Wait a minute or so, then run:
fly deploy
Your post should be present on the new machine/volume.