-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·34 lines (29 loc) · 1.18 KB
/
entrypoint.sh
File metadata and controls
executable file
·34 lines (29 loc) · 1.18 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
#!/bin/bash
set -e
# ----------------------------------------------------------
# Arranca el daemon de Tailscale
# ----------------------------------------------------------
tailscaled &
# ----------------------------------------------------------
# Espera unos segundos a que tailscaled esté listo
# ----------------------------------------------------------
sleep 2
# ----------------------------------------------------------
# Conecta a la Tailnet usando la API Key y hostname parametrizable
# ----------------------------------------------------------
TAILSCALE_HOSTNAME="${TS_HOSTNAME:-server-tailscale}"
tailscale up --authkey="${TS_AUTHKEY}" --hostname="$TAILSCALE_HOSTNAME"
# Si quieres esperar a que los servicios estén disponibles,
# define opcionalmente un array de host:puerto
for hp in $WAIT_FOR; do
host=$(echo $hp | cut -d':' -f1)
port=$(echo $hp | cut -d':' -f2)
while ! nc -z "$host" "$port"; do
echo "Esperando a que $host:$port esté listo..."
sleep 2
done
done
# ----------------------------------------------------------
# Lanza socat usando la variable completa
# ----------------------------------------------------------
exec socat $SOCAT_CMD