Download Linux PocketBase Installer https://pocketbase.io/docs/
Create PocketBase Dockerfile
FROM alpine:latest
ARG PB_VERSION=0.7.7
RUN apk add --no-cache \\
unzip \\
# this is needed only if you want to use scp to copy later your pb_data locally
openssh
# download and unzip PocketBase
ADD <https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip> /tmp/pb.zip
RUN unzip /tmp/pb.zip -d /pb/
EXPOSE 8080
# start PocketBase
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"]
Install Flyctl
Follow the installation instructions from https://fly.io/docs/hands-on/install-flyctl/.
Run flyctl auth signup
to create a Fly.io account (email or GitHub).
Run flyctl auth login
to login.
Launch
Run flyctl launch
(optionally you can specify --dockerfile
if you are running from different directory).
This will prompt you a couple questions like the name of your app, deployment region, etc.
Type n
for the last 2 questions asking for creating a Postgresql database and whether you want to deploy directly.
? Would you like to set up a Postgresql database now? No
? Would you like to deploy now? No
The launch command will create a fly.toml
configuration file in the working directory.
Create and mount 1GB Free Persistent Volume
Run flyctl volumes create pb_data --size=1 —region=ams
It will prompt you to select a region - preferably choose the same region as in 3).
Once finished, open fly.toml
and add somewhere at the root level the following mounts
config:
[mounts]
destination = "/pb/pb_data"
source = "pb_data"
Your final fly.toml
should look something like this:
# fly.toml file generated for pocketbase-test on 2022-09-18T12:44:18+03:00
app = "pocketbase-test"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[experimental]
allowed_public_ports = []
auto_rollback = true
[mounts]
destination = "/pb/pb_data"
source = "pb_data"
# optional if you want to change the PocketBase version
[build.args]
PB_VERSION="0.7.7"
[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
Deploy
Run flyctl deploy
and that's it!
To access your PocketBase dashboard navigate to https://YOUR_APP_NAME.fly.dev/_/
.
To deploy new configuration/image changes, just run flyctl deploy
again.
Original source : https://github.com/pocketbase/pocketbase/discussions/537