-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Litestream support for Phoenix applications (#4224)
* Litestream support for Phoenix applications If mix.exs contains "ecto_sqlite3", have fly launch default to creating a Tigris bucket. Unless overridden by the launch UI, 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. Also, configure the volume to start out at 1Gb, expand by an additional 1Gb each time it reaches 80%, up to a maximum of 10Gb. Tested with: ``` 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 Wait a minute or so, then run: fly deploy Your post should be present on the new machine/volume.
- Loading branch information
Showing
3 changed files
with
204 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters