Dhurgh commited on
Commit
74f0ce7
Β·
unverified Β·
1 Parent(s): 59b6f66

Refactor deploy script for Arch Linux installation

Browse files

Updated deployment script for Arch Linux setup and removed GitHub push functionality.

Files changed (1) hide show
  1. deploy.ps1 +38 -47
deploy.ps1 CHANGED
@@ -1,50 +1,41 @@
1
- # FireTech Messenger Auto-Deployment Script
2
- # This script commits and pushes code to GitHub, triggering Railway auto-deploy
3
- # Usage: .\deploy.ps1 "your commit message"
4
 
5
- param(
6
- [string]$Message = "Auto-deploy update"
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
- Write-Host "πŸ“€ Pushing to GitHub (triggers Railway auto-deploy)..." -ForegroundColor Yellow
39
- git push origin main
40
-
41
- if ($LASTEXITCODE -eq 0) {
42
- Write-Host "" -ForegroundColor Green
43
- Write-Host "βœ… Push successful!" -ForegroundColor Green
44
- Write-Host "πŸŽ‰ Railway is now auto-deploying from GitHub..." -ForegroundColor Green
45
- Write-Host " Check dashboard: https://railway.app/" -ForegroundColor Cyan
46
- Write-Host "" -ForegroundColor Green
47
- } else {
48
- Write-Host "❌ Push failed. Check your GitHub credentials." -ForegroundColor Red
49
- exit 1
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