-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·151 lines (132 loc) · 4.17 KB
/
setup.sh
File metadata and controls
executable file
·151 lines (132 loc) · 4.17 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
#!/bin/bash
# Pump.fun Trading Indicator - Setup Script
# This script helps you launch the system quickly
set -e
echo "======================================"
echo "Pump.fun Trading Indicator Setup"
echo "======================================"
echo ""
# Check prerequisites
check_command() {
if ! command -v $1 &> /dev/null; then
echo "❌ $1 is not installed. Please install it first."
exit 1
else
echo "✅ $1 is installed"
fi
}
echo "Checking prerequisites..."
check_command docker
check_command docker-compose
check_command python3
echo ""
# Setup environment file
if [ ! -f .env ]; then
echo "📝 Creating .env file from template..."
cp .env.example .env
# Generate secret keys
SECRET_KEY=$(openssl rand -hex 32)
JWT_SECRET=$(openssl rand -hex 32)
# Update .env with generated secrets
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed -i '' "s/your_secret_key_here_generate_with_openssl/$SECRET_KEY/g" .env
sed -i '' "s/your_jwt_secret_here/$JWT_SECRET/g" .env
else
# Linux
sed -i "s/your_secret_key_here_generate_with_openssl/$SECRET_KEY/g" .env
sed -i "s/your_jwt_secret_here/$JWT_SECRET/g" .env
fi
echo "✅ .env file created with generated secrets"
echo ""
echo "⚠️ IMPORTANT: Edit .env file and add your API keys:"
echo " - PUMP_FUN_API_KEY"
echo " - Optional: SOLANA_RPC_URL (uses public endpoint by default)"
echo ""
read -p "Press Enter after you've added your API keys to .env..."
else
echo "✅ .env file already exists"
fi
echo ""
# Create necessary directories
echo "📁 Creating necessary directories..."
mkdir -p models data logs ssl monitoring/grafana/dashboards monitoring/grafana/datasources
echo "✅ Directories created"
echo ""
# Pull Docker images
echo "🐳 Pulling Docker images..."
docker-compose pull
echo "✅ Docker images pulled"
echo ""
# Start services
echo "🚀 Starting services..."
docker-compose up -d
# Wait for services to be ready
echo "⏳ Waiting for services to start..."
sleep 10
# Check service health
echo ""
echo "🔍 Checking service status..."
docker-compose ps
echo ""
# Initialize database
echo "🗄️ Initializing database..."
docker-compose exec -T postgres psql -U pump_user -d pump_indicator -c "
CREATE TABLE IF NOT EXISTS tokens (
address VARCHAR(255) PRIMARY KEY,
symbol VARCHAR(50),
name VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS price_history (
id SERIAL PRIMARY KEY,
token_address VARCHAR(255) REFERENCES tokens(address),
timestamp TIMESTAMP,
open DECIMAL(20, 8),
high DECIMAL(20, 8),
low DECIMAL(20, 8),
close DECIMAL(20, 8),
volume DECIMAL(20, 8)
);
CREATE TABLE IF NOT EXISTS alerts (
id SERIAL PRIMARY KEY,
user_id VARCHAR(255),
token_address VARCHAR(255),
alert_type VARCHAR(50),
threshold DECIMAL(20, 8),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
triggered_at TIMESTAMP
);
CREATE TABLE IF NOT EXISTS user_feedback (
id SERIAL PRIMARY KEY,
user_id VARCHAR(255),
feedback_type VARCHAR(50),
rating INTEGER,
message TEXT,
metadata JSONB,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
" 2>/dev/null || echo "Database tables already exist"
echo "✅ Database initialized"
echo ""
# Display access information
echo "======================================"
echo "🎉 Setup Complete!"
echo "======================================"
echo ""
echo "Access the system at:"
echo " 📊 Dashboard: http://localhost"
echo " 🔌 API: http://localhost:8000"
echo " 📈 API Docs: http://localhost:8000/docs"
echo " 📊 Grafana: http://localhost:3000"
echo " Username: admin"
echo " Password: admin (change on first login)"
echo " 📊 Prometheus: http://localhost:9090"
echo ""
echo "Useful commands:"
echo " View logs: docker-compose logs -f [service_name]"
echo " Stop services: docker-compose down"
echo " Restart service: docker-compose restart [service_name]"
echo " View metrics: curl http://localhost:8000/api/health"
echo ""
echo "======================================"