enable-archive.sh raw
1 #!/bin/bash
2 # Enable archive relay features on mleku.dev
3
4 set -e
5
6 SERVICE_FILE="/etc/systemd/system/orly.service"
7
8 echo "Updating orly.service to enable archive features..."
9
10 sudo tee "$SERVICE_FILE" > /dev/null << 'EOF'
11 [Unit]
12 Description=ORLY Nostr Relay
13 After=network.target
14 Wants=network.target
15
16 [Service]
17 Type=simple
18 User=mleku
19 Group=mleku
20 WorkingDirectory=/home/mleku/src/next.orly.dev
21 ExecStart=/home/mleku/.local/bin/orly
22 Restart=always
23 RestartSec=5
24 StandardOutput=journal
25 StandardError=journal
26 SyslogIdentifier=orly
27
28 # Archive relay query augmentation
29 Environment=ORLY_ARCHIVE_ENABLED=true
30 Environment=ORLY_ARCHIVE_RELAYS=wss://archive.orly.dev/
31
32 # Network settings
33 AmbientCapabilities=CAP_NET_BIND_SERVICE
34
35 [Install]
36 WantedBy=multi-user.target
37 EOF
38
39 echo "Reloading systemd..."
40 sudo systemctl daemon-reload
41
42 echo "Building and installing new version..."
43 cd /home/mleku/src/next.orly.dev
44 CGO_ENABLED=0 go build -o orly
45 sudo setcap 'cap_net_bind_service=+ep' ./orly
46 cp ./orly ~/.local/bin/
47
48 echo "Restarting orly service..."
49 sudo systemctl restart orly
50
51 echo "Done! Archive features are now enabled."
52 echo ""
53 echo "Check status with: sudo systemctl status orly"
54 echo "View logs with: sudo journalctl -u orly -f"
55