File size: 1,466 Bytes
132a18f
50be83e
132a18f
 
 
50be83e
c4d6451
 
132a18f
50be83e
132a18f
50be83e
 
 
 
 
 
 
132a18f
50be83e
 
 
132a18f
50be83e
c4d6451
50be83e
132a18f
50be83e
 
 
132a18f
 
 
50be83e
 
 
 
 
 
 
 
 
 
 
132a18f
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
#!/bin/bash
# FireTech Messenger - Linux Lite GUARANTEED FIX

echo "Starting FireTech Deployment..."

# 1. System Prep
sudo apt update
sudo apt install -y git nodejs npm postgresql postgresql-contrib

# 2. Database Service Start
sudo systemctl start postgresql
sudo systemctl enable postgresql

# 3. Secure User & Database Creation
# We use 'firetech_user' instead of $(whoami) to prevent string errors
DB_USER="firetech_admin"
DB_PASS="firetech_password_123"
DB_NAME="railway"

echo "Configuring Database Permissions..."
sudo -u postgres psql -c "CREATE USER $DB_USER WITH SUPERUSER PASSWORD '$DB_PASS';" 2>/dev/null || \
sudo -u postgres psql -c "ALTER USER $DB_USER WITH PASSWORD '$DB_PASS';"

sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;" 2>/dev/null

# 4. App Setup
cd ~
# Remove old folder to ensure a clean install
rm -rf FireTech-Messager-Server 
git clone https://github.com/dhurghamCreation/FireTech-Messager-Server.git
cd FireTech-Messager-Server
npm install

# 5. Create .env (The "String Fix")
# We use single quotes around the URL to ensure it is treated as a string
echo "DATABASE_URL=\"postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME\"" > .env
echo "JWT_SECRET=\"firetech_secret_123\"" >> .env
echo "PORT=3000" >> .env

# 6. Final Launch
echo "--------------------------------------"
echo "Fix Applied: Client password is now a string."
echo "FIRETECH SERVER IS STARTING..."
echo "--------------------------------------"
node server.js