-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·46 lines (38 loc) · 1.37 KB
/
entrypoint.sh
File metadata and controls
executable file
·46 lines (38 loc) · 1.37 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
#!/bin/bash
echo "[$(date)] Starting entrypoint script"
# Add public keys to authorized_keys
echo "[$(date)] Checking for PUBLIC_KEY environment variable"
if [ -n "$PUBLIC_KEY" ]; then
echo "[$(date)] Setting up SSH public key"
mkdir -p /root/.ssh
echo "$PUBLIC_KEY" > /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
echo "[$(date)] SSH public key setup completed"
else
echo "[$(date)] No PUBLIC_KEY provided, skipping SSH key setup"
fi
# Login to huggingface
echo "[$(date)] Attempting to login to Hugging Face"
python3 openweights/worker/services/hf_login.py
echo "[$(date)] Hugging Face login completed"
# Generate SSH host keys and start SSH service
echo "[$(date)] Setting up SSH service"
ssh-keygen -A
service ssh start
echo "[$(date)] SSH service started"
# Start background services
echo "[$(date)] Starting HTTP log server on port 10101"
mkdir logs
python3 openweights/worker/services/log_server.py &
# Start TTL monitoring service
echo "[$(date)] Starting TTL monitoring service"
python3 openweights/worker/services/ttl_monitor.py &
echo "[$(date)] All services started"
# Execute the main application or run in dev mode
if [ "$OW_DEV" = "true" ]; then
echo "[$(date)] Starting in development mode"
exec tail -f /dev/null
else
echo "[$(date)] Starting worker process"
exec ow worker > >(tee logs/main) 2> >(tee -a logs/main >&2)
fi