-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaster-node.sh
More file actions
68 lines (54 loc) · 2.22 KB
/
Copy pathmaster-node.sh
File metadata and controls
68 lines (54 loc) · 2.22 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
# 1. insert boot media, insert USB to LAN adapter
# 2. boot up the raspberry pi
# 3. connect the SSD
# 4. connect over SSH
# 5. run this file
# update system and install needed libraries
sudo apt update
sudo apt upgrade -y
sudo apt install nfs-kernel-server screen python3-pip -y
# install Node.js v20.19.5 (LTS)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install 20.19.5
npm install -g npm@latest
# save mountpoint for SSD
umo=$(lsblk -o NAME,TYPE,MOUNTPOINT | awk '$2 == "part" && $3 == "" {print $1; exit}')
mkdir -p ~/shared
sudo sh -c "echo '/dev/$umo /home/$(whoami)/shared auto defaults 0 0' >> /etc/fstab"
sudo mount /dev/$umo /home/$(whoami)/shared
sudo chown $(whoami):$(whoami) /home/$(whoami)/shared
sudo chmod 755 /home/$(whoami)/shared
# disable wifi
sudo sh -c "echo 'dtoverlay=pi3-disable-wifi' >> /boot/firmware/config.txt"
# remove IPv6 (not supported with my router, but fake advertisement)
sudo sh -c 'echo -n " ipv6.disable=1 " >> /boot/firmware/cmdline.txt'
# setup LAN sharing
usb=$(nmcli device status | grep -E "ethernet[ ]+(connecting|disconnected)" | cut -d " " -f 1)
sudo nmcli con add type ethernet ifname $usb con-name ClusterLAN ipv4.addresses 192.168.69.1/24 ipv4.method manual ipv6.method ignore
sudo nmcli con mod ClusterLAN ipv4.gateway "" ipv4.dns ""
sudo nmcli con mod ClusterLAN ipv4.method shared
sudo nmcli con up ClusterLAN
# setup NFS
sudo sh -c "echo '/home/$(whoami)/shared 192.168.69.1/24(rw,sync,no_subtree_check,all_squash,anonuid=1000,anongid=1000)' >> /etc/exports"
sudo systemctl enable nfs-kernel-server
# download cloudflared
mkdir -p ~/bin
curl "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64" -o ~/bin/cloudflared
chmod +x ~/bin/cloudflared
# clone gxlg-cluster
cd shared
git clone https://github.com/gXLg-dev/gxlg-cluster
cd gxlg-cluster
# WRITE THE CONFIG FILE AT THIS POINT
nano config.json
# reboot
sudo reboot
# later:
cd ~/shared/gxlg-cluster
# install dependencies
npm ci
# start cluster
./scripts/start-master.sh