Added Tinybird migrations (#2)

no refs

The current setup runs the base Ghost installation without Traffic Analytics functionality. This commit adds:

- `tinybird-sync` service, which copies the latest Tinybird datafiles from the `ghost` container into a shared volume
- `tinybird-deploy` service & Dockerfile that includes the `tb` CLI, and runs `tb --cloud deploy` on boot
- Instructions for one-time manual setup of the Tinybird workspace in `TINYBIRD.md`

After the one-time manual setup, this configuration should automatically update Tinybird's datasources and endpoints in sync with the Ghost container when it is updated.


The initial setup is a bit clumsy and requires more manual steps than expected:
- The tinybird datafiles are in the Ghost image, but we need to access them from the `tinybird-deploy` service, which includes the `tb` CLI.
- When creating a new workspace in Tinybird, you can't access your admin token right away. Instead, it forces you to run `tb login` and `tb --cloud deploy` before you can access the rest of your workspace UI. This requires the user to install the `tb` CLI locally, and run an interactive login to authenticate with their Tinybird workspace. The generated `.tinyb` file is then mounted into the `tinybird-deploy` container, so this is only required for initial setup.
- Ghost requires the Tinybird `stats` and `tracker` token to be provided at boot. This means the user has to manually copy these tokens (either from CLI or the Workspace UI) and add them to their `.env` file manually. 
- We may want to either publish the Docker image with the Tinybird CLI installed, or possibly add the `tb` CLI to the traffic-analytics container.
This commit is contained in:
Chris Raible
2025-06-01 14:13:40 -07:00
committed by GitHub
parent de4605e48d
commit e6d4754682
6 changed files with 97 additions and 10 deletions

View File

@@ -4,5 +4,10 @@ DATABASE_ROOT_PASSWORD=reallysecurerootpassword
DATABASE_USER=optionalusername
DATABASE_PASSWORD=ghostpassword
TINYBIRD_ID=12345
TINYBIRD_TOKEN=12345
# Tinybird configuration for analytics
TINYBIRD_API_URL=https://api.tinybird.co
TINYBIRD_ID=745d3247-e887-4873-84f7-7414ec758b83
TINYBIRD_TRACKER_TOKEN=p.eyJxxxxx
TINYBIRD_STATS_TOKEN=p.eyJxxxxx
# COMPOSE_PROFILES=analytics,activitypub