-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathgraphistry-service-account.sh
More file actions
executable file
·32 lines (26 loc) · 1.21 KB
/
graphistry-service-account.sh
File metadata and controls
executable file
·32 lines (26 loc) · 1.21 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
#!/bin/bash
set -e
SCRIPT="Get AWS Instance ID"
./hello-start.sh "$SCRIPT"
### Graphistry should already add admin / <i-instanceid> on boot
( \
cd "${GRAPHISTRY_HOME}" \
&& ( \
until ( curl -fsS http://localhost/streamgl-gpu/secondary/gpu/health > /dev/null ); \
do ( docker compose ps && sleep 1 ); \
done \
)
)
## Service account
export SERVICE_USER=graphappkit
export SERVICE_PASS="${INSTANCE_ID}_${RANDOM}"
ADD_USER_SCRIPT="from nexus.users.models import User; user=User.objects.create_superuser(username='${SERVICE_USER}', email='root@amazon.com', password='${SERVICE_PASS}', name='${SERVICE_USER}', is_active=True); print('made service account ${SERVICE_USER}')"
VERIFY_USER_SCRIPT="from allauth.account.models import EmailAddress; e = EmailAddress.objects.create(user=user, email='root@amazon.com', primary=True, verified=True); e.save(); print('verified user')"
POST_SCRIPT="CELERY_BROKER_URL=zz python manage.py shell && echo done || { echo fail && exit 1; }"
( \
cd "${GRAPHISTRY_HOME}" \
&& docker compose exec -T nexus \
bash -c \
"source activate rapids && echo \"${ADD_USER_SCRIPT}; ${VERIFY_USER_SCRIPT}\" | ${POST_SCRIPT}" \
)
./hello-end.sh "$SCRIPT"