-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
162 lines (142 loc) Β· 3.81 KB
/
Copy pathsetup.sh
File metadata and controls
162 lines (142 loc) Β· 3.81 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/bash
# European Capital Selector - Quick Setup Script
# This script helps you set up the project quickly
set -e
echo "π European Capital Selector - Setup Script"
echo "==========================================="
echo ""
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if n8n is installed
check_n8n() {
echo "Checking for n8n..."
if command -v n8n &> /dev/null; then
echo -e "${GREEN}β${NC} n8n is installed"
n8n --version
return 0
else
echo -e "${YELLOW}β ${NC} n8n is not installed"
return 1
fi
}
# Check if Docker is installed
check_docker() {
echo "Checking for Docker..."
if command -v docker &> /dev/null; then
echo -e "${GREEN}β${NC} Docker is installed"
docker --version
return 0
else
echo -e "${YELLOW}β ${NC} Docker is not installed"
return 1
fi
}
# Check if Node.js is installed
check_node() {
echo "Checking for Node.js..."
if command -v node &> /dev/null; then
echo -e "${GREEN}β${NC} Node.js is installed"
node --version
npm --version
return 0
else
echo -e "${RED}β${NC} Node.js is not installed"
return 1
fi
}
# Install n8n with npm
install_n8n_npm() {
echo ""
echo "Installing n8n globally with npm..."
npm install -g n8n
echo -e "${GREEN}β${NC} n8n installed successfully"
}
# Start n8n with Docker
start_n8n_docker() {
echo ""
echo "Starting n8n with Docker..."
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
}
# Start n8n with npm
start_n8n_npm() {
echo ""
echo "Starting n8n..."
n8n start
}
# Main setup
main() {
echo ""
echo "Let's set up your European Capital Selector!"
echo ""
# Check prerequisites
has_docker=false
has_n8n=false
has_node=false
if check_docker; then
has_docker=true
fi
if check_node; then
has_node=true
fi
if check_n8n; then
has_n8n=true
fi
echo ""
echo "==========================================="
echo ""
# Decide installation method
if [ "$has_docker" = true ]; then
echo "Would you like to run n8n with Docker? (recommended) [y/n]"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
start_n8n_docker
exit 0
fi
fi
if [ "$has_n8n" = true ]; then
echo "Would you like to start n8n now? [y/n]"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
start_n8n_npm
exit 0
fi
elif [ "$has_node" = true ]; then
echo "Would you like to install n8n with npm? [y/n]"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
install_n8n_npm
echo ""
echo "Would you like to start n8n now? [y/n]"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
start_n8n_npm
exit 0
fi
fi
else
echo -e "${RED}Error:${NC} Neither Docker nor Node.js is installed."
echo "Please install one of them first:"
echo " - Docker: https://docs.docker.com/get-docker/"
echo " - Node.js: https://nodejs.org/"
exit 1
fi
echo ""
echo "Setup complete! π"
echo ""
echo "Next steps:"
echo "1. Open http://localhost:5678 in your browser"
echo "2. Import the workflow from workflow/Random_EU_Capital_Selector.json"
echo "3. Configure your OpenAI credentials"
echo "4. Test the workflow!"
echo ""
echo "For detailed instructions, see docs/INSTALLATION.md"
}
# Run main function
main