-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy patheasy.sh
More file actions
66 lines (56 loc) · 1.31 KB
/
easy.sh
File metadata and controls
66 lines (56 loc) · 1.31 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
#!/bin/bash
# ufw allow (if necessary)
ufw allow http
ufw allow https
# download binary into ./pyramid directory
VERSION=$(curl -s "https://api.github.com/repos/fiatjaf/pyramid/releases/latest" | grep '"tag_name":' | cut -d '"' -f 4)
case $(uname -m) in
x86_64)
ARCH="amd64"
;;
aarch64)
ARCH="arm64"
;;
*)
echo "unsupported architecture: $(uname -m)"
exit 1
;;
esac
mkdir -p pyramid
cd pyramid
rm pyramid-old
mv pyramid pyramid-old 2>/dev/null || true
wget "https://github.com/fiatjaf/pyramid/releases/download/$VERSION/pyramid-$ARCH"
mv "pyramid-$ARCH" pyramid
chmod +x pyramid
DIR=$(pwd)
# create systemd service file
echo "[Unit]
Description=pyramid relay
After=network.target
[Service]
User=$USER
ExecStart=$DIR/pyramid
WorkingDirectory=$DIR
Restart=always
RestartSec=60
Environment=HOST=0.0.0.0 PORT=443
[Install]
WantedBy=multi-user.target
" > /etc/systemd/system/pyramid.service
# reload systemd, enable and start
sudo systemctl daemon-reload
sudo systemctl enable pyramid
sudo systemctl start pyramid
# setup motd
echo '
### pyramid
- see status: systemctl status pyramid
- view logs: journalctl -xefu pyramid
- restart: systemctl restart pyramid
' > /etc/motd
# print instructions
IP=$(curl -s https://api.ipify.org)
echo "***"
echo ""
echo "pyramid is running. visit http://$IP to setup."