Skip to content

Commit

Permalink
more optional datadog
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Apr 5, 2024
1 parent ca97716 commit d6edaa8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mpcontribs-api/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sleep $zzz
pmgrc=$HOME/.pmgrc.yaml
[[ ! -e $pmgrc ]] && echo "PMG_DUMMY_VAR: dummy" >$pmgrc

CMD="gunicorn \"mpcontribs.api:create_app()\""
CMD='gunicorn mpcontribs.api:create_app()'

if [[ -n "$DD_TRACE_HOST" ]]; then
wait-for-it.sh $DD_TRACE_HOST -q -s -t 10 && CMD="ddtrace-run $CMD"
Expand Down
20 changes: 14 additions & 6 deletions mpcontribs-portal/start.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
#!/bin/bash

zzz=$(($DEPLOYMENT*60))
set -e
zzz=$(($DEPLOYMENT * 60))
echo "$SUPERVISOR_PROCESS_NAME: waiting for $zzz seconds before start..."
sleep $zzz

if [ ! -z "$METADATA_URI" ]; then
task_ip=`curl ${METADATA_URI}/task | jq -r '.Containers[0].Networks[0].IPv4Addresses[0]'`
export MPCONTRIBS_CLIENT_HOST=$task_ip:$MPCONTRIBS_API_PORT
task_ip=$(curl ${METADATA_URI}/task | jq -r '.Containers[0].Networks[0].IPv4Addresses[0]')
export MPCONTRIBS_CLIENT_HOST=$task_ip:$MPCONTRIBS_API_PORT
else
export MPCONTRIBS_CLIENT_HOST=$MPCONTRIBS_API_HOST
export MPCONTRIBS_CLIENT_HOST=$MPCONTRIBS_API_HOST
fi

pmgrc=$HOME/.pmgrc.yaml
[[ ! -e $pmgrc ]] && echo "PMG_DUMMY_VAR: dummy" > $pmgrc
[[ ! -e $pmgrc ]] && echo "PMG_DUMMY_VAR: dummy" >$pmgrc
python manage.py migrate --noinput
exec wait-for-it.sh $MPCONTRIBS_API_HOST -q -s -t 60 -- ddtrace-run gunicorn wsgi

CMD="gunicorn wsgi"

if [[ -n "$DD_TRACE_HOST" ]]; then
wait-for-it.sh $DD_TRACE_HOST -q -s -t 10 && CMD="ddtrace-run $CMD"
fi

exec wait-for-it.sh $MPCONTRIBS_API_HOST -q -s -t 60 -- $CMD

0 comments on commit d6edaa8

Please sign in to comment.