-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorigin.sh
More file actions
executable file
·83 lines (73 loc) · 2.15 KB
/
origin.sh
File metadata and controls
executable file
·83 lines (73 loc) · 2.15 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# Origin OS - Secure Docker Launcher
# Decrypts .env, starts containers, then re-encrypts
SCRIPT_DIR="$HOME"
ENV_FILE="$SCRIPT_DIR/.env"
ENCRYPTED_FILE="$SCRIPT_DIR/.env.encrypted"
start() {
echo "=============================================="
echo "🚀 ORIGIN OS - SECURE START"
echo "=============================================="
# Check if encrypted
if [ -f "$ENCRYPTED_FILE" ] && [ ! -f "$ENV_FILE" ]; then
echo "🔓 Decrypting credentials..."
openssl enc -aes-256-cbc -d -pbkdf2 -in "$ENCRYPTED_FILE" -out "$ENV_FILE"
if [ $? -ne 0 ]; then
echo "❌ Wrong password"
exit 1
fi
chmod 600 "$ENV_FILE"
fi
# Start containers
echo "🐳 Starting containers..."
cd "$SCRIPT_DIR"
docker compose up -d
echo ""
echo "✅ Origin OS started!"
echo ""
echo "Services:"
echo " • UI: http://localhost:8000"
echo " • Codex: http://localhost:8001"
echo " • MCP: http://localhost:8002"
echo " • Supreme: http://localhost:8080"
}
stop() {
echo "=============================================="
echo "🛑 ORIGIN OS - SECURE STOP"
echo "=============================================="
# Stop containers
echo "🐳 Stopping containers..."
cd "$SCRIPT_DIR"
docker compose down
# Re-encrypt .env
if [ -f "$ENV_FILE" ]; then
echo ""
echo "🔒 Re-encrypting credentials..."
read -p "Encrypt .env? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
openssl enc -aes-256-cbc -salt -pbkdf2 -in "$ENV_FILE" -out "$ENCRYPTED_FILE"
if [ $? -eq 0 ]; then
shred -u "$ENV_FILE" 2>/dev/null || rm -P "$ENV_FILE" 2>/dev/null || rm "$ENV_FILE"
echo "✅ Credentials encrypted"
fi
fi
fi
echo ""
echo "✅ Origin OS stopped"
}
case "${1:-start}" in
start|up)
start
;;
stop|down)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: ./origin.sh [start|stop|restart]"
;;
esac