Add self-hosted PocketBase stack with auto-migrations

- docker-compose.yml: app + pocketbase services (PB internal to the network)
- pocketbase/: pinned PocketBase image, superuser bootstrap via env vars
- pb_migrations: production schema (collections, rules, public_users view)
  applied automatically on first boot
- pocketbase/pb_schema.json: schema export kept as reference
- README: full-stack deployment docs
This commit is contained in:
2026-07-28 09:38:07 +02:00
parent c3c1f5e216
commit 3d712b8c57
6 changed files with 550 additions and 0 deletions
+23
View File
@@ -36,11 +36,34 @@ against different PocketBase instances. For local dev, copy `.env.example` to
## Docker
Single container (external PocketBase):
```sh
docker build -t pokeshare .
docker run -p 4321:4321 -e POCKETBASE_URL=https://pb.example.com pokeshare
```
## Full stack (app + PocketBase)
`docker-compose.yml` runs the app together with a PocketBase container. On
first boot, PocketBase applies `pocketbase/pb_migrations/`, which creates the
`users` profile fields, the `public_users` view, and the `mycards` and
`friendships` collections with their API rules — no manual setup needed.
```sh
PB_SUPERUSER_EMAIL=admin@example.com PB_SUPERUSER_PASSWORD=changeme123 \
docker compose up --build
```
- The app listens on `4321`; PocketBase listens on `8090` (internal network,
admin UI at `/_/` if you expose it).
- In Coolify, deploy as a **Docker Compose** resource and expose the `app`
service on your domain. Set `PB_SUPERUSER_*` in the environment variables.
- Accounts are created from the PocketBase admin UI (public registration is
disabled by the migration).
- To move existing data, use the PocketBase admin UI backups (Settings →
Backups) on the old instance and restore into `pb_data`.
## Structure
- `src/pages/` — routes (`/`, `/search`, `/mycards`, `/card/[id]`,