-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-script.sh
More file actions
60 lines (48 loc) · 1.44 KB
/
deploy-script.sh
File metadata and controls
60 lines (48 loc) · 1.44 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
#!/bin/bash
set -e
echo "Starting Nautilus deployment on instance..."
# Wait for user-data to complete
while [ ! -f "/home/ec2-user/setup-complete.txt" ]; do
echo "Waiting for initial setup to complete..."
sleep 10
done
# Source Rust environment
source ~/.cargo/env
# Navigate to project
cd /home/ec2-user/Satya/nautilus-server
# Build the project
echo "Building Nautilus server..."
cargo build --release
# Create systemd service
sudo tee /etc/systemd/system/nautilus-server.service > /dev/null << 'SERVICE_EOF'
[Unit]
Description=Nautilus TEE Server
After=network.target
[Service]
Type=simple
User=ec2-user
WorkingDirectory=/home/ec2-user/Satya/nautilus-server
ExecStart=/home/ec2-user/Satya/nautilus-server/target/release/nautilus-server
Restart=always
RestartSec=10
Environment=RUST_LOG=info
Environment=BIND_ADDRESS=0.0.0.0:8080
StandardOutput=append:/var/log/nautilus-server.log
StandardError=append:/var/log/nautilus-server.log
[Install]
WantedBy=multi-user.target
SERVICE_EOF
# Enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable nautilus-server
sudo systemctl start nautilus-server
# Check status
sleep 5
sudo systemctl status nautilus-server --no-pager
# Test the health endpoint
echo "Testing health endpoint..."
sleep 10
curl -f http://localhost:8080/health || echo "Health check failed, but service may still be starting"
echo "Deployment complete!"
echo "Service status:"
sudo systemctl is-active nautilus-server || true