TLDR Fork this repo to setup Google Cloud Build and setup environment variables.
This is a quick guide on how to deploy PocketBase to Cloud Run.
Follow the setup guide to get PocketBase setup on your local machine.
Create a new database and add some data.
Google Cloud Setup
First you need to setup a Google Cloud Project. You can use the free tier to get started.
Next you need to setup a Cloud Storage bucket. You can use the Cloud Console to create a bucket.
Follow the setup guide to get LiteStream setup on your local machine.
Backup the local database to bucket you created and save the
bucket url for later.
Save the LiteStream
password for later.
Cloud Run Setup
Fork this repo for use with Google Cloud Build.
Google Cloud Build
Create a new Cloud Run service and select the repo you forked under the Google Cloud Build section.
Choose the Dockerfile in the root of the repo.
Set the minimum instances to 1 and the maximum to 1.
You can also set CPU to always be allocated.
Setup the environment variables for the Cloud Run service:
LITESTREAM_ACCESS_KEY_ID=YOUR_LITESTREAM_USERNAME LITESTREAM_SECRET_ACCESS_KEY=YOUR_LITESTREAM_PASSWORD REPLICA_URL=YOUR_REPLICA_URL
After a successful build you should be able to access your PocketBase instance at the url provided by Cloud Run.
If you want to generate the dart classes for your database check out this repo.