-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·51 lines (42 loc) · 1.27 KB
/
start.sh
File metadata and controls
executable file
·51 lines (42 loc) · 1.27 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -ex
missing_vars=()
required_env_vars=(
"CONTEXT_PATH"
"URL"
"SITE_NAME"
"INSTANCE_PASSWORD"
)
for var in "${required_env_vars[@]}"; do
if [ -z "${!var}" ]; then
missing_vars+=("$var")
fi
done
if [ "${#missing_vars[@]}" -ne 0 ]; then
echo "❌ Error: The following required environment variables are not set:"
for var in "${missing_vars[@]}"; do
echo " - $var"
done
exit 1
fi
mkdir -p ${CONTEXT_PATH}/certs && chmod 777 ${CONTEXT_PATH}/certs
docker compose down -v --remove-orphans
# We need to do this separately (using -d) so that testbench exits with the correct code
# and we're not waiting on services that are long running
docker compose up -d tunnel mailserver || (docker compose logs && exit 1)
# docker compose wait tunnel - `docker wait tunnel` doesn't work for some reason.
# Because it doesn't work, I removed the healthcheck from docker-compose.yml.
max_attempts=10
attempt=1
until curl -sf http://localhost:4300/urls >/dev/null; do
if [ $attempt -ge $max_attempts ]; then
echo "Tunnel error"
docker compose logs
exit 1
fi
sleep 1
attempt=$((attempt + 1))
done
# We're good to go once tunnels are ready because the tunnels service
# won't start until the other services are ready.
docker compose run --rm testbench