fix: move setup_matrix after compose up, use Python for .env writes
- Critical: setup_matrix now runs after docker compose up -d so Dendrite is actually running when provisioning is attempted - Minor: replace sed with Python for .env credential writes to avoid delimiter collisions with opaque Matrix access tokens - Info: update matrix_listener.sh header to mention container mode Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b86edd7e5d
commit
a0cdf87a21
2 changed files with 13 additions and 5 deletions
15
bin/disinto
15
bin/disinto
|
|
@ -1032,7 +1032,14 @@ setup_matrix() {
|
||||||
for var_line in "${matrix_vars[@]}"; do
|
for var_line in "${matrix_vars[@]}"; do
|
||||||
local var_name="${var_line%%=*}"
|
local var_name="${var_line%%=*}"
|
||||||
if grep -q "^${var_name}=" "$env_file" 2>/dev/null; then
|
if grep -q "^${var_name}=" "$env_file" 2>/dev/null; then
|
||||||
sed -i "s|^${var_name}=.*|${var_line}|" "$env_file"
|
# Use Python to avoid sed delimiter collisions with opaque tokens
|
||||||
|
python3 -c "
|
||||||
|
import sys, re, pathlib
|
||||||
|
p = pathlib.Path(sys.argv[1])
|
||||||
|
text = p.read_text()
|
||||||
|
text = re.sub(r'^' + re.escape(sys.argv[2]) + r'=.*$', sys.argv[3], text, flags=re.MULTILINE)
|
||||||
|
p.write_text(text)
|
||||||
|
" "$env_file" "$var_name" "$var_line"
|
||||||
else
|
else
|
||||||
printf '%s\n' "$var_line" >> "$env_file"
|
printf '%s\n' "$var_line" >> "$env_file"
|
||||||
fi
|
fi
|
||||||
|
|
@ -1216,9 +1223,6 @@ p.write_text(text)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Provision Matrix homeserver (compose mode only)
|
|
||||||
setup_matrix
|
|
||||||
|
|
||||||
# Create labels on remote
|
# Create labels on remote
|
||||||
create_labels "$forge_repo" "$forge_url"
|
create_labels "$forge_repo" "$forge_url"
|
||||||
|
|
||||||
|
|
@ -1255,6 +1259,9 @@ p.write_text(text)
|
||||||
echo "── Starting full stack ────────────────────────────────"
|
echo "── Starting full stack ────────────────────────────────"
|
||||||
docker compose -f "${FACTORY_ROOT}/docker-compose.yml" up -d
|
docker compose -f "${FACTORY_ROOT}/docker-compose.yml" up -d
|
||||||
echo "Stack: running (forgejo + woodpecker + dendrite + agents)"
|
echo "Stack: running (forgejo + woodpecker + dendrite + agents)"
|
||||||
|
|
||||||
|
# Provision Matrix now that Dendrite is running
|
||||||
|
setup_matrix
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@
|
||||||
# Thread reply to [vault] message → APPROVE/REJECT dispatched via vault-fire/vault-reject
|
# Thread reply to [vault] message → APPROVE/REJECT dispatched via vault-fire/vault-reject
|
||||||
# Thread reply to [action] message → injected into action tmux session
|
# Thread reply to [action] message → injected into action tmux session
|
||||||
#
|
#
|
||||||
# Run as systemd service (see matrix_listener.service) or manually:
|
# In compose mode, started by docker/agents/entrypoint.sh as a background process.
|
||||||
|
# On bare metal, run as systemd service (see matrix_listener.service) or manually:
|
||||||
# ./matrix_listener.sh
|
# ./matrix_listener.sh
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue