-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·55 lines (47 loc) · 1.68 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·55 lines (47 loc) · 1.68 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
#!/bin/bash
IMAGE_REF=$1
DASHBOARD_PASSWORD=$2
SECRETS_PATH="$HOME/.researchviewer-secrets"
MONITORING_PATH="$HOME/dev/ResearchViewer/monitoring"
echo "🔧 Setting up deployment directories..."
# Ensure monitoring directory exists with proper permissions
if [ ! -d "$MONITORING_PATH" ]; then
echo " Creating monitoring directory: $MONITORING_PATH"
mkdir -p "$MONITORING_PATH"
fi
chmod 755 "$MONITORING_PATH"
echo " ✅ Monitoring directory ready"
echo "🐳 Pulling Docker image: $IMAGE_REF"
docker pull "$IMAGE_REF"
echo "🛑 Stopping existing container..."
docker stop researchviewer || true
docker rm researchviewer || true
echo "🚀 Starting new container..."
docker run -d \
--name researchviewer \
--restart unless-stopped \
-p 80:8080 \
-v /home/shay/dev/ResearchViewer/src:/app/host_data \
-v "$MONITORING_PATH:/app/monitoring" \
-v "$SECRETS_PATH/firebase-service-account.json:/app/firebase-service-account.json:ro" \
-e DATA_DB_PATH=/app/host_data/data.db \
-e USER_DB_PATH=/app/host_data/user.db \
-e FIREBASE_CREDENTIALS_PATH=/app/firebase-service-account.json \
-e DASHBOARD_PASSWORD="$DASHBOARD_PASSWORD" \
"$IMAGE_REF"
echo ""
echo "⏳ Waiting for container to start..."
sleep 3
if docker ps | grep -q researchviewer; then
echo "✅ Deployment successful!"
echo ""
echo "Container Status:"
docker ps --filter name=researchviewer --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
echo ""
echo "📊 Monitoring directory: $MONITORING_PATH"
echo "🔍 Check logs with: docker logs researchviewer"
else
echo "❌ Container failed to start!"
echo "Check logs with: docker logs researchviewer"
exit 1
fi