-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·82 lines (68 loc) · 2 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·82 lines (68 loc) · 2 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# D2D Installation Script
# Run with: sudo ./install.sh
set -e
echo "=== D2D Installation ==="
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root: sudo ./install.sh"
exit 1
fi
# Installation directory
INSTALL_DIR="/opt/d2d"
# Create installation directory
echo "Creating installation directory: $INSTALL_DIR"
mkdir -p $INSTALL_DIR
# Copy files
echo "Copying files..."
cp -r /home/claudeagent/d2d/* $INSTALL_DIR/
# Set ownership to crowdit
echo "Setting ownership to crowdit..."
chown -R crowdit:crowdit $INSTALL_DIR
# Create working directories
echo "Creating working directories..."
cd $INSTALL_DIR
mkdir -p uploads dicom_archive temp
chown crowdit:crowdit uploads dicom_archive temp
# Create .env file
if [ ! -f "$INSTALL_DIR/.env" ]; then
echo "Creating .env file..."
cp .env.example .env
chown crowdit:crowdit .env
fi
# Open firewall
echo "Opening firewall port 8000..."
ufw allow 8000/tcp
# Create systemd service
echo "Creating systemd service..."
cat > /etc/systemd/system/d2d.service <<'EOF'
[Unit]
Description=Documents to DICOM (D2D)
After=network.target
[Service]
Type=simple
User=crowdit
Group=crowdit
WorkingDirectory=/opt/d2d
Environment="PATH=/opt/d2d/venv/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart=/opt/d2d/venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 8000 --proxy-headers --forwarded-allow-ips='*' --timeout-keep-alive 300
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
echo ""
echo "=== Installation Complete! ==="
echo ""
echo "Next steps:"
echo "1. As crowdit user, run: cd /opt/d2d && python3 -m venv venv"
echo "2. Activate venv: source /opt/d2d/venv/bin/activate"
echo "3. Install packages: pip install -r /opt/d2d/requirements.txt"
echo "4. Start service: sudo systemctl start d2d"
echo "5. Enable on boot: sudo systemctl enable d2d"
echo ""
echo "Or run manually: cd /opt/d2d && source venv/bin/activate && uvicorn app.main:app --host 0.0.0.0 --port 8000"
echo ""
echo "Access at: http://10.60.60.172:8000"
echo ""