Staging and Dev environments with PocketBase? #4004
Replies: 3 comments
-
There is no builtin mechanism at the moment to manage different environments. I personally just deploy the resulting binary (it contains both my custom Go code and migrations) with rsync to the designated environments and restart their PocketBase process. Any new schema change will be automatically applied via the migrations on If you use the prebuilt executable and have custom JS hooks code or migrations, then you'll have to ship also the |
Beta Was this translation helpful? Give feedback.
-
My process here is very similar to Gani's - build PB with custom go code, and remote deploy with Docker Compose (via Most of the differences in dev / staging / prod boil down to env variables which are used within my Pocketbase app and Docker. When first provisioning an instance, I do need a bit of manual configuration to set up credentials in Pocketbase but after that it's smooth sailing. This could probably be automated further with migrations, eg to quickly stand up new environments for CI, but I haven't had a need to do that yet. One thing I do is use Cloudflare Tunnels in front of Pocketbase, both in dev and prod. This gives me a couple things:
Here is the entirety of the Makefile that I use to manage my app (otpguard) across multiple environments: [nix-shell:~/otpguard/otpguard]$ cat Makefile
ENV ?= dev.env
include ${ENV}
all: otpguard
otpguard: main.go base64urlblob.go
go build
run: otpguard
@export $(shell grep -v '^#' "${ENV}" | xargs -d '\n') && go run . serve --http=localhost:7001
test: base64urlblob_test.go
go test
sync-migrations:
export $(shell grep -v '^#' "${ENV}" | xargs -d '\n') && go run main.go migrate collections
tunnel:
TUNNEL_TOKEN=${TUNNEL_TOKEN} cloudflared --no-autoupdate tunnel run
build-docker:
DOCKER_BUILDKIT=1 DOCKER_HOST=ssh://${BUILD_HOST} docker build --progress plain -t otpguard -f otpguard.Dockerfile .
deploy:
DOCKER_HOST=ssh://${DEPLOY_HOST} docker compose -f compose.yml up --build -d |
Beta Was this translation helpful? Give feedback.
-
Here's my boilerplate https://github.com/jonshipman/sveltekit-pb-boilerplate I believe you can only go pipeline deploys, e.g. Dev => Staging => Production otherwise the migrations might get out of wack. Though a good solution would be a github action to squash migrations when they move from dev -> qa. Locally I work with the binary on disk. Production will be in a docker container on host. |
Beta Was this translation helpful? Give feedback.
-
Curious how everyone else works with PB when it comes to Dev/Staging environments. What are your solutions?
Beta Was this translation helpful? Give feedback.
All reactions