simonw / datasette-publish-fly

Datasette plugin for publishing data using Fly
Apache License 2.0
20 stars 7 forks source link

Document usage with datasette-scale-to-zero #30

Open simonw opened 10 months ago

simonw commented 10 months ago

Following #29 I decided to try this:

datasette publish fly \
   fixtures.db \
   --app datasette-publish-fly-issue-29 \
   --install datasette-auth-passwords \
   --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$480000$9ce99372d1fa079f770d4e2245bcf335$zJjskTDc6M8sxmEUYZBr/EC0e730Q9pzcF8RJB43c/c=' \
   --install datasette-scale-to-zero \
   --plugin-secret datasette-scale-to-zero duration 5m

Using https://datasette.io/plugins/datasette-scale-to-zero ... and it worked!

I watched the Fly Dashboard and the app at https://datasette-publish-fly-issue-29.fly.dev/ now successfully scales to zero if it receives no hits for 5 minutes, then starts running again when traffic arrives:

Here's it exiting 5m after the last request:

CleanShot 2023-08-21 at 12 14 55@2x

And here's it rebooting when a new request comes in:

CleanShot 2023-08-21 at 12 16 59@2x
simonw commented 10 months ago

I'm inclined to add this as a feature - maybe datasette publish fly ... --scale-to-zero 5m.

Or --sleep-after 5m perhaps?

simonw commented 10 months ago

As observed here:

Fly also call this "wake on request".