fix: fix: Dendrite crash-loops — missing dendrite.yaml config file (#681)
Remove Dendrite from the default docker-compose.yml generated by `disinto init`. Most deployments don't need Matrix, so Dendrite is now opt-in via the `--matrix` flag. When `--matrix` is passed: - A minimal dendrite.yaml is generated at docker/dendrite/dendrite.yaml - The Dendrite service is appended to docker-compose.yml with the config file bind-mounted - setup_matrix() provisions the bot user and coordination room Without `--matrix`, no Dendrite container is started and fresh inits no longer crash-loop. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2d285f9619
commit
07616df8a5
1 changed files with 78 additions and 19 deletions
97
bin/disinto
97
bin/disinto
|
|
@ -155,7 +155,8 @@ generate_compose() {
|
|||
|
||||
cat > "$compose_file" <<'COMPOSEEOF'
|
||||
# docker-compose.yml — generated by disinto init
|
||||
# Brings up Forgejo, Woodpecker, Dendrite (Matrix), and the agent runtime.
|
||||
# Brings up Forgejo, Woodpecker, and the agent runtime.
|
||||
# Dendrite (Matrix) is added only when init is called with --matrix.
|
||||
|
||||
services:
|
||||
forgejo:
|
||||
|
|
@ -213,16 +214,6 @@ services:
|
|||
networks:
|
||||
- disinto-net
|
||||
|
||||
dendrite:
|
||||
image: matrixdotorg/dendrite-monolith:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- dendrite-data:/etc/dendrite
|
||||
environment:
|
||||
DENDRITE_DOMAIN: disinto.local
|
||||
networks:
|
||||
- disinto-net
|
||||
|
||||
agents:
|
||||
build: ./docker/agents
|
||||
restart: unless-stopped
|
||||
|
|
@ -238,21 +229,18 @@ services:
|
|||
environment:
|
||||
FORGE_URL: http://forgejo:3000
|
||||
WOODPECKER_SERVER: http://woodpecker:8000
|
||||
MATRIX_HOMESERVER: http://dendrite:8008
|
||||
DISINTO_CONTAINER: "1"
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
- forgejo
|
||||
- woodpecker
|
||||
- dendrite
|
||||
networks:
|
||||
- disinto-net
|
||||
|
||||
volumes:
|
||||
forgejo-data:
|
||||
woodpecker-data:
|
||||
dendrite-data:
|
||||
agent-data:
|
||||
project-repos:
|
||||
|
||||
|
|
@ -284,6 +272,70 @@ COMPOSEEOF
|
|||
echo "Created: ${compose_file}"
|
||||
}
|
||||
|
||||
# Append Dendrite (Matrix) service to docker-compose.yml and generate config.
|
||||
# Called only when --matrix flag is passed to init.
|
||||
append_dendrite_compose() {
|
||||
local compose_file="${FACTORY_ROOT}/docker-compose.yml"
|
||||
local dendrite_config_dir="${FACTORY_ROOT}/docker/dendrite"
|
||||
local dendrite_yaml="${dendrite_config_dir}/dendrite.yaml"
|
||||
|
||||
mkdir -p "$dendrite_config_dir"
|
||||
|
||||
# Generate a minimal dendrite.yaml
|
||||
cat > "$dendrite_yaml" <<'DENDRITECFG'
|
||||
# dendrite.yaml — generated by disinto init --matrix
|
||||
version: 2
|
||||
global:
|
||||
server_name: disinto.local
|
||||
private_key: matrix_key.pem
|
||||
database:
|
||||
connection_string: file:dendrite.db
|
||||
cache:
|
||||
max_size_estimated: 512mb
|
||||
jetstream:
|
||||
storage_path: /etc/dendrite/jetstream
|
||||
client_api:
|
||||
registration_disabled: true
|
||||
DENDRITECFG
|
||||
echo "Created: ${dendrite_yaml}"
|
||||
|
||||
# Append dendrite service before the volumes: section
|
||||
python3 -c "
|
||||
import sys, pathlib
|
||||
p = pathlib.Path(sys.argv[1])
|
||||
text = p.read_text()
|
||||
dendrite_service = '''
|
||||
dendrite:
|
||||
image: matrixdotorg/dendrite-monolith:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- dendrite-data:/etc/dendrite
|
||||
- ./docker/dendrite/dendrite.yaml:/etc/dendrite/dendrite.yaml:ro
|
||||
environment:
|
||||
DENDRITE_DOMAIN: disinto.local
|
||||
networks:
|
||||
- disinto-net
|
||||
'''
|
||||
# Insert dendrite service before 'volumes:' line
|
||||
text = text.replace('\nvolumes:\n', dendrite_service + '\nvolumes:\n', 1)
|
||||
# Add dendrite-data volume
|
||||
text = text.replace(' agent-data:', ' dendrite-data:\n agent-data:')
|
||||
# Add MATRIX_HOMESERVER env var to agents service
|
||||
text = text.replace(
|
||||
' DISINTO_CONTAINER: \"1\"',
|
||||
' MATRIX_HOMESERVER: http://dendrite:8008\n DISINTO_CONTAINER: \"1\"'
|
||||
)
|
||||
# Add dendrite dependency to agents service
|
||||
text = text.replace(
|
||||
' - woodpecker\n networks:',
|
||||
' - woodpecker\n - dendrite\n networks:'
|
||||
)
|
||||
p.write_text(text)
|
||||
" "$compose_file"
|
||||
|
||||
echo "Updated: ${compose_file} (added Dendrite service)"
|
||||
}
|
||||
|
||||
# Generate docker/agents/ files if they don't already exist.
|
||||
generate_agent_docker() {
|
||||
local docker_dir="${FACTORY_ROOT}/docker/agents"
|
||||
|
|
@ -1162,7 +1214,7 @@ disinto_init() {
|
|||
shift
|
||||
|
||||
# Parse flags
|
||||
local branch="" repo_root="" ci_id="0" auto_yes=false forge_url_flag="" bare=false
|
||||
local branch="" repo_root="" ci_id="0" auto_yes=false forge_url_flag="" bare=false enable_matrix=false
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--branch) branch="$2"; shift 2 ;;
|
||||
|
|
@ -1170,6 +1222,7 @@ disinto_init() {
|
|||
--ci-id) ci_id="$2"; shift 2 ;;
|
||||
--forge-url) forge_url_flag="$2"; shift 2 ;;
|
||||
--bare) bare=true; shift ;;
|
||||
--matrix) enable_matrix=true; shift ;;
|
||||
--yes) auto_yes=true; shift ;;
|
||||
*) echo "Unknown option: $1" >&2; exit 1 ;;
|
||||
esac
|
||||
|
|
@ -1253,6 +1306,9 @@ p.write_text(text)
|
|||
forge_port=$(printf '%s' "$forge_url" | sed -E 's|.*:([0-9]+)/?$|\1|')
|
||||
forge_port="${forge_port:-3000}"
|
||||
generate_compose "$forge_port"
|
||||
if [ "$enable_matrix" = true ]; then
|
||||
append_dendrite_compose
|
||||
fi
|
||||
generate_agent_docker
|
||||
fi
|
||||
|
||||
|
|
@ -1344,10 +1400,13 @@ p.write_text(text)
|
|||
echo ""
|
||||
echo "── Starting full stack ────────────────────────────────"
|
||||
docker compose -f "${FACTORY_ROOT}/docker-compose.yml" up -d
|
||||
echo "Stack: running (forgejo + woodpecker + dendrite + agents)"
|
||||
|
||||
# Provision Matrix now that Dendrite is running
|
||||
setup_matrix
|
||||
if [ "$enable_matrix" = true ]; then
|
||||
echo "Stack: running (forgejo + woodpecker + dendrite + agents)"
|
||||
# Provision Matrix now that Dendrite is running
|
||||
setup_matrix
|
||||
else
|
||||
echo "Stack: running (forgejo + woodpecker + agents)"
|
||||
fi
|
||||
|
||||
# Activate repo in Woodpecker now that stack is running
|
||||
activate_woodpecker_repo "$forge_repo"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue