-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
51 lines (43 loc) · 1.28 KB
/
docker-entrypoint.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
44
45
46
47
48
49
50
51
#!/bin/bash
echo "Reading secrets..."
read -d $'\x04' AWS_ACCESS_KEY < "/run/secrets/aws_access_key"
read -d $'\x04' AWS_SECRET_ACCESS_KEY < "/run/secrets/aws_secret_access_key"
echo "Done"
mkdir ~/.aws
cat > ~/.aws/credentials << EOF
[default]
aws_access_key_id = $AWS_ACCESS_KEY
aws_secret_access_key = $AWS_SECRET_ACCESS_KEY
EOF
cat > ~/.aws/config << EOF
[default]
region = us-east-2
EOF
# Hack to prevent ssh from trying to check host keys when the
# datomic SOCKS script runs. I think this is okay. Note the option
# 'AddressFamily inet' prevents ssh from trying to use ipv6 to connect
# which was prevening binding or some reason.
mkdir /root/.ssh
cat > /root/.ssh/config << EOF
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
AddressFamily inet
EOF
echo "Starting Datomic SOCKS proxy..."
./datomic-socks-proxy -p default $DATOMIC_CLOUD_STACK_NAME &
echo "Waiting for SOCKS proxy..."
while true
do
STATUS=$(curl -s -o /dev/null -w '%{http_code}' -x socks5h://localhost:8182 http://entry.datemo.us-east-2.datomic.net:8182/)
if [ $STATUS -eq 200 ]; then
echo "Datomic SOCKS Proxy ready!"
break
else
echo "Got $STATUS :( Not ready yet..."
echo $OUTPUT
fi
sleep 10
done
echo "Starting datemo..."
java -Ddb-name="production" -jar datemo-0.2-standalone.jar