Spaces:
Runtime error
Runtime error
Add FireTech Messenger deployment script
Browse filesThis script automates the deployment of the FireTech Messenger application on Linux Lite, including system updates, database setup, application cloning, and server startup.
gh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# FireTech Messenger - Linux Lite Auto-Deployer
|
| 3 |
+
|
| 4 |
+
echo "Starting FireTech Deployment..."
|
| 5 |
+
|
| 6 |
+
# 1. Update and Install (Using apt instead of pacman)
|
| 7 |
+
sudo apt update && sudo apt upgrade -y
|
| 8 |
+
sudo apt install -y git nodejs npm postgresql postgresql-contrib sudo nano
|
| 9 |
+
|
| 10 |
+
# 2. Setup Database
|
| 11 |
+
echo "Configuring PostgreSQL..."
|
| 12 |
+
# Linux Lite uses systemctl to manage services
|
| 13 |
+
sudo systemctl start postgresql
|
| 14 |
+
sudo systemctl enable postgresql
|
| 15 |
+
|
| 16 |
+
# Create the 'railway' database
|
| 17 |
+
# We use -u postgres to run the command as the database admin
|
| 18 |
+
sudo -u postgres createdb railway || echo "Database 'railway' already exists."
|
| 19 |
+
|
| 20 |
+
# 3. Clone and Install App
|
| 21 |
+
cd ~
|
| 22 |
+
# Only clone if the folder doesn't exist
|
| 23 |
+
if [ ! -d "FireTech-Messager-Server" ]; then
|
| 24 |
+
git clone https://github.com/dhurghamCreation/FireTech-Messager-Server.git
|
| 25 |
+
fi
|
| 26 |
+
cd FireTech-Messager-Server
|
| 27 |
+
npm install
|
| 28 |
+
|
| 29 |
+
# 4. Create .env Configuration
|
| 30 |
+
echo "Writing environment variables..."
|
| 31 |
+
cat <<EOF > .env
|
| 32 |
+
DATABASE_URL=postgresql://postgres@localhost:5432/railway
|
| 33 |
+
JWT_SECRET=firetech_secret_123
|
| 34 |
+
PORT=3000
|
| 35 |
+
EOF
|
| 36 |
+
|
| 37 |
+
# 5. Start Server
|
| 38 |
+
echo "-----------------------------------"
|
| 39 |
+
echo "FIRETECH SERVER IS STARTING..."
|
| 40 |
+
echo "-----------------------------------"
|
| 41 |
+
node server.js
|