Skip to content

Commit 1462897

Browse files
committed
feat: add Fly.io deployment config and GitHub Actions cron
Add fly.toml for one-command Fly.io deployment with persistent SQLite volume, and a GitHub Actions workflow that triggers hourly data collection via the /api/cron endpoint. Made-with: Cursor
1 parent 74ac166 commit 1462897

3 files changed

Lines changed: 56 additions & 3 deletions

File tree

.github/workflows/cron.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Scheduled collection
2+
3+
on:
4+
schedule:
5+
- cron: "0 * * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
collect:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
steps:
13+
- name: Trigger collection and detection
14+
run: |
15+
curl -sf -X POST "${{ secrets.DASHBOARD_URL }}/api/cron" \
16+
-H "x-cron-secret: ${{ secrets.CRON_SECRET }}" \
17+
-H "Content-Type: application/json"

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,24 @@ volumes:
277277
278278
</details>
279279
280-
### Cloud platforms
280+
### Fly.io (recommended free option)
281281
282-
Any platform that supports Docker + persistent volumes works. Tested with:
282+
```bash
283+
fly launch --copy-config # creates the app from fly.toml
284+
fly volumes create tracker_data --region ams --size 1
285+
fly secrets set CURSOR_ADMIN_API_KEY=your_key CRON_SECRET=your_secret
286+
fly deploy
287+
# Dashboard at https://your-app.fly.dev
288+
```
289+
290+
Set up hourly collection by adding `DASHBOARD_URL` and `CRON_SECRET` as [GitHub Actions secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) — the included `.github/workflows/cron.yml` workflow triggers `/api/cron` every hour.
291+
292+
### Other cloud platforms
293+
294+
Any platform that supports Docker + persistent volumes works:
283295

284296
- **[Render](https://render.com)** — use the deploy button above, or `render.yaml` in this repo
285297
- **[Railway](https://railway.app)** — create a project from this repo, attach a volume at `/app/data`
286-
- **[Fly.io](https://fly.io)** — deploy with `fly launch`, create a volume for `/app/data`
287298

288299
> **Note:** Vercel is not supported — SQLite requires a persistent filesystem that Vercel's serverless functions don't provide.
289300

fly.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
app = "cursor-usage-tracker"
2+
primary_region = "ams"
3+
4+
[build]
5+
6+
[env]
7+
PORT = "3000"
8+
NODE_ENV = "production"
9+
DATABASE_PATH = "/app/data/tracker.db"
10+
11+
[http_service]
12+
internal_port = 3000
13+
force_https = true
14+
auto_stop_machines = false
15+
auto_start_machines = true
16+
min_machines_running = 1
17+
18+
[[vm]]
19+
memory = "256mb"
20+
cpu_kind = "shared"
21+
cpus = 1
22+
23+
[[mounts]]
24+
source = "tracker_data"
25+
destination = "/app/data"

0 commit comments

Comments
 (0)