Deploying to Production
PocketPages is easy to deploy. If you follow the recommended project structure, everything in /pb_*
can be deployed.
The two most popular ways to go live with PocketBase are to use pockethost.io or to self-host using Fly.io.
Recommended: Deploy to pockethost.io
pockethost.io is the premiere PocketBase hosting service trusted by over 10,000 developers and millions of end users.
In under 30 seconds, you can provision a free instance with unlimited (Fair Use) resources.
Once you have your instance URL (something.pockethost.io
), you can choose either manual or Github Actions deployment (or both).
Manual Deployment
Start by copying the PocketHost deployment utility script:
bunx pocketpages degit . --template=deploy-pockethost-manual
bun add -D @samkirkland/ftp-deploy dotenv env-vars
Once you have deploy.ts
and its dependencies installed, create an .env
file and edit to suit:
cp .env-deploy-pockethost .env
Finally, try a deployment:
bun ./deploy-pockethost.ts
Optional add support in package.json
:
"scripts": {
"deploy": "bun ./deploy.ts"
},
bun run deploy
Github Actions Deployment
You can also use a Github Actions configuration to deploy on every push.
bunx pocketpages degit . --template=deploy-pockethost-ga
You'll need to set a few Github secrets. Look in the YAML file for details.
Deploy to Fly.io
Warning: Self-hosting is an advanced setup. I know Fly pretty well and it still took me an hour.
bunx pocketpages degit . --template=deploy-fly-ga .
After this, you should see a Dockerfile
and fly.toml
.
Use fly launch
and fly deploy
to create a Fly app and deploy it.
For more information, see Host for Free on Fly.io