Update CLAUDE.md: reflect docker-server deployment
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
35
CLAUDE.md
35
CLAUDE.md
@@ -16,14 +16,19 @@ Node.js 18+ (ES modules), @onkernel/sdk, dotenv
|
||||
## Project Structure
|
||||
- `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
|
||||
- `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
|
||||
- `.env` — Credentials (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
|
||||
- `node bot.js <prompt-name>` — Post a single tweet immediately
|
||||
- `node scheduler.js <prompt-name>` — Schedule random posts for the day
|
||||
- `node bot.js <prompt-name>` — Post a single tweet immediately (local dev)
|
||||
- `node scheduler.js <prompt-name>` — Schedule random posts for the day (local dev)
|
||||
- `node cron.js` — Docker entrypoint (production)
|
||||
|
||||
## External Services
|
||||
| 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).
|
||||
|
||||
## Deployment
|
||||
Deployed on AWS EC2 in **us-west-2**:
|
||||
- Instance: `i-088b711cac69e6ac9`
|
||||
- Name: `xbot`
|
||||
- Type: `t4g.nano` (ARM-based)
|
||||
- Public IP: `44.249.48.3`
|
||||
- AWS account: `457667483187`
|
||||
- Cron: `0 16 * * *` (4pm UTC / before 8am PST window), one job per prompt
|
||||
Deployed on **docker-server** (Portainer):
|
||||
- Portainer: `https://portainer-1.docker.pq.io`
|
||||
- Registry: `registry.docker.pq.io`
|
||||
- Stack: `xbot`
|
||||
- Containers: `xbot-<account>-<prompt>` (e.g. `xbot-thejunipersky-tease`)
|
||||
- Scheduling: `cron.js` fires at 4pm UTC daily — no host cron needed
|
||||
|
||||
### 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
|
||||
- All changes must preserve stealth/anti-detection behavior and multi-account architecture
|
||||
|
||||
Reference in New Issue
Block a user