-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.sh
56 lines (47 loc) · 1.5 KB
/
run.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
52
53
54
55
56
#!/bin/bash
# Define the expected file paths
TOKEN_FILE="./token.st"
PASSPHRASE_FILE="./token.passphrase"
KEYPAIR_FILE="./token.priv"
echo "Starting synthclient:"
echo "====================="
# Check if the required files exist
if [[ ! -f "$TOKEN_FILE" ]]; then
echo "Error: $TOKEN_FILE does not exist."
exit 1
fi
if [[ ! -f "$PASSPHRASE_FILE" ]]; then
echo "Error: $PASSPHRASE_FILE does not exist."
exit 1
fi
if [[ ! -f "$KEYPAIR_FILE" ]]; then
echo "Error: $KEYPAIR_FILE does not exist."
exit 1
fi
docker run --name synthclient \
--env SECUREDNA_SYNTHCLIENT_TOKEN_FILE="/certs/token.st" \
--env SECUREDNA_SYNTHCLIENT_KEYPAIR_FILE="/certs/token.priv" \
--env SECUREDNA_SYNTHCLIENT_KEYPAIR_PASSPHRASE_FILE="/certs/token.passphrase" \
--volume ./:/certs/:z \
--detach \
-p 80:80 \
ghcr.io/securedna/synthclient \
./synthclient
# Get container status
container_status=$(docker inspect --format '{{.State.Status}}' synthclient)
container_id=$(docker inspect --format '{{.Id}}' synthclient)
# Check if the status contains "running"
if [[ $container_status == "running" ]]; then
echo "Successful start"
echo "Please visit"
gh codespace ports visibility 80:public -c $CODESPACE_NAME
echo "https://pages.securedna.org/web-interface/?api=https://${CODESPACE_NAME}-80.app.github.dev"
echo "Enjoy!"
else
echo "Failed to start. Showing logs:"
echo "=============================="
docker logs synthclient
echo "=============================="
echo "Removing unused container"
docker rm $container_id
fi