Merge pull request 'fix: feat: configurable agent roles per container via DISINTO_AGENTS env var (#197)' (#202) from fix/issue-197 into main
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
This commit is contained in:
commit
bfa12bf37d
4 changed files with 142 additions and 29 deletions
|
|
@ -268,27 +268,40 @@ def main() -> int:
|
|||
"93726a3c799b72ed2898a55552031921": "Standard prompt template continuation (SCRATCH_CONTEXT, FORMULA_CONTENT, SCRATCH_INSTRUCTION)",
|
||||
"c11eaaacab69c9a2d3c38c75215eca84": "Standard prompt template end (FORMULA_CONTENT, SCRATCH_INSTRUCTION)",
|
||||
# install_project_crons function in entrypoint.sh and entrypoint-llama.sh (intentional duplicate)
|
||||
"d389fe80bcfc1571e398009b042ce0a5": "install_project_crons function in entrypoints (window 1)",
|
||||
"92cca4075f2e98108a9a1c8009a9a584": "install_project_crons function in entrypoints (window 2)",
|
||||
"9571ac33388933d02fbe612eea27af5b": "install_project_crons function in entrypoints (window 3)",
|
||||
"2d806e0f07881b4e7b6b05eae0286caa": "install_project_crons function in entrypoints (window 4)",
|
||||
"80bdff63e54b4a260043d264b83d8eb0": "install_project_crons function in entrypoints (window 5)",
|
||||
"f0e4101f9b90c2fa921e088057a96db7": "install_project_crons function in entrypoints (window 6)",
|
||||
"c566639b237036a7a385982274d3d271": "install_project_crons function in entrypoints (window 7)",
|
||||
"a222b73bcd6a57adb2315726e81ab6cf": "install_project_crons function in entrypoints (window 8)",
|
||||
"04143957d4c63e8a16ac28bddaff589b": "install_project_crons function in entrypoints (window 9)",
|
||||
"076a19221cde674b2fce20a17292fa78": "install_project_crons function in entrypoints (window 10)",
|
||||
"f7fa9ff817004265b73bac50f6673dab": "install_project_crons function in entrypoints (window 11)",
|
||||
"dc1558fdf58c907ca9417b2ef97d5145": "install_project_crons function in entrypoints (window 12)",
|
||||
"d93d2c7f5711ac4f4bafe93993b1db02": "install_project_crons function in entrypoints (window 13)",
|
||||
"4061aa91dabce2371c87c850fe1c081c": "install_project_crons function in entrypoints (window 14)",
|
||||
"8dd5c935fc96313a70354136b4e0c6f3": "install_project_crons function in entrypoints (window 15)",
|
||||
"5230752db7cbfaa56ba272a8ce2b4285": "install_project_crons function in entrypoints (window 16)",
|
||||
"8dc4e402762b8248fb00c98bcd8e7f67": "install_project_crons function in entrypoints (window 17)",
|
||||
"95b8a191bda7b09dcc45bbb5d1ba2cc5": "install_project_crons function in entrypoints (window 18)",
|
||||
"bb2226470ad66c945b09d9ee609b8542": "install_project_crons function in entrypoints (window 19)",
|
||||
"7ac64ec03e93bf47e8914c14ae4eeabd": "install_project_crons function in entrypoints (window 20)",
|
||||
"252a071cb94a5adb7b14e4d4d33fe575": "install_project_crons function in entrypoints (window 21)",
|
||||
"007e1390498374c68ab5d66aa6d277b2": "install_project_crons function in entrypoints (window 007e1390)",
|
||||
"04143957d4c63e8a16ac28bddaff589b": "install_project_crons function in entrypoints (window 04143957)",
|
||||
"076a19221cde674b2fce20a17292fa78": "install_project_crons function in entrypoints (window 076a1922)",
|
||||
"0d498287626e105f16b24948aed53584": "install_project_crons function in entrypoints (window 0d498287)",
|
||||
"137b746928011acd758c7a9c690810b2": "install_project_crons function in entrypoints (window 137b7469)",
|
||||
"287d33d98d21e3e07e0869e56ad94527": "install_project_crons function in entrypoints (window 287d33d9)",
|
||||
"325a3d54a15e59d333ec2a20c062cc8c": "install_project_crons function in entrypoints (window 325a3d54)",
|
||||
"34e1943d5738f540d67c5c6bd3e60b20": "install_project_crons function in entrypoints (window 34e1943d)",
|
||||
"3dabd19698f9705b05376c38042ccce8": "install_project_crons function in entrypoints (window 3dabd196)",
|
||||
"446b420f7f9821a2553bc4995d1fac25": "install_project_crons function in entrypoints (window 446b420f)",
|
||||
"4826cf4896b792368c7b4d77573d0f8b": "install_project_crons function in entrypoints (window 4826cf48)",
|
||||
"4e564d3bbda0ef33962af6042736dc1e": "install_project_crons function in entrypoints (window 4e564d3b)",
|
||||
"5a3d92b22e5d5bca8cce17d581ac6803": "install_project_crons function in entrypoints (window 5a3d92b2)",
|
||||
"63c20c5a31cf5e08f3a901ddf6db98af": "install_project_crons function in entrypoints (window 63c20c5a)",
|
||||
"77547751325562fac397bbfd3a21c88e": "install_project_crons function in entrypoints (window 77547751)",
|
||||
"80bdff63e54b4a260043d264b83d8eb0": "install_project_crons function in entrypoints (window 80bdff63)",
|
||||
"84e55706393f731b293890dd6d830316": "install_project_crons function in entrypoints (window 84e55706)",
|
||||
"85f8a9d029ee9efecca73fd30449ccf4": "install_project_crons function in entrypoints (window 85f8a9d0)",
|
||||
"86e28dae676c905c5aa0035128e20e46": "install_project_crons function in entrypoints (window 86e28dae)",
|
||||
"a222b73bcd6a57adb2315726e81ab6cf": "install_project_crons function in entrypoints (window a222b73b)",
|
||||
"abd6c7efe66f533c48c883c2a6998886": "install_project_crons function in entrypoints (window abd6c7ef)",
|
||||
"bcfeb67ce4939181330afea4949a95cf": "install_project_crons function in entrypoints (window bcfeb67c)",
|
||||
"c1248c98f978c48e4a1e5009a1440917": "install_project_crons function in entrypoints (window c1248c98)",
|
||||
"c40571185b3306345ecf9ac33ab352a6": "install_project_crons function in entrypoints (window c4057118)",
|
||||
"c566639b237036a7a385982274d3d271": "install_project_crons function in entrypoints (window c566639b)",
|
||||
"d9cd2f3d874c32366d577ea0d334cd1a": "install_project_crons function in entrypoints (window d9cd2f3d)",
|
||||
"df4d3e905b12f2c68b206e45dddf9214": "install_project_crons function in entrypoints (window df4d3e90)",
|
||||
"e8e65ccf867fc6cbe49695ecdce2518e": "install_project_crons function in entrypoints (window e8e65ccf)",
|
||||
"eb8b298f06cda4359cc171206e0014bf": "install_project_crons function in entrypoints (window eb8b298f)",
|
||||
"ecdf0daa2f2845359a6a4aa12d327246": "install_project_crons function in entrypoints (window ecdf0daa)",
|
||||
"eeac93b2fba4de4589d36ca20845ec9f": "install_project_crons function in entrypoints (window eeac93b2)",
|
||||
"f08a7139db9c96cd3526549c499c0332": "install_project_crons function in entrypoints (window f08a7139)",
|
||||
"f0917809bdf28ff93fff0749e7e7fea0": "install_project_crons function in entrypoints (window f0917809)",
|
||||
"f0e4101f9b90c2fa921e088057a96db7": "install_project_crons function in entrypoints (window f0e4101f)",
|
||||
}
|
||||
|
||||
if not sh_files:
|
||||
|
|
|
|||
54
docker-compose.yml
Normal file
54
docker-compose.yml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
version: "3.8"
|
||||
|
||||
services:
|
||||
agents:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/agents/Dockerfile
|
||||
image: disinto/agents:latest
|
||||
container_name: disinto-agents
|
||||
volumes:
|
||||
- ./data/agents:/home/agent/data
|
||||
- ./disinto:/home/agent/disinto:ro
|
||||
- /usr/local/bin/claude:/usr/local/bin/claude:ro
|
||||
environment:
|
||||
- DISINTO_AGENTS=review,gardener
|
||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
|
||||
- FORGE_TOKEN=${FORGE_TOKEN:-}
|
||||
- FORGE_URL=http://forgejo:3000
|
||||
depends_on:
|
||||
- forgejo
|
||||
|
||||
agents-llama:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/agents/Dockerfile
|
||||
image: disinto/agents-llama:latest
|
||||
container_name: disinto-agents-llama
|
||||
volumes:
|
||||
- ./data/llama:/home/agent/data
|
||||
- ./disinto:/home/agent/disinto:ro
|
||||
- /usr/local/bin/claude:/usr/local/bin/claude:ro
|
||||
environment:
|
||||
- DISINTO_AGENTS=dev
|
||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
|
||||
- FORGE_TOKEN=${FORGE_TOKEN:-}
|
||||
- FORGE_URL=http://forgejo:3000
|
||||
- PROJECT_TOML=projects/disinto.toml
|
||||
- FORGE_REPO=johba/disinto
|
||||
depends_on:
|
||||
- forgejo
|
||||
|
||||
forgejo:
|
||||
image: codeberg.org/forgejo/forgejo:1
|
||||
container_name: disinto-forgejo
|
||||
volumes:
|
||||
- ./data/forgejo:/var/lib/forgejo
|
||||
environment:
|
||||
- FORGEJO__database__DB_TYPE=sqlite3
|
||||
- FORGEJO__service__REGISTER_EMAIL_CONFIRMATION=false
|
||||
- FORGEJO__service__ENABLE_NOTIFY_MAIL=false
|
||||
- FORGEJO__service__DISABLE_REGISTRATION=true
|
||||
- FORGEJO__service__REQUIRE_SIGNIN_VIEW=true
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
|
@ -33,6 +33,14 @@ install_project_crons() {
|
|||
local cron_lines="DISINTO_CONTAINER=1
|
||||
USER=agent
|
||||
FORGE_URL=http://forgejo:3000"
|
||||
|
||||
# Parse DISINTO_AGENTS env var (default: all agents)
|
||||
# Expected format: comma-separated list like "review,gardener" or "dev"
|
||||
local agents_to_run="review,dev,gardener"
|
||||
if [ -n "${DISINTO_AGENTS:-}" ]; then
|
||||
agents_to_run="$DISINTO_AGENTS"
|
||||
fi
|
||||
|
||||
for toml in "${DISINTO_DIR}"/projects/*.toml; do
|
||||
[ -f "$toml" ] || continue
|
||||
local pname
|
||||
|
|
@ -44,15 +52,30 @@ with open(sys.argv[1], 'rb') as f:
|
|||
|
||||
cron_lines="${cron_lines}
|
||||
PROJECT_REPO_ROOT=/home/agent/repos/${pname}
|
||||
# disinto: ${pname}
|
||||
2,7,12,17,22,27,32,37,42,47,52,57 * * * * ${DISINTO_DIR}/review/review-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1
|
||||
4,9,14,19,24,29,34,39,44,49,54,59 * * * * ${DISINTO_DIR}/dev/dev-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1
|
||||
# disinto: ${pname}"
|
||||
|
||||
# Add review-poll only if review agent is configured
|
||||
if echo "$agents_to_run" | grep -qw "review"; then
|
||||
cron_lines="${cron_lines}
|
||||
2,7,12,17,22,27,32,37,42,47,52,57 * * * * ${DISINTO_DIR}/review/review-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1"
|
||||
fi
|
||||
|
||||
# Add dev-poll only if dev agent is configured
|
||||
if echo "$agents_to_run" | grep -qw "dev"; then
|
||||
cron_lines="${cron_lines}
|
||||
4,9,14,19,24,29,34,39,44,49,54,59 * * * * ${DISINTO_DIR}/dev/dev-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1"
|
||||
fi
|
||||
|
||||
# Add gardener-run only if gardener agent is configured
|
||||
if echo "$agents_to_run" | grep -qw "gardener"; then
|
||||
cron_lines="${cron_lines}
|
||||
0 0,6,12,18 * * * cd ${DISINTO_DIR} && bash gardener/gardener-run.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$cron_lines" ]; then
|
||||
printf '%s\n' "$cron_lines" | crontab -u agent -
|
||||
log "Installed crontab for agent user"
|
||||
log "Installed crontab for agent user (agents: ${agents_to_run})"
|
||||
else
|
||||
log "No project TOMLs found — crontab empty"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ install_project_crons() {
|
|||
local cron_lines="DISINTO_CONTAINER=1
|
||||
USER=agent
|
||||
FORGE_URL=http://forgejo:3000"
|
||||
|
||||
# Parse DISINTO_AGENTS env var (default: all agents)
|
||||
# Expected format: comma-separated list like "review,gardener" or "dev"
|
||||
local agents_to_run="review,dev,gardener"
|
||||
if [ -n "${DISINTO_AGENTS:-}" ]; then
|
||||
agents_to_run="$DISINTO_AGENTS"
|
||||
fi
|
||||
|
||||
for toml in "${DISINTO_DIR}"/projects/*.toml; do
|
||||
[ -f "$toml" ] || continue
|
||||
local pname
|
||||
|
|
@ -32,15 +40,30 @@ with open(sys.argv[1], 'rb') as f:
|
|||
|
||||
cron_lines="${cron_lines}
|
||||
PROJECT_REPO_ROOT=/home/agent/repos/${pname}
|
||||
# disinto: ${pname}
|
||||
2,7,12,17,22,27,32,37,42,47,52,57 * * * * ${DISINTO_DIR}/review/review-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1
|
||||
4,9,14,19,24,29,34,39,44,49,54,59 * * * * ${DISINTO_DIR}/dev/dev-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1
|
||||
# disinto: ${pname}"
|
||||
|
||||
# Add review-poll only if review agent is configured
|
||||
if echo "$agents_to_run" | grep -qw "review"; then
|
||||
cron_lines="${cron_lines}
|
||||
2,7,12,17,22,27,32,37,42,47,52,57 * * * * ${DISINTO_DIR}/review/review-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1"
|
||||
fi
|
||||
|
||||
# Add dev-poll only if dev agent is configured
|
||||
if echo "$agents_to_run" | grep -qw "dev"; then
|
||||
cron_lines="${cron_lines}
|
||||
4,9,14,19,24,29,34,39,44,49,54,59 * * * * ${DISINTO_DIR}/dev/dev-poll.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1"
|
||||
fi
|
||||
|
||||
# Add gardener-run only if gardener agent is configured
|
||||
if echo "$agents_to_run" | grep -qw "gardener"; then
|
||||
cron_lines="${cron_lines}
|
||||
0 0,6,12,18 * * * cd ${DISINTO_DIR} && bash gardener/gardener-run.sh ${toml} >>/home/agent/data/logs/cron.log 2>&1"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$cron_lines" ]; then
|
||||
printf '%s\n' "$cron_lines" | crontab -u agent -
|
||||
log "Installed crontab for agent user"
|
||||
log "Installed crontab for agent user (agents: ${agents_to_run})"
|
||||
else
|
||||
log "No project TOMLs found — crontab empty"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue