|
5 | 5 |
|
6 | 6 | # Setup Arbitrum directory |
7 | 7 | echo "Setting up Arbitrum db directory..." |
8 | | -mkdir -p /home/ec2-user/.arbitrum || { echo "Failed to create .arbitrum directory"; exit 1; } |
9 | | -sudo chown -R ec2-user:ec2-user /home/ec2-user/.arbitrum || { echo "Failed to set permissions for .arbitrum"; exit 1; } |
| 8 | +mkdir -p /opt/nitro/arbitrum || { echo "Failed to create .arbitrum directory"; exit 1; } |
| 9 | +sudo chown -R ec2-user:ec2-user /opt/nitro/arbitrum || { echo "Failed to set permissions for .arbitrum"; exit 1; } |
10 | 10 |
|
11 | 11 | # Setup config directory |
12 | 12 | echo "Setting up config directory..." |
13 | | -mkdir -p /home/ec2-user/config || { echo "Failed to create config directory"; exit 1; } |
14 | | -sudo chown -R ec2-user:ec2-user /home/ec2-user/config || { echo "Failed to set permissions for config"; exit 1; } |
15 | | - |
16 | | -# Start socat proxy in background with logging |
| 13 | +mkdir -p /opt/nitro/config || { echo "Failed to create config directory"; exit 1; } |
| 14 | +sudo chown -R ec2-user:ec2-user /opt/nitro/config || { echo "Failed to set permissions for config"; exit 1; } |
| 15 | + |
| 16 | +# Create systemd service for socat |
| 17 | +echo "Creating systemd service for socat..." |
| 18 | +sudo bash -c 'cat << EOF > /etc/systemd/system/socat-vsock.service |
| 19 | +[Unit] |
| 20 | +Description=socat VSOCK to TCP proxy |
| 21 | +After=network.target nfs-server.service |
| 22 | +
|
| 23 | +[Service] |
| 24 | +ExecStart=/usr/bin/socat -d -d VSOCK-LISTEN:8004,fork,keepalive TCP:127.0.0.1:2049,keepalive,retry=5,interval=10 |
| 25 | +Restart=always |
| 26 | +RestartSec=10 |
| 27 | +
|
| 28 | +[Install] |
| 29 | +WantedBy=multi-user.target |
| 30 | +EOF' || { echo "Failed to create socat systemd service file"; exit 1; } |
| 31 | + |
| 32 | +# Enable and start socat service |
17 | 33 | echo "Starting socat proxy..." |
18 | | -sudo socat VSOCK-LISTEN:8004,fork,keepalive TCP:127.0.0.1:2049,keepalive & |
| 34 | +sudo systemctl enable socat-vsock.service || { echo "Failed to enable socat service"; exit 1; } |
| 35 | +sudo systemctl start socat-vsock.service || { echo "Failed to start socat service"; exit 1; } |
19 | 36 |
|
20 | 37 | # Configure NFS exports |
21 | | -echo "/home/ec2-user/.arbitrum 127.0.0.1/32(rw,insecure,crossmnt,no_subtree_check,sync,all_squash,anonuid=1000,anongid=1000)" | sudo tee -a /etc/exports || { echo "Failed to configure NFS exports"; exit 1; } |
22 | | -echo "/home/ec2-user/config 127.0.0.1/32(ro,insecure,crossmnt,no_subtree_check,sync,all_squash,anonuid=1000,anongid=1000)" | sudo tee -a /etc/exports || { echo "Failed to configure NFS exports"; exit 1; } |
| 38 | +echo "/opt/nitro/arbitrum 127.0.0.1/32(rw,insecure,crossmnt,no_subtree_check,sync,all_squash,anonuid=1000,anongid=1000)" | sudo tee -a /etc/exports || { echo "Failed to configure NFS exports"; exit 1; } |
| 39 | +echo "/opt/nitro/config 127.0.0.1/32(ro,insecure,crossmnt,no_subtree_check,sync,all_squash,anonuid=1000,anongid=1000)" | sudo tee -a /etc/exports || { echo "Failed to configure NFS exports"; exit 1; } |
23 | 40 | sudo exportfs -ra || { echo "Failed to reload NFS exports"; exit 1; } |
24 | 41 |
|
25 | 42 | # Enable and start NFS server |
|
0 commit comments