-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstartup.sh
More file actions
34 lines (30 loc) · 1.12 KB
/
Copy pathstartup.sh
File metadata and controls
34 lines (30 loc) · 1.12 KB
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
#!/bin/bash
set -ex
cd /app
if [ "$USE_DOCKER_SECRETS" == "true" ]; then
# Hide commands from being printed to console for a moment
set +x
echo "Overwriting environment variables with Docker secrets"
export SYNAPSE_ADMIN_ACCESS_TOKEN=$(cat /var/run/secrets/synapse_admin_access_token)
set -x
fi
# We run migrations on the CRON and CURATOR workers to ensure everything is set up. We
# don't run the migrations on matchers or hashers because they're meant to be readonly.
# Both CRON and CURATOR workers are targeted to ensure migrations *definitely* run. The
# UI worker is "readonly" by this script, but is a read+write worker.
should_run_migrations=false
# Split CSV list
IFS=',' read -ra worker_roles <<< "$HMA_WORKER_ROLE"
for role in "${worker_roles[@]}"; do
if [ "$role" == "CRON" ] || [ "$role" == "CURATOR" ]; then
should_run_migrations=true
break
fi
done
if [ "$should_run_migrations" == "true" ]; then
./scripts/db-migrate.sh
else
echo "Skipping migrations - readonly or UI role"
fi
# Now we can run the actual app (copied from upstream CMD)
gunicorn --bind 0.0.0.0:5100 "OpenMediaMatch.app:create_app()"