-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-services.sh
executable file
·43 lines (34 loc) · 1.1 KB
/
start-services.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#setup env
echo "Loading environment variables from /cityflow_platform/.env..."
set -a
source /cityflow_platform/.env
set +a
# if no cityflow runner image, pull latest cityflow_runner
if ! docker images --format '{{.Repository}}:{{.Tag}}' | grep -q '^ghcr.io/kekehurry/cityflow_runner:'; then
echo "Image cityflow_runner not found, pulling latest..."
docker pull ghcr.io/kekehurry/cityflow_runner:latest
else
echo "Image cityflow_runner found, skipping pull."
fi
/startup/docker-entrypoint.sh neo4j &
# Wait for Neo4j to be ready
until curl -s http://localhost:7474 > /dev/null; do
echo "Waiting for Neo4j to start..."
sleep 2
done
# cd workdir
cd /cityflow_platform
# Initialize database
if [ "$INIT_DATABASE" ]; then
python3 ./cityflow_database/init_db.py
fi
# Start services
cd /cityflow_platform/cityflow_database && python3 server.py &
cd /cityflow_platform/cityflow_executor && python3 server.py &
cd /cityflow_platform/cityflow_workstation && node server.js &
cd /cityflow_platform/
# Wait for any process to exit
wait -n
# Exit with status of process that exited first
exit $?