Deploy walkerOS to Bunny Magic Containers
This guide deploys a walkerOS event collector to Bunny Magic Containers, forwarding events to BigQuery. We use GitHub Container Registry (GHCR) to store the Docker image privately.
Prerequisites
- GitHub account (for private container registry)
- Bunny.net account with Magic Containers access
- Docker installed
- Node.js 22.12+ installed
1. Set Up BigQuery
Follow the GCP BigQuery setup to:
- Create a service account with write permissions
- Download a service account key (
sa-bigquery.json)
Step 2 creates the dataset and the events table with walkeros setup.
The key file will be baked into your Docker image. Keep the image in a private registry only.
2. Bundle the Flow
Install the CLI and bundle the flow into dist/:
npm install -g @walkeros/cli
# Bundle the flow
walkeros bundle https://www.walkeros.io/flows/gcp-bigquery.json -o dist/
This creates dist/flow.mjs, dist/package.json, and dist/node_modules/. The flow reads GCP_PROJECT_ID (required), BQ_DATASET and BQ_TABLE (optional, defaults walkerOS and events) from the environment when the container starts, so nothing is baked in at bundle time. Only web flows bake $env values in, from config.bundle.env.
The flow's "setup" lets walkeros setup create the dataset and the events table, in the region BQ_LOCATION names (default EU). Run it once. It finds Google credentials the way the runtime does, from GOOGLE_APPLICATION_CREDENTIALS (the key from step 1) or your gcloud application default credentials, and the account needs the setup permissions listed under Create service accounts:
export GCP_PROJECT_ID="your-project-id"
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/sa-bigquery.json"
walkeros setup destination.bigquery -c https://www.walkeros.io/flows/gcp-bigquery.json
Test your flow before building Docker using push --simulate. The BigQuery call is mocked, so no credentials are needed:
export GCP_PROJECT_ID="your-project-id"
walkeros push https://www.walkeros.io/flows/gcp-bigquery.json \
-e '{"name": "page view", "data": {}}' --simulate destination.bigquery
3. Build Docker Image
Create a Dockerfile:
FROM walkeros/flow:<version>
# Copy the pre-built flow bundle (flow.mjs, package.json, node_modules/)
COPY dist/ /app/flow/
# Copy service account credentials, owned by the user the image runs as
COPY --chown=walker:walker sa-bigquery.json /app/sa-bigquery.json
# Configure runtime
ENV GOOGLE_APPLICATION_CREDENTIALS=/app/sa-bigquery.json
ENV GCP_PROJECT_ID=your-project-id
The image runs as the user walker (uid 1001). Without --chown the file is
copied as owned by root, so a key that only its owner can read (mode 600) stays
unreadable for that user.
Replace <version> with the walkeros/flow version matching your CLI (see
image tags). The image already starts
/app/flow/flow.mjs on port 8080, so no command or BUNDLE is needed. To
bundle inside Docker instead of on your machine, use the
canonical two-stage Dockerfile.
Build the image with your GitHub Container Registry tag:
# Replace YOUR_GITHUB_USERNAME with your GitHub username (lowercase)
docker build -t ghcr.io/YOUR_GITHUB_USERNAME/walkeros-collector:latest .
4. Test Locally
Run the container locally to verify everything works:
docker run --rm -p 8080:8080 ghcr.io/YOUR_GITHUB_USERNAME/walkeros-collector:latest
In another terminal, send a test event:
curl -X POST http://localhost:8080/collect \
-H "Content-Type: application/json" \
-d '{
"name": "page view",
"data": {
"title": "Local Test",
"path": "/test"
}
}'
Expected response:
{ "success": true, "timestamp": 1700000000000 }
The Express source answers a POST before delivery, so the response says nothing about BigQuery. A failed write shows up as a Push failed line in the container log.
Verify in BigQuery:
bq query --use_legacy_sql=false \
"SELECT * FROM walkerOS.events ORDER BY timestamp DESC LIMIT 5"
5. Push to Private GHCR
Create GitHub Personal Access Token
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click Generate new token (classic)
- Name it
ghcr-walkeros - Select scopes:
write:packages(to push images)read:packages(to pull images)delete:packages(optional, for cleanup)
- Click Generate token
- Copy the token (you won't see it again)
Login and Push
# Login to GHCR
echo YOUR_GITHUB_TOKEN | docker login ghcr.io -u YOUR_GITHUB_USERNAME --password-stdin
# Push the image
docker push ghcr.io/YOUR_GITHUB_USERNAME/walkeros-collector:latest
Verify Image is Private
- Go to
https://github.com/YOUR_GITHUB_USERNAME?tab=packages - Find
walkeros-collector - Confirm visibility is Private (default for new packages)
If the package is public, click Package settings → Change visibility → Private.
6. Connect GHCR to Bunny
Create Read-Only Token for Bunny
For security, create a separate token with read-only access:
- Go to GitHub Settings → Personal access tokens
- Generate new token with only
read:packagesscope - Name it
bunny-ghcr-readonly
Add Registry to Bunny
- Log in to bunny.net dashboard
- Navigate to Magic Containers → Image Registries
- Click Add Image Registry
- As Registry, select GitHub
- Enter:
- Username: Your GitHub username
- Personal access token: The read-only token from above
- Click Add Image Registry
7. Deploy to Bunny Magic Containers
- In the bunny.net dashboard, go to Magic Containers and click + Add App
- Search for and select the image
walkeros-collectorfrom your GitHub registry; itslatesttag is selected automatically - Add an endpoint with + CDN (routes HTTP(S) traffic through bunny.net's
edge network) or + Anycast IP (direct access through an Anycast IP), name
it
collectand set the container port to8080. Leave SSL for origin off: the container serves plain HTTP on port 8080 - Enter the app name
walkeros-collectorand choose a region (the one closest to you is preselected) - Click Deploy
- Note the endpoint URL (e.g.,
https://walkeros-collector-xxxxx.b-cdn.net)
To run in more regions, add them after the deploy in the app's Regions and Scaling settings.
8. Verify Deployment
Health Check
curl https://YOUR_BUNNY_ENDPOINT/health
Send Test Event
curl -X POST https://YOUR_BUNNY_ENDPOINT/collect \
-H "Content-Type: application/json" \
-d '{
"name": "page view",
"data": {
"title": "Bunny Production Test",
"path": "/"
}
}'
Query BigQuery
bq query --use_legacy_sql=false \
"SELECT name, data, timestamp FROM walkerOS.events ORDER BY timestamp DESC LIMIT 5"
Updating Your Deployment
When you need to update your flow or configuration:
# 1. Make changes, bundle the flow again and rebuild
walkeros bundle https://www.walkeros.io/flows/gcp-bigquery.json -o dist/
docker build -t ghcr.io/YOUR_GITHUB_USERNAME/walkeros-collector:latest .
# 2. Push new image
docker push ghcr.io/YOUR_GITHUB_USERNAME/walkeros-collector:latest
# 3. In Bunny dashboard: Magic Containers → Your App → Redeploy
Next Steps
- Configure event mapping to transform events before sending to BigQuery
- Add more destinations to forward events to multiple services
- Read the Magic Containers documentation
Cleanup
To remove all created resources:
- Delete the Bunny Magic Container app from the dashboard
- Delete the GHCR image from your GitHub packages
- Clean up BigQuery resources
- Delete local files (
dist/,sa-bigquery.json,Dockerfile)