How to deploy pocketbase

Pocketbase is a single file backend written in Go: Basics - Going to production - Docs - PocketBase
I am trying to deploy it on render.com, essentially, since it’s an embedded sqlite in the executable, we can just upload pocketbase as the executable (again sqlite is embedded in that file) then call
“pocketbase serve”, I put the pocketbase executable in render disk but 2 things are happening:

  1. the disk is not being persisted on deploys (could it be because it failed? that’s scary, I would have lost data)

  2. I have a feeling render disk is not available during deployment because it keeps complaining that pocketbase does not exist but i just went into the shell, wget the executable and ran it, and it worked.

My ideal state is to have in package.json’s scripts, something like:

"pocketbase-serve": "/var/lib/data/pocketbase serve --migrationsDir=path to my codebase folder"

which will by default run on port 8090
Please advise.

Hi,

I’ve not tried Pocketbase yet, but the data would need to be persisted on the Render Disk. When creating a disk, you specify a mouth path. This path (which is from the root of the file system) is where you would need to keep your data file(s).

Render instances have an ephemeral filesystem, meaning any file written to the instance after it has booted will be lost when it next restarts (e.g. spun down if on free instance type, next deploy, manual restart, etc.).

Disks are only available to the runtime container. They’re not accessible by the build container, as you found, which is mentioned in the docs

Any ports used are only for use on the internal/private network. A Web Service will only be accessible on port 443 (HTTPS default) for public requests.

Alan

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.