Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c1b646e
adding more files
rabble May 23, 2025
1173e62
Merge remote-tracking branch 'origin' into notification_worker
rabble May 23, 2025
cb5771c
WIP: Save current notification worker changes before updating from main
rabble May 23, 2025
6440dc2
Merge main into notification_worker branch, keeping worker files that…
rabble May 23, 2025
32637e0
Fix: Remove EOF markers and fix TypeScript linting errors in worker f…
rabble May 23, 2025
a21b40f
feat: Add push notification permission system with smart prompting
rabble May 23, 2025
72123d9
docs: Add VAPID key generation and documentation
rabble May 23, 2025
dbbc57b
Add relay crawler worker and GitHub Actions workflows
rabble May 23, 2025
1cc5092
Add KV namespace IDs for relay crawler
rabble May 23, 2025
adaba25
Remove CPU limits for free plan compatibility
rabble May 23, 2025
666a810
feat: add push notification worker with dev server and tests
NotThatKindOfDrLiz May 26, 2025
d94e8fc
chore: set real KV namespace IDs for deployment
NotThatKindOfDrLiz May 26, 2025
385842d
fix: use only new_sqlite_classes for PushQueue migration
NotThatKindOfDrLiz May 26, 2025
73c672f
fix: remove [limits] section for free plan deployment
NotThatKindOfDrLiz May 26, 2025
4a39c23
fix: export PushQueue for Durable Object migration
NotThatKindOfDrLiz May 26, 2025
06febef
feat: deploy push notification worker to production and add test script
NotThatKindOfDrLiz May 26, 2025
819d395
fix: resolve merge conflicts in worker files and dependencies
NotThatKindOfDrLiz May 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# Push Notification Configuration
VITE_WORKER_URL=https://your-worker-url.workers.dev
VITE_VAPID_PUBLIC_KEY=your-vapid-public-key-here
EOF 2>&1
228 changes: 228 additions & 0 deletions .github/workflows/deploy-relay-crawler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
name: Deploy Relay Crawler

on:
push:
branches:
- main
paths:
- 'worker/cloudflare-worker/src/relay-crawler-worker.ts'
- 'worker/cloudflare-worker/wrangler-crawler.toml'
- '.github/workflows/deploy-relay-crawler.yml'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'worker/cloudflare-worker/src/relay-crawler-worker.ts'
- 'worker/cloudflare-worker/wrangler-crawler.toml'
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'production'
type: choice
options:
- development
- staging
- production

jobs:
test:
name: Test Relay Crawler
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: worker/cloudflare-worker/package-lock.json

- name: Install dependencies
working-directory: worker/cloudflare-worker
run: npm ci

- name: Type check
working-directory: worker/cloudflare-worker
run: npm run typecheck

- name: Lint
working-directory: worker/cloudflare-worker
run: npm run lint || true

deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'pull_request'
environment:
name: staging
url: https://relay-crawler-staging.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev
steps:
Comment on lines +60 to +63
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

secrets context is not allowed inside environment.url – breaks actionlint & UI linking

environment.url is evaluated before the runner has access to secrets, so the expression is invalid.
Move the dynamic URL into a job-level outputs step or hard-code the environment URL in GitHub “Environments” settings.

-environment:
-  name: staging
-  url: https://relay-crawler-staging.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev
+environment: staging  # URL configured in repo Settings → Environments
🧰 Tools
🪛 actionlint (1.7.7)

62-62: context "secrets" is not allowed here. available contexts are "env", "github", "inputs", "job", "matrix", "needs", "runner", "steps", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)

🤖 Prompt for AI Agents
In .github/workflows/deploy-relay-crawler.yml around lines 60 to 63, the use of
the secrets context inside environment.url is invalid because environment.url is
evaluated before the runner has access to secrets. To fix this, remove the
dynamic expression from environment.url and either hard-code the URL in the
GitHub Environments settings or move the dynamic URL construction into a job
step that sets it as an output, then reference that output elsewhere as needed.

- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: worker/cloudflare-worker/package-lock.json

- name: Install dependencies
working-directory: worker/cloudflare-worker
run: npm ci

- name: Deploy to Cloudflare Workers (Staging)
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: worker/cloudflare-worker
command: deploy --env staging -c wrangler-crawler.toml
secrets: |
WORKER_AUTH_TOKEN
env:
WORKER_AUTH_TOKEN: ${{ secrets.WORKER_AUTH_TOKEN_STAGING }}

- name: Test deployment
run: |
sleep 10
response=$(curl -s -w "\n%{http_code}" https://relay-crawler-staging.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev/health)
status_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | head -n-1)

echo "Response: $body"
echo "Status code: $status_code"

if [ "$status_code" != "200" ]; then
echo "Health check failed"
exit 1
fi

# Check if response is valid JSON
echo "$body" | jq .

deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
environment:
name: production
url: https://relay-crawler-prod.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev
steps:
Comment on lines +112 to +116
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same invalid secrets reference for production URL – please apply the fix here as well.

🧰 Tools
🪛 actionlint (1.7.7)

115-115: context "secrets" is not allowed here. available contexts are "env", "github", "inputs", "job", "matrix", "needs", "runner", "steps", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)

🤖 Prompt for AI Agents
In .github/workflows/deploy-relay-crawler.yml around lines 112 to 116, the
production URL uses an invalid reference to secrets with ${{
secrets.CF_ACCOUNT_SUBDOMAIN }}. Update this to use the correct syntax or
variable name consistent with the fix applied elsewhere, ensuring the secret is
properly referenced to avoid deployment errors.

- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: worker/cloudflare-worker/package-lock.json

- name: Install dependencies
working-directory: worker/cloudflare-worker
run: npm ci

- name: Deploy to Cloudflare Workers (Production)
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: worker/cloudflare-worker
command: deploy --env production -c wrangler-crawler.toml
secrets: |
WORKER_AUTH_TOKEN
env:
WORKER_AUTH_TOKEN: ${{ secrets.WORKER_AUTH_TOKEN_PRODUCTION }}

- name: Test deployment
run: |
sleep 10
response=$(curl -s -w "\n%{http_code}" https://relay-crawler-prod.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev/health)
status_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | head -n-1)

echo "Response: $body"
echo "Status code: $status_code"

if [ "$status_code" != "200" ]; then
echo "Health check failed"
exit 1
fi

# Check if response is valid JSON and service is 'relay-crawler'
echo "$body" | jq .
service=$(echo "$body" | jq -r .service)
if [ "$service" != "relay-crawler" ]; then
echo "Unexpected service: $service"
exit 1
fi

- name: Send deployment notification
if: success()
run: |
echo "✅ Relay Crawler deployed successfully to production!"
# Add Slack/Discord notification here if needed

deploy-manual:
name: Manual Deploy
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
environment:
name: ${{ github.event.inputs.environment }}
url: https://relay-crawler-${{ github.event.inputs.environment == 'production' && 'prod' || github.event.inputs.environment }}.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: worker/cloudflare-worker/package-lock.json

- name: Install dependencies
working-directory: worker/cloudflare-worker
run: npm ci

- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: worker/cloudflare-worker
command: deploy ${{ github.event.inputs.environment != 'development' && format('--env {0}', github.event.inputs.environment) || '' }} -c wrangler-crawler.toml
secrets: |
WORKER_AUTH_TOKEN
env:
WORKER_AUTH_TOKEN: ${{ github.event.inputs.environment == 'production' && secrets.WORKER_AUTH_TOKEN_PRODUCTION || secrets.WORKER_AUTH_TOKEN_STAGING }}

- name: Test deployment
run: |
sleep 10
if [ "${{ github.event.inputs.environment }}" = "production" ]; then
url="https://relay-crawler-prod.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev/health"
elif [ "${{ github.event.inputs.environment }}" = "staging" ]; then
url="https://relay-crawler-staging.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev/health"
else
url="https://relay-crawler.${{ secrets.CF_ACCOUNT_SUBDOMAIN }}.workers.dev/health"
fi

echo "Testing: $url"
response=$(curl -s -w "\n%{http_code}" "$url")
status_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | head -n-1)

echo "Response: $body"
echo "Status code: $status_code"

if [ "$status_code" != "200" ]; then
echo "Health check failed"
exit 1
fi
Loading
Loading