How Do You Get?

NZ Commuter E-bike buying advice

Here's a collection of some of basic advice for ebike buyers, particularly aimed at NZ commuters, particularly in Auckland.

Find a brand and store that you trust

Most bike shops will only service brands that they sell (and in some cases only if you bought from them), so my main advice is to buy from a shop that you trust.

Consider what you want to use it for

This guide …

Snippet: Litestream 0.3 to 0.5

Just a note that litestream 0.5 can't handle a 0.3 replica. If you're upgrading from 0.3 to 0.5, you need to restore back to a local sqlite file using 0.3, and then start a new replica on a different path with 0.5.

Also, if you're running litestream in Docker, make sure you're at least locking to an 0.X version, so you don't automatically upgrade to an incompatible version.

Snippet: Django in Cloud Run + Firebase Hosting

Some useful tips for running Django / Wagtail in Cloud Run and Firebase Hosting.

  1. This tutorial is a great resource: https://cloud.google.com/python/django/run
  2. Whitenoise gives a simple solution for static file serving from Django, and Firebase Hosting or CDN can provide caching.
  3. The following settings are needed:

# Cloudrun compatibility https://firebase.google.com/docs/hosting/manage-cache#using_cookies

# "Only the specially-named __session cookie is permitted to pass through to # the execution of your app."

SESSION_COOKIE_NAME = …

How this site works - SQLite + Cloudrun

This site is an experiment in running SQLite in production, with servers that auto-scale to zero.

The key point is to limit the site to a single instance, so any updates are going to one instance of the database.

Litestream is used to replicate the database to/from a storage bucket, providing backup, but also providing a mechanism to scale the app down to zero.

Benefits

  1. Cost: No need to have …