Update CLAUDE.md: reflect docker-server deployment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 17:16:54 -07:00
parent dacc7604cc
commit b5f3646ea5

View File

@@ -16,14 +16,19 @@ Node.js 18+ (ES modules), @onkernel/sdk, dotenv
## Project Structure ## Project Structure
- `bot.js` — Core logic: login to X, generate tweet via Claude, post it - `bot.js` — Core logic: login to X, generate tweet via Claude, post it
- `scheduler.js` — Picks random times within a window, invokes bot.js via child_process - `scheduler.js` — Picks random times within a window, invokes bot.js via child_process
- `cron.js` — Docker entrypoint: writes prompts.json from env, fires scheduler.js daily at 4pm UTC
- `Dockerfile` — Node 18 alpine image
- `package.json` — Dependencies & scripts - `package.json` — Dependencies & scripts
- `.env` — Credentials (not tracked)
- `prompts.json` — Prompt configs with account mapping, schedule, and link placeholders (not tracked) - `prompts.json` — Prompt configs with account mapping, schedule, and link placeholders (not tracked)
- `history-<prompt-name>.json` — Per-prompt tweet history (auto-generated) - `infra/docker-compose.yml` — One service per prompt, named volume for history files
- `infra/deploy-stack.sh` — Deploys stack to Portainer (run once, or on compose changes)
- `infra/.env` — All secrets + PROMPTS_JSON (not tracked)
- `infra/.env.example` — Template
## Entry Points ## Entry Points
- `node bot.js <prompt-name>` — Post a single tweet immediately - `node bot.js <prompt-name>` — Post a single tweet immediately (local dev)
- `node scheduler.js <prompt-name>` — Schedule random posts for the day - `node scheduler.js <prompt-name>` — Schedule random posts for the day (local dev)
- `node cron.js` — Docker entrypoint (production)
## External Services ## External Services
| Service | Purpose | Config Key | | Service | Purpose | Config Key |
@@ -35,13 +40,21 @@ Node.js 18+ (ES modules), @onkernel/sdk, dotenv
Multi-account credentials use uppercase prefix pattern in .env (e.g., MYACCOUNT_USER, MYACCOUNT_PW). Multi-account credentials use uppercase prefix pattern in .env (e.g., MYACCOUNT_USER, MYACCOUNT_PW).
## Deployment ## Deployment
Deployed on AWS EC2 in **us-west-2**: Deployed on **docker-server** (Portainer):
- Instance: `i-088b711cac69e6ac9` - Portainer: `https://portainer-1.docker.pq.io`
- Name: `xbot` - Registry: `registry.docker.pq.io`
- Type: `t4g.nano` (ARM-based) - Stack: `xbot`
- Public IP: `44.249.48.3` - Containers: `xbot-<account>-<prompt>` (e.g. `xbot-thejunipersky-tease`)
- AWS account: `457667483187` - Scheduling: `cron.js` fires at 4pm UTC daily — no host cron needed
- Cron: `0 16 * * *` (4pm UTC / before 8am PST window), one job per prompt
### To redeploy after code changes
1. Boot a t3.micro x86 build machine in AWS us-west-2 (key: `twitter-bot-key`, SG: `sg-088158905150b9051`, subnet: `subnet-08fe6b8d1dc82f243`)
2. Build and push: `docker build --platform linux/amd64 -t registry.docker.pq.io/xbot:latest . && docker push registry.docker.pq.io/xbot:latest`
3. Watchtower auto-restarts containers within 30s
4. Terminate build machine
### To redeploy after compose/config changes
Run `infra/deploy-stack.sh` with `PORTAINER_URL` and `PORTAINER_API_KEY` set.
## Guidelines ## Guidelines
- All changes must preserve stealth/anti-detection behavior and multi-account architecture - All changes must preserve stealth/anti-detection behavior and multi-account architecture