Skip to content

Commit 16bea18

Browse files
committed
update
1 parent 015e158 commit 16bea18

File tree

2 files changed

+151
-0
lines changed

2 files changed

+151
-0
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
# KernelSwarm
22

3+
## Lightouse details
34

5+
Right now the Lighthouse is running on Digital Ocean on a $4/month droplet. If you'd like to be added please let us know and share your public ssh key.
6+
7+
The lighthouse is primarily responsible for keeping track of all nodes in the swarm.
8+
9+
10+
## How to join the swarm
11+
12+
Idea of the setup is that a user
13+
1. Click some button to get a client
14+
2. We share the client with them
15+
3. They run the client and it connects them to the swarm
16+
17+
18+
## High level infra details
19+
1. Lighthouse on Digital Ocean
20+
2. Nebula VPN for swarm communication
21+
3. Clients in shell scripts but soon should be docker containers
22+
4. A fault tolerant PyTorch job that is responsible for the actual training
23+
5. Share results in some public dashboard
424

525
## TBD
626

create-client.sh

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/bin/bash
2+
# Usage: ./create-client.sh username device_number
3+
4+
if [ "$#" -ne 2 ]; then
5+
echo "Usage: $0 <username> <device_number>"
6+
echo "Example: $0 john 1"
7+
exit 1
8+
fi
9+
10+
USERNAME=$1
11+
DEVICE_NUM=$2
12+
IP="192.168.100.$((DEVICE_NUM + 10))"
13+
14+
# Install zip if needed
15+
apt-get update -qq && apt-get install -y zip -qq
16+
17+
# Create certificate
18+
cd /etc/nebula
19+
nebula-cert sign -name "${USERNAME}-device${DEVICE_NUM}" -ip "${IP}/24" -groups "users"
20+
21+
# Create client directory
22+
rm -rf /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}
23+
mkdir -p /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}
24+
25+
# Copy files
26+
cp ca.crt /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/
27+
cp ${USERNAME}-device${DEVICE_NUM}.crt /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/host.crt
28+
cp ${USERNAME}-device${DEVICE_NUM}.key /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/host.key
29+
30+
# Create config file
31+
cat > /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/config.yml << EOCFG
32+
pki:
33+
ca: ./ca.crt
34+
cert: ./host.crt
35+
key: ./host.key
36+
static_host_map:
37+
"192.168.100.1": ["24.144.80.90:4242"]
38+
lighthouse:
39+
am_lighthouse: false
40+
interval: 60
41+
hosts:
42+
- "192.168.100.1"
43+
listen:
44+
host: 0.0.0.0
45+
port: 4242
46+
punchy:
47+
punch: true
48+
tun:
49+
dev: nebula1
50+
drop_local_broadcast: false
51+
drop_multicast: false
52+
tx_queue: 500
53+
mtu: 1300
54+
logging:
55+
level: info
56+
format: text
57+
firewall:
58+
outbound:
59+
- port: any
60+
proto: any
61+
host: any
62+
inbound:
63+
- port: any
64+
proto: any
65+
host: any
66+
EOCFG
67+
68+
# Create readme file with instructions
69+
cat > /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/README.txt << EOREADME
70+
=== NEBULA CLIENT SETUP INSTRUCTIONS ===
71+
1. Download and install Nebula for your OS:
72+
https://github.com/slackhq/nebula/releases
73+
2. Place the Nebula binary in the same folder as these files
74+
3. Run Nebula (as administrator/root):
75+
- Windows: Right-click cmd.exe, "Run as administrator" and run: nebula.exe -config config.yml
76+
- Mac/Linux: sudo ./nebula -config config.yml
77+
4. Keep the terminal window open to maintain your connection
78+
Your Nebula IP address: ${IP}
79+
EOREADME
80+
81+
# Create platform-specific instructions
82+
mkdir -p /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/windows
83+
mkdir -p /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/mac
84+
mkdir -p /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/linux
85+
86+
# Create Windows batch file
87+
cat > /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/windows/start-nebula.bat << EOBAT
88+
@echo off
89+
echo Starting Nebula VPN...
90+
echo This window must remain open for the connection to work
91+
echo.
92+
echo Your Nebula IP address: ${IP}
93+
echo.
94+
nebula.exe -config ../config.yml
95+
pause
96+
EOBAT
97+
98+
# Create Mac/Linux shell script
99+
cat > /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/mac/start-nebula.sh << EOSH
100+
#!/bin/bash
101+
echo "Starting Nebula VPN..."
102+
echo "This window must remain open for the connection to work"
103+
echo ""
104+
echo "Your Nebula IP address: ${IP}"
105+
echo ""
106+
sudo ./nebula -config ../config.yml
107+
EOSH
108+
chmod +x /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/mac/start-nebula.sh
109+
110+
# Create Linux shell script (same as Mac)
111+
cp /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/mac/start-nebula.sh /etc/nebula/clients/${USERNAME}-${DEVICE_NUM}/linux/
112+
113+
# Package everything up
114+
cd /etc/nebula/clients/
115+
tar -czf ${USERNAME}-${DEVICE_NUM}.tar.gz ${USERNAME}-${DEVICE_NUM}/
116+
zip -r ${USERNAME}-${DEVICE_NUM}.zip ${USERNAME}-${DEVICE_NUM}/
117+
118+
# Make packages downloadable
119+
chmod 644 ${USERNAME}-${DEVICE_NUM}.tar.gz
120+
chmod 644 ${USERNAME}-${DEVICE_NUM}.zip 2>/dev/null || true
121+
122+
echo ""
123+
echo "Client package created for ${USERNAME}-${DEVICE_NUM} with IP ${IP}"
124+
echo ""
125+
echo "Download links:"
126+
echo "TAR: scp [email protected]:/etc/nebula/clients/${USERNAME}-${DEVICE_NUM}.tar.gz ~/"
127+
if [ -f "/etc/nebula/clients/${USERNAME}-${DEVICE_NUM}.zip" ]; then
128+
echo "ZIP: scp [email protected]:/etc/nebula/clients/${USERNAME}-${DEVICE_NUM}.zip ~/"
129+
fi
130+
echo ""
131+
root@ubuntu-s-1vcpu-512mb-10gb-sfo3-01:~#

0 commit comments

Comments
 (0)