Spaces:
Runtime error
Runtime error
Refactor deploy script for Arch Linux installation
Browse filesUpdated deployment script for Arch Linux setup and removed GitHub push functionality.
- deploy.ps1 +38 -47
deploy.ps1
CHANGED
|
@@ -1,50 +1,41 @@
|
|
| 1 |
-
# FireTech Messenger
|
| 2 |
-
|
| 3 |
-
# Usage: .\deploy.ps1 "your commit message"
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
Write-Host "π FireTech Messenger Deployment Handler" -ForegroundColor Cyan
|
| 10 |
-
Write-Host "========================================" -ForegroundColor Cyan
|
| 11 |
-
Write-Host ""
|
| 12 |
-
|
| 13 |
-
# Verify git is available
|
| 14 |
-
$gitExists = git --version 2>$null
|
| 15 |
-
if (-not $gitExists) {
|
| 16 |
-
Write-Host "β Git not found. Please install Git for Windows." -ForegroundColor Red
|
| 17 |
-
exit 1
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
# Check git status
|
| 21 |
-
$status = git status --porcelain
|
| 22 |
-
if ([string]::IsNullOrWhiteSpace($status)) {
|
| 23 |
-
Write-Host "β
No changes to commit. Repository is clean." -ForegroundColor Green
|
| 24 |
-
exit 0
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
Write-Host "π Staging changes..." -ForegroundColor Yellow
|
| 28 |
-
git add -A
|
| 29 |
-
|
| 30 |
-
Write-Host "πΎ Committing with message: '$Message'" -ForegroundColor Yellow
|
| 31 |
-
git commit -m "$Message"
|
| 32 |
-
|
| 33 |
-
if ($LASTEXITCODE -ne 0) {
|
| 34 |
-
Write-Host "β Commit failed." -ForegroundColor Red
|
| 35 |
-
exit 1
|
| 36 |
}
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FireTech Messenger - Arch Linux Auto-Deployer
|
| 2 |
+
Write-Host "Starting FireTech Arch Deployment..." -ForegroundColor Cyan
|
|
|
|
| 3 |
|
| 4 |
+
# 1. Install Arch if not present
|
| 5 |
+
if (!(wsl -l | Select-String "archlinux")) {
|
| 6 |
+
Write-Host "Installing Arch Linux..." -ForegroundColor Yellow
|
| 7 |
+
wsl --install archlinux
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
|
| 10 |
+
# 2. Run the setup commands inside Arch
|
| 11 |
+
Write-Host "Configuring Arch Linux Environment..." -ForegroundColor Yellow
|
| 12 |
+
wsl -d archlinux -u root -- bash -c @"
|
| 13 |
+
# Update and Install
|
| 14 |
+
pacman -Syu --noconfirm
|
| 15 |
+
pacman -S --noconfirm git nodejs npm postgresql sudo nano
|
| 16 |
+
|
| 17 |
+
# Setup Database
|
| 18 |
+
mkdir -p /run/postgresql
|
| 19 |
+
chown postgres:postgres /run/postgresql
|
| 20 |
+
sudo -u postgres initdb -D /var/lib/postgres/data
|
| 21 |
+
sudo -u postgres postgres -D /var/lib/postgres/data > /dev/null 2>&1 &
|
| 22 |
+
sleep 3
|
| 23 |
+
sudo -u postgres createdb railway
|
| 24 |
+
|
| 25 |
+
# Clone and Install App
|
| 26 |
+
cd ~
|
| 27 |
+
git clone https://github.com/dhurghamCreation/FireTech-Messager-Server.git
|
| 28 |
+
cd FireTech-Messager-Server
|
| 29 |
+
npm install
|
| 30 |
+
|
| 31 |
+
# Create .env
|
| 32 |
+
echo "DATABASE_URL=postgresql://postgres@localhost:5432/railway" > .env
|
| 33 |
+
echo "JWT_SECRET=firetech_secret_123" >> .env
|
| 34 |
+
echo "PORT=3000" >> .env
|
| 35 |
+
|
| 36 |
+
# Start Server
|
| 37 |
+
Write-Host "SERVER IS STARTING..."
|
| 38 |
+
node server.js
|
| 39 |
+
"@
|
| 40 |
+
|
| 41 |
+
Write-Host "Deployment Finished!" -ForegroundColor Green
|