-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
99 lines (83 loc) · 2.67 KB
/
install.sh
File metadata and controls
99 lines (83 loc) · 2.67 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
#!/bin/bash
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Function to print colored messages
print_message() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if running as root
if [ "$EUID" -ne 0 ]; then
print_error "Please run as root"
exit 1
fi
# Require
print_message "Installing requirements..."
print_message "1. docker"
print_message "2. docker-compose"
print_message "3. lite-lnmp (github.com/cloudkoonly/lite-lnmp)"
print_message "4. kanboard-roadmap (put this folder in lite-lnmp/app/)"
read -p "Press y/n to continue or exit: " response && [ "$response" = "y" ] || exit 1 && echo "..."
# Step 1: check lite-lnmp repository if exists
print_message "Checking for lite-lnmp repository..."
if [ ! -d "../lite-lnmp" ]; then
print_error "Not found lite-lnmp repository, please clone lite-lnmp repository first..."
exit 1
fi
print_success "Found lite-lnmp repository"
# Step 2: Copy SQL file to mysql directory
print_message "Copying SQL file..."
cp kanboard-roadmap/db.sql ../mysql8/sql/
if [ $? -ne 0 ]; then
print_error "Failed to copy SQL file"
exit 1
fi
print_success "SQL file copied successfully"
# Step 3: Create database and import SQL
print_message "Setting up database..."
docker exec -i mysql8 mysql -uroot -p123456 <<EOF
CREATE DATABASE IF NOT EXISTS roadmap;
USE roadmap;
source /tmp/sql/db.sql;
EOF
if [ $? -ne 0 ]; then
print_error "Failed to set up database"
exit 1
fi
print_success "Database setup completed"
# Step 4: Configure nginx
print_message "Configuring nginx..."
if [ -f "/etc/nginx/conf.d/roadmap.conf" ]; then
print_message "Backing up existing nginx config..."
mv /etc/nginx/conf.d/roadmap.conf /etc/nginx/conf.d/roadmap.conf.bak
fi
cp kanboard-roadmap/nginx.conf /etc/nginx/conf.d/roadmap.conf
if [ $? -ne 0 ]; then
print_error "Failed to configure nginx"
exit 1
fi
print_success "Nginx configured successfully"
# Step 5: Restart docker containers
print_message "Restarting docker containers..."
docker-compose up -d
if [ $? -ne 0 ]; then
print_error "Failed to restart docker containers"
exit 1
fi
print_success "Docker containers restarted successfully"
print_success "Installation completed!"
echo -e "${GREEN}You can now access:${NC}"
echo -e "Frontend: ${BLUE}http://roadmap.dev/roadmap/${NC}"
echo -e "Admin: ${BLUE}http://roadmap.dev/${NC}"
echo -e "${RED}Important:${NC} Default admin credentials are:"
echo -e "Username: ${BLUE}admin${NC}"
echo -e "Password: ${BLUE}123456${NC}"
echo -e "${RED}Please change the admin password after first login!${NC}"