feat: scale scout bot traffic loop and route into main stack
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 7s
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 7s
This commit is contained in:
15
apps/scout-bot/Dockerfile
Normal file
15
apps/scout-bot/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM node:20-alpine
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
COPY apps/scout-bot/package.json apps/scout-bot/
|
||||
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
COPY apps/scout-bot ./apps/scout-bot
|
||||
|
||||
CMD ["pnpm", "--dir", "apps/scout-bot", "exec", "tsx", "src/index.ts"]
|
||||
@@ -8,11 +8,21 @@ const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
|
||||
const VIBEWORK_API_URL = process.env.VIBEWORK_API_URL || "https://agent.wooo.work/api";
|
||||
const SCOUT_API_KEY = process.env.SCOUT_API_KEY;
|
||||
const SCOUT_AGENT_ID = process.env.SCOUT_AGENT_ID || "scout_official_1";
|
||||
const SCOUT_CRON_EXPRESSION = process.env.SCOUT_CRON_EXPRESSION || "*/10 * * * *";
|
||||
const SCOUT_ISSUE_LABEL = process.env.SCOUT_ISSUE_LABEL || "good first issue";
|
||||
const SCOUT_TARGET_REPOS_RAW = process.env.SCOUT_TARGET_REPOS || "vibe-work/test-bounty-repo";
|
||||
const SCOUT_TARGET_REPOS = SCOUT_TARGET_REPOS_RAW
|
||||
.split(",")
|
||||
.map((entry) => entry.trim())
|
||||
.filter(Boolean)
|
||||
.map((entry) => {
|
||||
const [owner, repo] = entry.split("/");
|
||||
return { owner, repo };
|
||||
})
|
||||
.filter((repo) => repo.owner && repo.repo);
|
||||
|
||||
// Target repositories for Phase 1 (Replace with user-specified repos later)
|
||||
const TARGET_REPOS = [
|
||||
{ owner: "vibe-work", repo: "test-bounty-repo" } // Example test repo
|
||||
];
|
||||
const fallbackRepo = { owner: "vibe-work", repo: "test-bounty-repo" };
|
||||
const TARGET_REPOS = SCOUT_TARGET_REPOS.length > 0 ? SCOUT_TARGET_REPOS : [fallbackRepo];
|
||||
|
||||
if (!GITHUB_TOKEN) {
|
||||
console.warn("WARNING: GITHUB_TOKEN is not set. Scout bot cannot post comments.");
|
||||
@@ -120,7 +130,8 @@ async function scanRepositories() {
|
||||
owner: target.owner,
|
||||
repo: target.repo,
|
||||
state: "open",
|
||||
labels: "good first issue" // Start with good first issues
|
||||
labels: SCOUT_ISSUE_LABEL,
|
||||
per_page: 30
|
||||
});
|
||||
|
||||
console.log(`Found ${issues.data.length} open issues in ${target.owner}/${target.repo}`);
|
||||
@@ -139,9 +150,9 @@ async function scanRepositories() {
|
||||
// Run immediately on startup for testing
|
||||
scanRepositories();
|
||||
|
||||
// Schedule to run every hour
|
||||
cron.schedule("0 * * * *", () => {
|
||||
console.log("Running scheduled GitHub scan...");
|
||||
// Default: every 10 minutes for higher volume inbound traffic
|
||||
cron.schedule(SCOUT_CRON_EXPRESSION, () => {
|
||||
console.log(`Running scheduled GitHub scan (${SCOUT_CRON_EXPRESSION})...`);
|
||||
scanRepositories();
|
||||
});
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ services:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- agent_bounty_pgdata:/var/lib/postgresql/data
|
||||
networks:
|
||||
- agent-bounty-network
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U agent"]
|
||||
interval: 5s
|
||||
@@ -39,6 +41,37 @@ services:
|
||||
# We use a command override to run database push before starting next.js
|
||||
command: >
|
||||
sh -c "npx prisma@6.4.1 db push --schema=apps/web/prisma/schema.prisma --skip-generate && node apps/web/server.js"
|
||||
networks:
|
||||
- agent-bounty-network
|
||||
|
||||
scout-bot:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/scout-bot/Dockerfile
|
||||
container_name: agent_bounty_scout_bot
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
web:
|
||||
condition: service_started
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- VIBEWORK_API_URL=http://agent_bounty_web:3000/api
|
||||
- SCOUT_API_KEY=${SCOUT_API_KEY:-dev_scout_key}
|
||||
- SCOUT_AGENT_ID=scout_official_1
|
||||
# Optional: add more discovery repos via env (comma separated "owner/repo"), e.g. openai/swarm,significant-gravitas/autogpt
|
||||
- SCOUT_TARGET_REPOS=${SCOUT_TARGET_REPOS}
|
||||
- SCOUT_ISSUE_LABEL=${SCOUT_ISSUE_LABEL:-good first issue}
|
||||
# Higher frequency for phase-1 bootstrapping; tune this safely after data stabilizes.
|
||||
- SCOUT_CRON_EXPRESSION=${SCOUT_CRON_EXPRESSION:-*/10 * * * *}
|
||||
# GitHub token should be provided in deployment env for real posting.
|
||||
- GITHUB_TOKEN=${GITHUB_TOKEN}
|
||||
networks:
|
||||
- agent-bounty-network
|
||||
|
||||
networks:
|
||||
agent-bounty-network:
|
||||
driver: bridge
|
||||
name: agent-bounty-network
|
||||
|
||||
volumes:
|
||||
agent_bounty_pgdata:
|
||||
|
||||
Reference in New Issue
Block a user