-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathsetup.py
More file actions
662 lines (542 loc) Β· 22.3 KB
/
setup.py
File metadata and controls
662 lines (542 loc) Β· 22.3 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
#!/usr/bin/env python3
"""
VPK (Vast Password Kracker) Production Setup Script
This script helps configure VPK for production deployment with:
- Environment variables generation
- SSL certificate setup
- Database configuration
- Security key generation
- Docker deployment assistance
"""
import os
import sys
import secrets
import string
import subprocess
import re
import json
from pathlib import Path
from typing import Dict, Optional
import base64
class Colors:
"""ANSI color codes for terminal output"""
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
MAGENTA = '\033[95m'
CYAN = '\033[96m'
WHITE = '\033[97m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
def print_banner():
"""Print VPK setup banner"""
banner = f"""
{Colors.CYAN}{Colors.BOLD}
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VPK Production Setup β
β Vast Password Kracker v1.0 β
β β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{Colors.END}
{Colors.YELLOW}This script will help you configure VPK for production deployment.{Colors.END}
{Colors.WHITE}Please follow the prompts to set up your environment.{Colors.END}
"""
print(banner)
def generate_secret_key(length: int = 64) -> str:
"""Generate a cryptographically secure secret key"""
alphabet = string.ascii_letters + string.digits + "!@#$%^&*"
return ''.join(secrets.choice(alphabet) for _ in range(length))
def generate_settings_key() -> str:
"""Generate a Fernet-compatible encryption key"""
return base64.urlsafe_b64encode(os.urandom(32)).decode()
def validate_email(email: str) -> bool:
"""Validate email format"""
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
return re.match(pattern, email) is not None
def validate_domain(domain: str) -> bool:
"""Validate domain format"""
pattern = r'^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$'
# Additional checks
if not re.match(pattern, domain):
return False
# Check overall length (253 chars max for FQDN)
if len(domain) > 253:
return False
# Check each label doesn't exceed 63 chars and doesn't start/end with hyphen
labels = domain.split('.')
for label in labels:
if len(label) > 63 or label.startswith('-') or label.endswith('-'):
return False
return True
def prompt_input(message: str, default: str = "", validator=None, sensitive: bool = False) -> str:
"""Get user input with validation"""
while True:
if default:
prompt = f"{Colors.WHITE}{message} [{Colors.CYAN}{default}{Colors.WHITE}]: {Colors.END}"
else:
prompt = f"{Colors.WHITE}{message}: {Colors.END}"
if sensitive:
import getpass
value = getpass.getpass(prompt)
else:
value = input(prompt).strip()
if not value and default:
value = default
if not value:
print(f"{Colors.RED}This field is required.{Colors.END}")
continue
if validator and not validator(value):
print(f"{Colors.RED}Invalid format. Please try again.{Colors.END}")
continue
return value
def prompt_yes_no(message: str, default: bool = True) -> bool:
"""Get yes/no input from user"""
default_str = "Y/n" if default else "y/N"
while True:
response = input(f"{Colors.WHITE}{message} [{default_str}]: {Colors.END}").strip().lower()
if not response:
return default
if response in ['y', 'yes', 'true', '1']:
return True
elif response in ['n', 'no', 'false', '0']:
return False
else:
print(f"{Colors.RED}Please enter y/yes or n/no{Colors.END}")
def check_docker():
"""Check if Docker and Docker Compose are installed"""
print(f"{Colors.BLUE}Checking Docker installation...{Colors.END}")
try:
# Check Docker
result = subprocess.run(['sudo', 'docker', '--version'], capture_output=True, text=True)
if result.returncode != 0:
print(f"{Colors.RED}β Docker is not installed or not accessible with sudo{Colors.END}")
return False
print(f"{Colors.GREEN}β
Docker: {result.stdout.strip()}{Colors.END}")
# Check Docker Compose
result = subprocess.run(['sudo', 'docker', 'compose', 'version'], capture_output=True, text=True)
if result.returncode != 0:
print(f"{Colors.RED}β Docker Compose is not installed or not available{Colors.END}")
return False
print(f"{Colors.GREEN}β
Docker Compose: {result.stdout.strip()}{Colors.END}")
return True
except FileNotFoundError:
print(f"{Colors.RED}β Docker is not installed{Colors.END}")
return False
def collect_config() -> Dict[str, str]:
"""Collect configuration from user"""
config = {}
print(f"\n{Colors.BOLD}{Colors.BLUE}π§ Basic Configuration{Colors.END}")
print(f"{Colors.YELLOW}Let's configure the basic settings for your VPK deployment.{Colors.END}\n")
# Domain configuration
config['DOMAIN'] = prompt_input(
"Enter your domain name (e.g., vpk.example.com)",
validator=validate_domain
)
# SSL Configuration
config['USE_SSL'] = str(prompt_yes_no(
"Do you want to enable SSL/HTTPS?",
default=True
)).lower()
if config['USE_SSL'] == 'true':
print(f"\n{Colors.YELLOW}Manual SSL Setup Required:{Colors.END}")
print(f"{Colors.WHITE}You will need to place your SSL certificates in:{Colors.END}")
print(f"{Colors.CYAN} - docker/certs/fullchain.pem (certificate chain){Colors.END}")
print(f"{Colors.CYAN} - docker/certs/privkey.pem (private key){Colors.END}")
print(f"{Colors.WHITE}These files must be in place before starting the services.{Colors.END}")
# Database configuration
print(f"\n{Colors.BOLD}{Colors.BLUE}ποΈ Database Configuration{Colors.END}")
config['POSTGRES_USER'] = prompt_input("PostgreSQL username", default="vpk")
config['POSTGRES_PASSWORD'] = prompt_input("PostgreSQL password", sensitive=True) or generate_secret_key(16)
config['POSTGRES_DB'] = prompt_input("PostgreSQL database name", default="vpk_db")
# Security keys
print(f"\n{Colors.BOLD}{Colors.BLUE}π Security Configuration{Colors.END}")
print(f"{Colors.YELLOW}Generating secure encryption keys...{Colors.END}")
config['SECRET_KEY'] = generate_secret_key(64)
config['SETTINGS_ENCRYPTION_KEY'] = generate_settings_key()
print(f"{Colors.GREEN}β
Security keys generated{Colors.END}")
# API Configuration
if config['USE_SSL'] == 'true':
config['NEXT_PUBLIC_API_URL'] = f"https://{config['DOMAIN']}"
# Set CORS origins for HTTPS
cors_origins = [
f"https://{config['DOMAIN']}",
f"https://www.{config['DOMAIN']}"
]
else:
config['NEXT_PUBLIC_API_URL'] = f"http://{config['DOMAIN']}"
# Set CORS origins for HTTP
cors_origins = [
f"http://{config['DOMAIN']}",
f"http://www.{config['DOMAIN']}"
]
# Store CORS origins as JSON string
config['BACKEND_CORS_ORIGINS'] = json.dumps(cors_origins)
# Optional: Resource limits
print(f"\n{Colors.BOLD}{Colors.BLUE}βοΈ Resource Configuration{Colors.END}")
config['CELERY_CONCURRENCY'] = prompt_input("Celery worker concurrency", default="4")
return config
def write_env_file(config: Dict[str, str], filename: str = ".env.production"):
"""Write configuration to environment file"""
env_content = f"""# VPK Production Environment Configuration
# Generated by setup.py on {subprocess.check_output(['date'], text=True).strip()}
# Domain Configuration
DOMAIN={config['DOMAIN']}
USE_SSL={config['USE_SSL']}
"""
if config.get('ADMIN_EMAIL'):
env_content += f"ADMIN_EMAIL={config['ADMIN_EMAIL']}\n"
env_content += f"""
# Database Configuration
POSTGRES_USER={config['POSTGRES_USER']}
POSTGRES_PASSWORD={config['POSTGRES_PASSWORD']}
POSTGRES_DB={config['POSTGRES_DB']}
# Security Keys (KEEP THESE SECRET!)
SECRET_KEY='{config['SECRET_KEY']}'
SETTINGS_ENCRYPTION_KEY={config['SETTINGS_ENCRYPTION_KEY']}
# API Configuration
NEXT_PUBLIC_API_URL={config['NEXT_PUBLIC_API_URL']}
# Resource Configuration
CELERY_CONCURRENCY={config['CELERY_CONCURRENCY']}
# Production Settings
ENVIRONMENT=production
DEBUG=false
BACKEND_CORS_ORIGINS={config['BACKEND_CORS_ORIGINS']}
"""
with open(filename, 'w') as f:
f.write(env_content)
# Set restrictive permissions
os.chmod(filename, 0o600)
print(f"{Colors.GREEN}β
Environment file written to {filename}{Colors.END}")
def create_docker_override():
"""Create production docker-compose override"""
override_content = """# Production Docker Compose Override
# This file customizes the base docker-compose.prod.yml for your specific environment
services:
nginx:
environment:
- DOMAIN=${DOMAIN}
- USE_SSL=${USE_SSL}
volumes:
- ./docker/nginx/templates:/etc/nginx/templates:ro
celery_worker:
environment:
- CELERY_CONCURRENCY=${CELERY_CONCURRENCY}
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 512M
backend:
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 256M
frontend:
deploy:
resources:
limits:
memory: 512M
reservations:
memory: 128M
"""
with open('docker-compose.override.yml', 'w') as f:
f.write(override_content)
print(f"{Colors.GREEN}β
Docker Compose override created{Colors.END}")
def create_nginx_config(config: Dict[str, str]):
"""Create Nginx configuration"""
# Create nginx directory structure
nginx_dir = Path("docker/nginx/templates")
nginx_dir.mkdir(parents=True, exist_ok=True)
# Create main nginx template
nginx_template = f"""
server {{
listen 80;
server_name {config['DOMAIN']};
# Security headers
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Referrer-Policy strict-origin-when-cross-origin;
"""
if config['USE_SSL'] == 'true':
nginx_template += f"""
# Redirect HTTP to HTTPS
location / {{
return 301 https://$server_name$request_uri;
}}
}}
server {{
listen 443 ssl;
http2 on;
server_name {config['DOMAIN']};
# SSL Configuration (using manual certificates)
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
# SSL Security
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# HSTS
add_header Strict-Transport-Security "max-age=63072000" always;
# Security headers
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Referrer-Policy strict-origin-when-cross-origin;
"""
nginx_template += """
# File upload limits
client_max_body_size 500M;
# Frontend (Next.js)
location / {
proxy_pass http://frontend:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
# API Backend
location /api/ {
limit_req zone=api burst=20 nodelay;
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Timeouts for long-running requests
proxy_connect_timeout 60s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
}
# File uploads (special rate limiting)
location /api/v1/storage/ {
limit_req zone=upload burst=5 nodelay;
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Extended timeouts for file uploads
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
}
}
"""
with open(nginx_dir / "default.conf.template", 'w') as f:
f.write(nginx_template)
print(f"{Colors.GREEN}β
Nginx configuration created{Colors.END}")
def create_deployment_scripts(config: Dict[str, str]):
"""Create deployment and management scripts"""
# Get the API URL from config
api_url = config.get('NEXT_PUBLIC_API_URL', 'http://localhost')
# Production deployment script
deploy_script = f"""#!/bin/bash
# VPK Production Deployment Script
set -e
echo "π Deploying VPK to production..."
# Check for environment file
if [ ! -f .env.production ]; then
echo "β .env.production file not found. Run setup.py first."
exit 1
fi
echo "β
Found .env.production file"
# Build and start services with explicit env file
echo "π¦ Building Docker images..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production build --no-cache
echo "π Starting services..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production up -d
echo "β³ Waiting for services to be ready..."
sleep 30
# Run database migrations
echo "ποΈ Running database migrations..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production exec -T backend alembic upgrade head
echo "β
VPK deployment complete!"
echo "π Access your VPK instance at: {api_url}"
# Show service status
sudo docker compose -f docker-compose.prod.yml --env-file .env.production ps
"""
with open('deploy.sh', 'w') as f:
f.write(deploy_script)
os.chmod('deploy.sh', 0o755)
# Management script
manage_script = """#!/bin/bash
# VPK Management Script
set -e
COMMAND=${1:-help}
# Check for environment file
if [ ! -f .env.production ]; then
echo "β .env.production file not found. Run setup.py first."
exit 1
fi
case $COMMAND in
start)
echo "π Starting VPK services..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production up -d
echo "β
Services started"
;;
stop)
echo "π Stopping VPK services..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production down
echo "β
Services stopped"
;;
restart)
echo "π Restarting VPK services..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production restart
echo "β
Services restarted"
;;
status)
echo "π VPK Service Status:"
sudo docker compose -f docker-compose.prod.yml --env-file .env.production ps
;;
logs)
SERVICE=${2:-}
if [ -n "$SERVICE" ]; then
echo "π Logs for $SERVICE:"
sudo docker compose -f docker-compose.prod.yml --env-file .env.production logs -f $SERVICE
else
echo "π All service logs:"
sudo docker compose -f docker-compose.prod.yml --env-file .env.production logs -f
fi
;;
update)
echo "β¬οΈ Updating VPK..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production pull
sudo docker compose -f docker-compose.prod.yml --env-file .env.production build --no-cache
sudo docker compose -f docker-compose.prod.yml --env-file .env.production up -d
echo "β
Update complete"
;;
migrate)
echo "ποΈ Running database migrations..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production exec backend alembic upgrade head
echo "β
Migrations complete"
;;
shell)
SERVICE=${2:-backend}
echo "π Opening shell in $SERVICE..."
sudo docker compose -f docker-compose.prod.yml --env-file .env.production exec $SERVICE bash
;;
help|*)
echo "VPK Management Commands:"
echo " start - Start all services"
echo " stop - Stop all services"
echo " restart - Restart all services"
echo " status - Show service status"
echo " logs - Show logs (optionally specify service)"
echo " update - Update and restart services"
echo " migrate - Run database migrations"
echo " shell - Open shell in service (default: backend)"
echo ""
echo "Usage: ./manage.sh <command> [service]"
;;
esac
"""
with open('manage.sh', 'w') as f:
f.write(manage_script)
os.chmod('manage.sh', 0o755)
print(f"{Colors.GREEN}β
Management scripts created (deploy.sh, manage.sh){Colors.END}")
def create_systemd_service():
"""Create systemd service for auto-start"""
if not prompt_yes_no("Do you want to create a systemd service for auto-start?", default=False):
return
current_dir = os.getcwd()
service_content = f"""[Unit]
Description=VPK (Vast Password Kracker) Service
Requires=docker.service
After=docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory={current_dir}
ExecStart=/usr/bin/docker compose -f docker-compose.prod.yml --env-file .env.production up -d
ExecStop=/usr/bin/docker compose -f docker-compose.prod.yml --env-file .env.production down
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
"""
print(f"\n{Colors.YELLOW}To install the systemd service, run these commands as root:{Colors.END}")
print(f"{Colors.CYAN}sudo tee /etc/systemd/system/vpk.service > /dev/null << 'EOF'")
print(service_content)
print("EOF")
print("sudo systemctl daemon-reload")
print("sudo systemctl enable vpk.service")
print(f"sudo systemctl start vpk.service{Colors.END}")
def main():
"""Main setup function"""
print_banner()
# Check prerequisites
if not check_docker():
print(f"\n{Colors.RED}β Docker is required but not installed.{Colors.END}")
print(f"{Colors.YELLOW}Please install Docker and Docker Compose first:{Colors.END}")
print(f"{Colors.CYAN}https://docs.docker.com/get-docker/{Colors.END}")
sys.exit(1)
# Check directory
if not os.path.exists('docker-compose.prod.yml'):
print(f"\n{Colors.RED}β Please run this script from the VPK root directory{Colors.END}")
sys.exit(1)
# Collect configuration
config = collect_config()
# Create configuration files
print(f"\n{Colors.BOLD}{Colors.BLUE}π Creating configuration files...{Colors.END}")
write_env_file(config)
create_docker_override()
create_nginx_config(config)
create_deployment_scripts(config)
# Create directories
print(f"\n{Colors.BLUE}π Creating required directories...{Colors.END}")
directories = [
'app/data',
'logs',
'docker/certs'
]
for directory in directories:
Path(directory).mkdir(parents=True, exist_ok=True)
print(f"{Colors.GREEN}β
Directories created{Colors.END}")
# Create systemd service
create_systemd_service()
# Final instructions
print(f"\n{Colors.BOLD}{Colors.GREEN}π VPK Production Setup Complete!{Colors.END}")
print(f"\n{Colors.BOLD}Next steps:{Colors.END}")
print(f"{Colors.WHITE}1. Review the generated configuration files{Colors.END}")
print(f"{Colors.WHITE}2. Run the deployment: {Colors.CYAN}./deploy.sh{Colors.END}")
if config['USE_SSL'] == 'true':
print(f"{Colors.WHITE}3. Place SSL certificates in: {Colors.CYAN}docker/certs/{Colors.END}")
print(f" - {Colors.CYAN}fullchain.pem{Colors.END} (certificate chain)")
print(f" - {Colors.CYAN}privkey.pem{Colors.END} (private key)")
print(f"{Colors.WHITE}4. Access VPK at: {Colors.CYAN}{config['NEXT_PUBLIC_API_URL']}{Colors.END}")
print(f"\n{Colors.YELLOW}Management commands:{Colors.END}")
print(f"{Colors.CYAN}./manage.sh start{Colors.END} - Start services")
print(f"{Colors.CYAN}./manage.sh stop{Colors.END} - Stop services")
print(f"{Colors.CYAN}./manage.sh status{Colors.END} - Check status")
print(f"{Colors.CYAN}./manage.sh logs{Colors.END} - View logs")
print(f"{Colors.CYAN}./manage.sh update{Colors.END} - Update VPK")
print(f"\n{Colors.YELLOW}Important files created:{Colors.END}")
print(f"{Colors.CYAN}- .env.production{Colors.END} (environment variables)")
print(f"{Colors.CYAN}- docker-compose.override.yml{Colors.END} (Docker overrides)")
print(f"{Colors.CYAN}- deploy.sh{Colors.END} (deployment script)")
print(f"{Colors.CYAN}- manage.sh{Colors.END} (management script)")
print(f"\n{Colors.RED}β οΈ SECURITY REMINDER:{Colors.END}")
print(f"{Colors.YELLOW}Keep your .env.production file secure - it contains sensitive keys!{Colors.END}")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print(f"\n{Colors.YELLOW}Setup cancelled by user.{Colors.END}")
sys.exit(1)
except Exception as e:
print(f"\n{Colors.RED}β Setup failed: {e}{Colors.END}")
sys.exit(1)