-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·123 lines (107 loc) · 3.38 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·123 lines (107 loc) · 3.38 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
#!/bin/bash
# Arbitrum YouTube Oracle Setup Script
# This script helps you set up the oracle for the first time
set -e
echo "🎬 Arbitrum YouTube Oracle Setup"
echo "================================="
echo ""
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo -e "${RED}❌ Node.js is not installed. Please install Node.js 18+ first.${NC}"
exit 1
fi
echo -e "${GREEN}✅ Node.js $(node -v) found${NC}"
# Check if npm is installed
if ! command -v npm &> /dev/null; then
echo -e "${RED}❌ npm is not installed.${NC}"
exit 1
fi
echo -e "${GREEN}✅ npm $(npm -v) found${NC}"
# Install dependencies
echo ""
echo "📦 Installing dependencies..."
npm install
# Compile TypeScript
echo ""
echo "🔨 Compiling TypeScript..."
npm run build
# Create necessary directories
echo ""
echo "📁 Creating directories..."
mkdir -p logs
mkdir -p thumbnails
echo -e "${GREEN}✅ Directories created${NC}"
# Check if .env exists
if [ ! -f .env ]; then
echo ""
echo -e "${YELLOW}⚠️ .env file not found${NC}"
echo "Creating .env from template..."
cp .env.example .env
echo -e "${GREEN}✅ .env file created${NC}"
echo ""
echo -e "${YELLOW}⚠️ IMPORTANT: You must edit .env and fill in your credentials!${NC}"
echo ""
echo "Required fields:"
echo " - PRIVATE_KEY (your Arbitrum wallet private key)"
echo " - CONTRACT_ADDRESS (your token contract address)"
echo " - YOUTUBE_API_KEY (YouTube Data API v3 key)"
echo " - CHANNEL_ID (YouTube channel ID to monitor)"
echo ""
echo "Edit with: nano .env"
else
echo -e "${GREEN}✅ .env file exists${NC}"
fi
# Check if PM2 is installed
echo ""
if ! command -v pm2 &> /dev/null; then
echo -e "${YELLOW}⚠️ PM2 is not installed globally${NC}"
echo ""
echo "To install PM2 globally:"
echo " npm install -g pm2"
echo ""
echo "Or run directly with:"
echo " npm start"
else
echo -e "${GREEN}✅ PM2 $(pm2 -v) found${NC}"
fi
# Display Supabase setup reminder
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📊 SUPABASE DATABASE SETUP"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "1. Go to: https://app.supabase.com"
echo "2. Open your project"
echo "3. Go to SQL Editor"
echo "4. Copy contents of: supabase-schema.sql"
echo "5. Paste and run in SQL Editor"
echo ""
echo "This creates all necessary tables for the oracle."
echo ""
# Summary
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ SETUP COMPLETE!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Next steps:"
echo ""
echo "1. Edit .env file with your credentials:"
echo " nano .env"
echo ""
echo "2. Set up Supabase database (see instructions above)"
echo ""
echo "3. Test run the oracle:"
echo " npm start"
echo ""
echo "4. Deploy with PM2:"
echo " pm2 start pm2.config.js"
echo " pm2 save"
echo " pm2 startup"
echo ""
echo "📖 See README.md for detailed documentation"
echo ""