Combined with Google Cloud Build and Google Cloud Run, you can make GCloud build your Dockerfile for Pocketbase/PocketCMS and run it in a serverless environment, with replication / backup using Litestream to backup to a Google Cloud Storage bucket.
This repo was build from the following guides / repos:
- https://litestream.io/guides/gcs/
- https://github.com/steren/litestream-cloud-run-example/tree/main
- https://github.com/bscott/pocketbase-litestream
- fork this repo
- create a Google Cloud storage bucket (does not need to be publicly available)
- create a new Google Cloud Run service, set it to continuously deploy from a GitHub repository (the one you forked) using the
/Docerfile
- make sure the service is public, has an always allocated CPU, and has minimum (and maximum) CPUs set to 1
- the default port that Google Cloud Run listens on is
8090
, but pocketcms/pocketbase uses8090
, make sure to change the container port to8090
- in VARIABLES & SECRETS, set:
REPLICA_URL
togcs://YOUR_BUCKET_NAME/db
- once the service is set up it will automatically trigger a build. any time a new change is pushed to the repo the service will be built and re-deployed.