Skip to content

Commit c1311e5

Browse files
committed
Merge branch 'feat/cv-revamp-superteam' into dev
2 parents 29b9074 + f52601b commit c1311e5

File tree

1,841 files changed

+2019
-271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,841 files changed

+2019
-271
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ jobs:
1111

1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v5
14+
uses: actions/checkout@v6
1515

1616
- name: Set up Ruby
1717
uses: ruby/setup-ruby@v1
1818
with:
1919
bundler-cache: true
2020

2121
- name: Scan for common Rails security vulnerabilities using static analysis
22-
run: bin/brakeman --no-pager
22+
run: |
23+
EXIT_CODE=0
24+
bin/brakeman --no-pager || EXIT_CODE=$?
25+
if [ "$EXIT_CODE" -eq 5 ]; then
26+
echo "::warning::Brakeman is not the latest version"
27+
exit 0
28+
fi
29+
exit $EXIT_CODE
2330
2431
- name: Scan for known security vulnerabilities in gems used
2532
run: bin/bundler-audit
@@ -29,7 +36,7 @@ jobs:
2936

3037
steps:
3138
- name: Checkout code
32-
uses: actions/checkout@v5
39+
uses: actions/checkout@v6
3340

3441
- name: Set up Ruby
3542
uses: ruby/setup-ruby@v1
@@ -45,15 +52,15 @@ jobs:
4552
RUBOCOP_CACHE_ROOT: tmp/rubocop
4653
steps:
4754
- name: Checkout code
48-
uses: actions/checkout@v5
55+
uses: actions/checkout@v6
4956

5057
- name: Set up Ruby
5158
uses: ruby/setup-ruby@v1
5259
with:
5360
bundler-cache: true
5461

5562
- name: Prepare RuboCop cache
56-
uses: actions/cache@v4
63+
uses: actions/cache@v5
5764
env:
5865
DEPENDENCIES_HASH: ${{ hashFiles('.ruby-version', '**/.rubocop.yml', '**/.rubocop_todo.yml', 'Gemfile.lock') }}
5966
with:
@@ -89,7 +96,7 @@ jobs:
8996
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libpq-dev
9097

9198
- name: Checkout code
92-
uses: actions/checkout@v5
99+
uses: actions/checkout@v6
93100

94101
- name: Set up Ruby
95102
uses: ruby/setup-ruby@v1
@@ -128,7 +135,7 @@ jobs:
128135
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libpq-dev
129136

130137
- name: Checkout code
131-
uses: actions/checkout@v5
138+
uses: actions/checkout@v6
132139

133140
- name: Set up Ruby
134141
uses: ruby/setup-ruby@v1
@@ -144,7 +151,7 @@ jobs:
144151
run: bin/rails db:test:prepare test:system
145152

146153
- name: Keep screenshots from failed system tests
147-
uses: actions/upload-artifact@v4
154+
uses: actions/upload-artifact@v6
148155
if: failure()
149156
with:
150157
name: screenshots

.github/workflows/claude.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
actions: read # Required for Claude to read CI results on PRs
2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v6
3030
with:
3131
fetch-depth: 1
3232

.github/workflows/deploy.yml

Lines changed: 45 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -4,115 +4,69 @@ on:
44
push:
55
branches:
66
- main
7-
workflow_dispatch: # Allow manual trigger
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
811

912
jobs:
1013
deploy:
11-
name: Deploy to VPS
14+
name: Build and Deploy
1215
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
1319

1420
steps:
15-
- name: Checkout code
21+
- name: Checkout
1622
uses: actions/checkout@v4
1723

18-
- name: Setup Ruby
19-
uses: ruby/setup-ruby@v1
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Log in to GHCR
28+
uses: docker/login-action@v3
2029
with:
21-
ruby-version: '3.3'
22-
bundler-cache: true
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
2333

24-
- name: Install SSH key
25-
uses: shimataro/ssh-key-action@v2
34+
- name: Extract metadata
35+
id: meta
36+
uses: docker/metadata-action@v5
2637
with:
27-
key: ${{ secrets.VPS_SSH_KEY }}
28-
known_hosts: unnecessary
29-
if_key_exists: replace
38+
images: ${{ env.REGISTRY }}/${{ github.repository }}
39+
tags: |
40+
type=raw,value=latest
41+
type=sha
3042
31-
- name: Add VPS to known hosts
32-
run: ssh-keyscan -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: .
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max
3351

3452
- name: Deploy to VPS
35-
env:
36-
VPS_HOST: ${{ secrets.VPS_HOST }}
37-
VPS_USER: ${{ secrets.VPS_USER }}
38-
run: |
39-
ssh $VPS_USER@$VPS_HOST << 'ENDSSH'
40-
set -e
41-
42-
echo "🚀 Starting deployment..."
43-
44-
cd /home/core/apps/core
45-
46-
# Initialize rbenv (add shims to PATH for bundle/rails commands)
47-
export PATH="/home/core/.rbenv/shims:/home/core/.rbenv/bin:$PATH"
48-
eval "$(/home/core/.rbenv/bin/rbenv init - bash)"
49-
50-
# Pull latest changes
51-
echo "📥 Pulling latest code from main..."
52-
git fetch origin
53-
git reset --hard origin/main
54-
55-
# Generate REVISION file with commit SHA, branch, and commit count
56-
echo "📝 Generating REVISION file..."
57-
COMMIT_SHA=$(git rev-parse HEAD)
58-
BRANCH=$(git rev-parse --abbrev-ref HEAD)
59-
COMMIT_COUNT=$(git rev-list --count HEAD)
60-
echo "${COMMIT_SHA}|${BRANCH}|${COMMIT_COUNT}" > REVISION
61-
echo "✅ REVISION: ${BRANCH}@${COMMIT_SHA:0:7} (${COMMIT_COUNT} commits)"
62-
63-
# Install dependencies
64-
echo "📦 Installing dependencies..."
65-
bundle install --deployment --without development test
66-
67-
# Load environment variables
68-
export $(cat .env | grep -v '^#' | xargs)
69-
70-
# Precompile assets
71-
echo "🎨 Precompiling assets..."
72-
RAILS_ENV=production bundle exec rails assets:precompile
73-
74-
# Run database migrations
75-
echo "🗄️ Running database migrations..."
76-
RAILS_ENV=production bundle exec rails db:migrate
77-
78-
# Restart services (zero-downtime)
79-
echo "🔄 Restarting Puma (zero-downtime)..."
80-
sudo systemctl reload core-puma
81-
82-
echo "🔄 Restarting Solid Queue..."
83-
sudo systemctl restart core-solidqueue
84-
85-
# Verify deployment
86-
echo "✅ Deployment complete!"
87-
echo "📊 App status:"
88-
sudo systemctl status core-puma --no-pager -l
89-
90-
ENDSSH
53+
uses: appleboy/ssh-action@v1.0.3
54+
with:
55+
host: ${{ secrets.VPS_HOST }}
56+
username: ${{ secrets.VPS_USER }}
57+
key: ${{ secrets.VPS_SSH_KEY }}
58+
script: |
59+
cd ${{ secrets.VPS_APP_PATH }}
60+
docker compose pull
61+
docker compose up -d
62+
docker image prune -f
9163
9264
- name: Verify deployment
93-
env:
94-
VPS_HOST: ${{ secrets.VPS_HOST }}
95-
VPS_USER: ${{ secrets.VPS_USER }}
9665
run: |
97-
# Wait for app to be ready
98-
sleep 5
99-
100-
# Check if site is responding
66+
sleep 10
10167
if curl -f -s -o /dev/null https://rectorspace.com/up; then
102-
echo "Production site is healthy!"
68+
echo "Production site is healthy!"
10369
else
104-
echo "Production site health check failed!"
70+
echo "Production site health check failed!"
10571
exit 1
10672
fi
107-
108-
- name: Notify deployment success
109-
if: success()
110-
run: |
111-
echo "✅ Deployment successful!"
112-
echo "🌐 Visit: https://rectorspace.com"
113-
114-
- name: Notify deployment failure
115-
if: failure()
116-
run: |
117-
echo "❌ Deployment failed!"
118-
echo "Check logs: https://github.com/${{ github.repository }}/actions"

CLAUDE.md

Lines changed: 58 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,30 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1212

1313
---
1414

15-
## RECTOR's Achievements (2024-2025)
15+
## RECTOR's Achievements (YAML-Driven)
1616

17-
**Total Earnings:** ~$10,800 USDC + Gen3 Monke NFT
17+
**Source of Truth:** `config/achievements.yml`
1818

19-
| # | Project | Type | Place | Prize | Event |
20-
|---|---------|------|-------|-------|-------|
21-
| 1 | **Web3 Deal Discovery** | Hackathon | 🥇 1st | $5,000 + NFT | MonkeDAO Cypherpunk (Superteam Earn, Dec 2025) |
22-
| 2 | **SIP Protocol** | Hackathon | 🏆 Winner | $4,000 | Zypherpunk NEAR Track |
23-
| 3 | **OpenBudget.ID** | Hackathon | 🥈 2nd | $1,500 | Garuda Spark (Superteam Indonesia, Oct 2025) |
24-
| 4 | **Saros SDK Docs** | Bounty | 🥇 1st | $300 | Saros SDK Guide Challenge (Dec 2024) |
19+
Achievements are managed via a YAML file. Homepage, meta tags, and totals auto-calculate.
20+
21+
**To add a new achievement:**
22+
1. Edit `config/achievements.yml`
23+
2. Add entry at the top (newest first)
24+
3. Deploy - everything auto-updates
25+
26+
**Auto-calculated fields:**
27+
- `Achievement.total_earnings` → sum of all prize amounts
28+
- `Achievement.win_count` → total count
29+
- `Achievement.year_range` → "2024-2026" from dates
30+
- `Achievement.winner_projects` → hash for project badges
31+
32+
**Architecture:**
33+
```
34+
config/achievements.yml # Single source of truth
35+
app/models/achievement.rb # PORO - loads YAML, queries, calculates
36+
app/helpers/achievements_helper.rb # Formatting helpers
37+
app/views/pages/_achievement_card.html.erb # Reusable card partial
38+
```
2539

2640
**Project Details:**
2741

@@ -45,6 +59,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4559
- Interactive API Explorer, 15+ tutorials, production examples
4660
- Live: https://saros-docs.rectorspace.com
4761

62+
5. **pNode Pulse** (`RECTOR-LABS/pnode-pulse`)
63+
- Real-time analytics for Xandeum's decentralized pNode storage network
64+
- TimescaleDB time-series, health scoring, 200+ nodes tracked
65+
- Stack: Next.js 14 + TypeScript + tRPC + TimescaleDB + Redis
66+
- Live: https://pulse.rectorspace.com
67+
4868
---
4969

5070
## The 7-Section Architecture
@@ -79,6 +99,7 @@ core/
7999
│ │ ├── pages_controller.rb # Homepage (✅ implemented)
80100
│ │ └── works_controller.rb # Work section (✅ implemented)
81101
│ ├── models/
102+
│ │ ├── achievement.rb # PORO for YAML achievements (✅ implemented)
82103
│ │ ├── github_repo.rb # GitHub repository cache (✅ implemented)
83104
│ │ └── work.rb # Work/project stories (✅ implemented)
84105
│ ├── views/
@@ -88,13 +109,15 @@ core/
88109
│ │ ├── index.html.erb # Work listing (✅ implemented)
89110
│ │ └── show.html.erb # Story page with custom CSS (✅ implemented)
90111
│ ├── helpers/
112+
│ │ ├── achievements_helper.rb # Achievement summary formatting (✅ implemented)
91113
│ │ └── works_helper.rb # Markdown rendering (✅ implemented)
92114
│ ├── jobs/
93115
│ │ └── sync_github_repos_job.rb # Hourly GitHub sync (✅ implemented)
94116
│ └── services/
95117
│ ├── github_api_service.rb # GitHub API client (✅ implemented)
96118
│ └── tech_stack_parser.rb # Language parser (✅ implemented)
97119
├── config/
120+
│ ├── achievements.yml # Single source of truth for achievements (✅ implemented)
98121
│ ├── routes.rb # Routes for /, /work (✅ configured)
99122
│ └── recurring.yml # Solid Queue job schedule
100123
├── db/
@@ -192,22 +215,36 @@ bin/rails server
192215

193216
---
194217

195-
## Deployment Strategy
218+
## Deployment
196219

197-
**VPS Deployment:**
198-
- Single Rails app deployment (Nginx + Puma/Passenger)
199-
- 1 user account per deployment environment (staging/production)
200-
- PostgreSQL database
201-
- Let's Encrypt SSL for rectorspace.com
202-
- GitHub Actions CI/CD
203-
- SSH via `~/.ssh/config`
220+
**Architecture:** Docker on shared VPS (reclabs3, 151.245.137.75)
204221

205-
**Environment Variables:**
206-
- Ghost CMS API credentials
207-
- Database connection strings
208-
- External API keys (GitHub API, Quran API)
222+
```
223+
GitHub push → Actions build → GHCR image → SSH → docker compose pull → up -d → image prune -f
224+
```
225+
226+
**Containers** (docker-compose.yml):
227+
| Service | Image | Port |
228+
|---------|-------|------|
229+
| postgres | postgres:16 | 127.0.0.1:5435:5432 |
230+
| web | ghcr.io/rector-labs/core:latest | 8000:80 |
231+
| solidqueue | ghcr.io/rector-labs/core:latest ||
232+
233+
- Puma runs behind Thruster (port 80 inside container)
234+
- nginx reverse proxies `rectorspace.com``127.0.0.1:8000`
235+
- `db:prepare` runs automatically on container start (entrypoint)
236+
- Solid Queue runs as a separate container (`bundle exec rake solid_queue:start`)
237+
238+
**VPS User:** `core` (SSH alias: `core`)
239+
240+
**GitHub Secrets:** `VPS_HOST`, `VPS_USER`, `VPS_SSH_KEY`, `VPS_APP_PATH`
241+
242+
**Environment Variables** (VPS `~/core/.env`):
243+
- `SECRET_KEY_BASE` — Rails secret
244+
- `CORE_DATABASE_PASSWORD` — PostgreSQL password
245+
- `GITHUB_TOKEN` — GitHub API access for repo sync
209246

210-
**Security:** Never commit `.env`, use Rails credentials (encrypted)
247+
**Security:** Never commit `.env`. DB port bound to localhost only.
211248

212249
---
213250

0 commit comments

Comments
 (0)