Spaces:
Running
Running
| set -euo pipefail | |
| DUMP_REPO="${NEO4J_DUMP_REPO:-cnil/genmod-dump-neo4j}" | |
| DUMP_REVISION="${NEO4J_DUMP_REVISION:-main}" | |
| DUMP_BASE_URL="https://huggingface.co/datasets/${DUMP_REPO}/resolve/${DUMP_REVISION}" | |
| AUTH_HEADER="Authorization: Bearer ${HF_TOKEN}" | |
| # Load the database backup. Metadata is optional for compatibility with the | |
| # original dump; the application then falls back to its historical date. | |
| wget --header="${AUTH_HEADER}" "${DUMP_BASE_URL}/system.dump" -O /backups/system.dump | |
| wget --header="${AUTH_HEADER}" "${DUMP_BASE_URL}/neo4j.dump" -O /backups/neo4j.dump | |
| if ! wget --header="${AUTH_HEADER}" "${DUMP_BASE_URL}/database_metadata.json" \ | |
| -O /backups/database_metadata.json; then | |
| rm -f /backups/database_metadata.json | |
| fi | |
| neo4j-admin database load --expand-commands system --from-path=/backups --overwrite-destination=true | |
| neo4j-admin database load --expand-commands neo4j --from-path=/backups --overwrite-destination=true | |
| # start database | |
| /startup/docker-entrypoint.sh neo4j & | |
| # start tool | |
| python3 /application_neo4j/app.py neo4j genealogiemodeles & | |
| # wait for any process to exit | |
| wait -n | |
| # exit with status of process that exited first | |
| exit $? | |