Skip to content

Commit 6af7994

Browse files
chrisbbreuerclaude
andcommitted
chore: switch registry from Lambda to EC2+Bun+CloudFront
- Remove lambda.ts and Lambda-related build scripts - Update deploy workflow to SSH-based EC2 deployment - Registry runs natively on Bun (t4g.nano) with CloudFront for HTTPS Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9dc3750 commit 6af7994

File tree

3 files changed

+20
-136
lines changed

3 files changed

+20
-136
lines changed

.github/workflows/deploy-registry.yml

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,32 @@ on:
99

1010
jobs:
1111
deploy:
12-
name: Deploy to Lambda
12+
name: Deploy to EC2
1313
runs-on: ubuntu-latest
1414
permissions:
1515
contents: read
1616

1717
steps:
1818
- uses: actions/checkout@v6
1919

20-
- name: Setup Bun
21-
uses: oven-sh/setup-bun@v2
22-
with:
23-
bun-version: latest
24-
25-
- name: Build Lambda bundle
26-
run: |
27-
cd packages/registry
28-
bun build src/lambda.ts --outfile dist/lambda.mjs --target node --minify
29-
cd dist && zip -j lambda.zip lambda.mjs
30-
echo "Bundle size: $(wc -c < lambda.zip) bytes"
31-
32-
- name: Deploy to AWS Lambda
20+
- name: Deploy to registry server
3321
env:
34-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
35-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
36-
AWS_REGION: us-east-1
22+
SSH_PRIVATE_KEY: ${{ secrets.REGISTRY_SSH_KEY }}
3723
run: |
38-
aws lambda update-function-code \
39-
--function-name pantry-registry \
40-
--zip-file fileb://packages/registry/dist/lambda.zip \
41-
--region us-east-1 \
42-
--query 'LastModified' --output text
24+
mkdir -p ~/.ssh
25+
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
26+
chmod 600 ~/.ssh/id_rsa
27+
ssh-keyscan -H 54.243.196.101 >> ~/.ssh/known_hosts 2>/dev/null
28+
29+
ssh -o StrictHostKeyChecking=no ec2-user@54.243.196.101 << 'EOF'
30+
cd /opt/pantry-registry/repo
31+
git pull origin main
32+
cd packages/registry
33+
~/.bun/bin/bun install --production
34+
sudo systemctl restart pantry-registry
35+
sleep 2
36+
curl -sf http://localhost:3000/health || echo "Health check failed"
37+
EOF
4338
4439
- name: Verify deployment
4540
run: |
@@ -49,7 +44,7 @@ jobs:
4944
--max-time 15 2>/dev/null) || true
5045
echo "Health check: HTTP $HTTP_CODE"
5146
if [ "$HTTP_CODE" != "200" ]; then
52-
echo "::warning::Health check returned $HTTP_CODE (custom domain may not be configured yet)"
47+
echo "::warning::Health check returned $HTTP_CODE"
5348
fi
5449
5550
notify:
@@ -62,7 +57,7 @@ jobs:
6257
- uses: ./.github/actions/discord-notify
6358
with:
6459
title: "Registry Deploy — ${{ needs.deploy.result == 'success' && 'Deployed' || needs.deploy.result == 'cancelled' && 'Cancelled' || 'Failed' }}"
65-
description: "Registry Lambda function updated"
60+
description: "Registry server updated"
6661
status: ${{ needs.deploy.result == 'success' && 'success' || needs.deploy.result == 'cancelled' && 'warning' || 'failure' }}
6762
fields: |
6863
[

packages/registry/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
"test": "bun test",
2424
"test:analytics": "bun test src/analytics.test.ts",
2525
"test:commit-publish": "bun test src/commit-publish.test.ts",
26-
"typecheck": "bun --bun tsc --noEmit",
27-
"build:lambda": "bun build src/lambda.ts --outfile dist/lambda.mjs --target node --minify && cd dist && zip -j lambda.zip lambda.mjs",
28-
"deploy": "bun run build:lambda && aws lambda update-function-code --function-name pantry-registry --zip-file fileb://dist/lambda.zip --region us-east-1"
26+
"typecheck": "bun --bun tsc --noEmit"
2927
},
3028
"dependencies": {},
3129
"devDependencies": {

packages/registry/src/lambda.ts

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)