-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·124 lines (107 loc) · 2.91 KB
/
deploy.sh
File metadata and controls
executable file
·124 lines (107 loc) · 2.91 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# Billgen Pro Deployment Script
# This script helps deploy the application using Docker Compose
set -e
echo "🚀 Billgen Pro Deployment Script"
echo "================================"
echo ""
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
# Check if .env file exists
if [ ! -f .env ]; then
echo "⚠️ .env file not found. Creating from template..."
cat > .env << EOF
# Database Configuration
MYSQL_ROOT_PASSWORD=$(openssl rand -base64 32 | tr -d "=+/" | cut -c1-25)
MYSQL_DATABASE=billgenpro
MYSQL_USER=billgenuser
MYSQL_PASSWORD=$(openssl rand -base64 32 | tr -d "=+/" | cut -c1-25)
# Server Port
PORT=5000
# JPA Configuration
SPRING_JPA_HIBERNATE_DDL_AUTO=update
SPRING_JPA_SHOW_SQL=false
# Thymeleaf Cache
SPRING_THYMELEAF_CACHE=true
# Logging
LOGGING_LEVEL_COM_BILLGENPRO=INFO
EOF
echo "✅ .env file created with random passwords."
echo "⚠️ Please update .env file with your mail configuration if needed."
echo ""
fi
# Function to start services
start_services() {
echo "📦 Building and starting services..."
docker-compose up -d --build
echo "✅ Services started!"
echo ""
echo "🌐 Application should be available at http://localhost:5000"
echo "📊 View logs with: docker-compose logs -f app"
}
# Function to stop services
stop_services() {
echo "🛑 Stopping services..."
docker-compose down
echo "✅ Services stopped!"
}
# Function to view logs
view_logs() {
echo "📋 Showing application logs (Ctrl+C to exit)..."
docker-compose logs -f app
}
# Function to restart services
restart_services() {
echo "🔄 Restarting services..."
docker-compose restart
echo "✅ Services restarted!"
}
# Function to show status
show_status() {
echo "📊 Service Status:"
docker-compose ps
}
# Main menu
case "${1:-start}" in
start)
start_services
;;
stop)
stop_services
;;
restart)
restart_services
;;
logs)
view_logs
;;
status)
show_status
;;
update)
echo "🔄 Updating application..."
git pull
docker-compose up -d --build
echo "✅ Application updated!"
;;
*)
echo "Usage: $0 {start|stop|restart|logs|status|update}"
echo ""
echo "Commands:"
echo " start - Build and start services (default)"
echo " stop - Stop all services"
echo " restart - Restart all services"
echo " logs - View application logs"
echo " status - Show service status"
echo " update - Pull latest code and rebuild"
exit 1
;;
esac