forked from Pymmdrza/ticketfy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
133 lines (119 loc) · 3.27 KB
/
setup.sh
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
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Print banner
echo -e "${BLUE}"
echo "╔════════════════════════════════════════╗"
echo "║ Ticketfy Installer ║"
echo "║ Modern Support Ticket System ║"
echo "╚════════════════════════════════════════╝"
echo -e "${NC}"
# Function to check command existence
check_command() {
if ! command -v $1 &> /dev/null; then
echo -e "${RED}$1 is not installed!${NC}"
return 1
fi
echo -e "${GREEN}✓ $1 is installed${NC}"
return 0
}
# Function to install Node.js
install_nodejs() {
echo -e "${YELLOW}Installing Node.js...${NC}"
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
}
# Check system requirements
echo -e "\n${BLUE}Checking system requirements...${NC}"
# Check Node.js
if ! check_command "node"; then
install_nodejs
fi
# Check npm
if ! check_command "npm"; then
echo -e "${YELLOW}Installing npm...${NC}"
sudo apt-get install -y npm
fi
# Create project directory
echo -e "\n${BLUE}Setting up Ticketfy...${NC}"
PROJECT_DIR="ticketfy"
if [ -d "$PROJECT_DIR" ]; then
echo -e "${YELLOW}Directory $PROJECT_DIR already exists. Using existing directory...${NC}"
else
echo -e "${BLUE}Creating project directory...${NC}"
mkdir -p $PROJECT_DIR
fi
cd $PROJECT_DIR
# Clone the repository
echo -e "\n${BLUE}Cloning Ticketfy repository...${NC}"
git clone https://github.com/Pymmdrza/ticketfy.git .
# Install dependencies
echo -e "\n${BLUE}Installing dependencies...${NC}"
npm install
# Create environment file
echo -e "\n${BLUE}Creating environment configuration...${NC}"
cat > .env << EOL
VITE_API_URL=http://localhost:3000
VITE_APP_NAME=Ticketfy
VITE_APP_VERSION=1.0.0
EOL
# Add demo data
echo -e "\n${BLUE}Setting up demo data...${NC}"
mkdir -p src/data
cat > src/data/demo.ts << EOL
export const demoTickets = [
{
id: '1',
subject: 'Unable to access dashboard',
description: 'Getting 403 error when trying to access the admin dashboard',
status: 'open',
priority: 'high',
department: 'Technical',
createdAt: new Date(),
updatedAt: new Date(),
userId: 'user1'
},
{
id: '2',
subject: 'Billing inquiry',
description: 'Question about last month\'s invoice',
status: 'pending',
priority: 'medium',
department: 'Billing',
createdAt: new Date(),
updatedAt: new Date(),
userId: 'user2'
}
];
export const demoUsers = [
{
id: 'admin1',
name: 'Administrator',
email: '[email protected]',
role: 'admin'
},
{
id: 'user1',
name: 'John Doe',
email: '[email protected]',
role: 'user'
},
{
id: 'user2',
name: 'Jane Smith',
email: '[email protected]',
role: 'user'
}
];
EOL
# Setup complete
echo -e "\n${GREEN}✨ Ticketfy setup complete!${NC}"
echo -e "\nNext steps:"
echo -e "${BLUE}1. cd ${PROJECT_DIR}${NC}"
echo -e "${BLUE}2. npm run dev${NC}"
echo -e "\n${YELLOW}Visit http://localhost:5173 to see your Ticketfy instance${NC}"
echo -e "\n${GREEN}Happy ticketing! 🎉${NC}"