-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.ps1
More file actions
242 lines (208 loc) Β· 8.55 KB
/
Copy pathinstall.ps1
File metadata and controls
242 lines (208 loc) Β· 8.55 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# ============================================================================
# C-C-C-COOLASSAPP β One-Click PowerShell Installer
#
# Carefully-Crafted-Claude-Code Original Orchestration Layer
# And Super Serious Appropriately Positioned Project
#
# Usage:
# .\install.ps1
#
# If you get an execution policy error:
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# .\install.ps1
# ============================================================================
$ErrorActionPreference = "Stop"
function Write-Step($step, $total, $msg) {
Write-Host " [$step/$total] " -ForegroundColor Cyan -NoNewline
Write-Host $msg
}
function Write-Ok($msg) {
Write-Host " $msg " -NoNewline
Write-Host "β" -ForegroundColor Green
}
function Write-Err($msg) {
Write-Host " [ERROR] " -ForegroundColor Red -NoNewline
Write-Host $msg
}
Write-Host ""
Write-Host " ============================================================================" -ForegroundColor Cyan
Write-Host " π§ C-C-C-COOLASSAPP β One-Click Installer (PowerShell)" -ForegroundColor Cyan
Write-Host " ============================================================================" -ForegroundColor Cyan
Write-Host ""
# ββ Step 0: Check we're in the right folder ββββββββββββββββββββββββββββββββββ
if (-not (Test-Path "app.py")) {
Write-Err "app.py not found in the current directory."
Write-Host " Make sure you run this from the C-C-C-COOLASSAPP project folder."
Write-Host ""
Write-Host " Current directory: $(Get-Location)"
Write-Host ""
Read-Host "Press Enter to exit"
exit 1
}
if (-not (Test-Path "requirements.txt")) {
Write-Err "requirements.txt not found."
Write-Host " This doesn't look like the right project folder."
Write-Host ""
Read-Host "Press Enter to exit"
exit 1
}
Write-Host " " -NoNewline
Write-Host "[OK]" -ForegroundColor Green -NoNewline
Write-Host " Project files found."
Write-Host ""
# ββ Step 1: Check Python ββββββββββββββββββββββββββββββββββββββββββββββββββββ
Write-Step 1 6 "Checking Python installation..."
$pythonCmd = $null
$pythonCmds = @("python", "python3", "py")
foreach ($cmd in $pythonCmds) {
try {
$ver = & $cmd --version 2>&1
if ($ver -match "Python (\d+)\.(\d+)") {
$major = [int]$Matches[1]
$minor = [int]$Matches[2]
if ($major -ge 3 -and $minor -ge 10) {
$pythonCmd = $cmd
break
}
}
}
catch {
# Command not found, try next
}
}
if (-not $pythonCmd) {
Write-Host ""
Write-Err "Python 3.10+ is NOT installed, or not on your PATH."
Write-Host ""
Write-Host " βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
Write-Host " β HOW TO FIX THIS: β"
Write-Host " β β"
Write-Host " β 1. Go to https://www.python.org/downloads/ β"
Write-Host " β 2. Download Python 3.10 or newer β"
Write-Host " β 3. Run the installer β"
Write-Host " β 4. *** CHECK THE BOX: 'Add Python to PATH' *** β"
Write-Host " β (This is the most common mistake. Don't skip it.) β"
Write-Host " β 5. RESTART PowerShell β"
Write-Host " β 6. Run this script again β"
Write-Host " βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
Write-Host ""
Read-Host "Press Enter to exit"
exit 1
}
$pyVersion = & $pythonCmd --version 2>&1
Write-Ok "$(($pyVersion -replace 'Python ', 'Python '))"
Write-Host ""
# ββ Step 2: Create virtual environment βββββββββββββββββββββββββββββββββββββββ
Write-Step 2 6 "Creating virtual environment..."
if (Test-Path "venv\Scripts\python.exe") {
Write-Ok "Virtual environment already exists"
}
elseif (Test-Path "venv/bin/python") {
# Unix-style venv (WSL or cross-platform)
Write-Ok "Virtual environment already exists"
}
else {
try {
& $pythonCmd -m venv venv
Write-Ok "Created venv/"
}
catch {
Write-Err "Failed to create virtual environment."
Write-Host " Try running: $pythonCmd -m venv venv"
Read-Host "Press Enter to exit"
exit 1
}
}
Write-Host ""
# ββ Detect pip path ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
$pipPath = $null
$pythonPath = $null
if (Test-Path "venv\Scripts\pip.exe") {
$pipPath = "venv\Scripts\pip.exe"
$pythonPath = "venv\Scripts\python.exe"
}
elseif (Test-Path "venv/bin/pip") {
$pipPath = "venv/bin/pip"
$pythonPath = "venv/bin/python"
}
else {
Write-Err "Could not find pip in the virtual environment."
Read-Host "Press Enter to exit"
exit 1
}
# ββ Step 3: Install dependencies βββββββββββββββββββββββββββββββββββββββββββββ
Write-Step 3 6 "Installing dependencies (this may take a minute)..."
try {
& $pipPath install -r requirements.txt --quiet 2>&1 | Out-Null
Write-Ok "All dependencies installed"
}
catch {
Write-Err "Failed to install dependencies."
Write-Host " Try running manually:"
Write-Host " & $pipPath install -r requirements.txt"
Read-Host "Press Enter to exit"
exit 1
}
Write-Host ""
# ββ Step 4: Create .env file βββββββββββββββββββββββββββββββββββββββββββββββββ
Write-Step 4 6 "Setting up configuration..."
if (Test-Path ".env") {
Write-Ok ".env already exists, keeping your settings"
}
elseif (Test-Path ".env.example") {
Copy-Item ".env.example" ".env"
Write-Ok "Copied .env.example to .env"
Write-Host " " -NoNewline
Write-Host "TIP: Edit .env to set a real SECRET_KEY for production" -ForegroundColor Yellow
}
else {
@"
SECRET_KEY=dev-key-change-me-in-production
DATABASE_URL=sqlite:///orchestration.db
FLASK_ENV=development
FLASK_DEBUG=1
"@ | Set-Content ".env" -Encoding UTF8
Write-Ok "Created default .env"
}
Write-Host ""
# ββ Step 5: Initialize database ββββββββββββββββββββββββββββββββββββββββββββββ
Write-Step 5 6 "Initializing database..."
try {
& $pythonPath setup_db.py
Write-Ok "Database ready"
}
catch {
Write-Err "Database initialization failed."
Write-Host " Try running manually:"
Write-Host " & $pythonPath setup_db.py"
Read-Host "Press Enter to exit"
exit 1
}
Write-Host ""
# ββ Step 6: Launch βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Write-Step 6 6 "Starting server..."
Write-Host ""
Write-Host " ============================================================================" -ForegroundColor Cyan
Write-Host " π§ C-C-C-COOLASSAPP is starting!" -ForegroundColor Cyan
Write-Host " ============================================================================" -ForegroundColor Cyan
Write-Host ""
Write-Host " URL: http://127.0.0.1:5000"
Write-Host " Login: http://127.0.0.1:5000/login"
Write-Host ""
Write-Host " Default credentials:"
Write-Host " Username: admin"
Write-Host " Password: admin"
Write-Host " (You'll be asked to change the password on first login)"
Write-Host ""
Write-Host " Press Ctrl+C to stop the server."
Write-Host " ============================================================================" -ForegroundColor Cyan
Write-Host ""
# Open browser
try {
Start-Process "http://127.0.0.1:5000/login"
}
catch {
# Silently ignore if browser can't be opened
}
# Start the server (this blocks)
& $pythonPath run_server.py