A single container image with: - neo4j-browser built from source and served on :7474 - PostgreSQL with Apache AGE (based on apache/age) - a Python bridge speaking Bolt 4.4/5.0-5.4 over TCP and WebSocket on :7687 that runs Cypher through AGE's cypher() function, emulates the Neo4j procedures neo4j-browser relies on, and maps databases to AGE graphs Includes workarounds for AGE limitations (parameters are inlined as literals, `id(x) IN [...]` and the browser's expand-node query are rewritten) and an end-to-end smoke test using the Neo4j Python driver. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
768 B
Bash
Executable File
32 lines
768 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Runs PostgreSQL (through the stock postgres entrypoint) and the peo4c bridge
|
|
# side by side, and stops the container when either of them exits.
|
|
set -euo pipefail
|
|
|
|
if [ "${1:-}" != "postgres" ]; then
|
|
exec docker-entrypoint.sh "$@"
|
|
fi
|
|
|
|
export PEO4C_PG_DATABASE="${PEO4C_PG_DATABASE:-${POSTGRES_DB:-${POSTGRES_USER:-postgres}}}"
|
|
|
|
docker-entrypoint.sh "$@" &
|
|
pg_pid=$!
|
|
|
|
cd /opt/peo4c/bridge
|
|
gosu postgres python3 -m peo4c &
|
|
bridge_pid=$!
|
|
|
|
shutdown() {
|
|
kill -TERM "$bridge_pid" 2>/dev/null || true
|
|
kill -TERM "$pg_pid" 2>/dev/null || true
|
|
}
|
|
trap shutdown TERM INT
|
|
|
|
# Wait until one of the two processes exits, then stop the other one too.
|
|
set +e
|
|
wait -n "$pg_pid" "$bridge_pid"
|
|
status=$?
|
|
shutdown
|
|
wait "$pg_pid" 2>/dev/null
|
|
exit "$status"
|