Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

feat: Add Windows PowerShell deployment script and enhance deploy.sh with app reachability check

Khuram Niazcf543f49edb5
diff --git a/README.md b/README.md
index 3c6ea3a..5a638b8 100644
--- a/README.md
+++ b/README.md
@@ -73,6 +73,12 @@ From the project directory, run the deploy script to pull the latest changes and
curl -fsSL https://raw.githubusercontent.com/Gsync/jobsync/main/deploy.sh | sudo bash -s
```
+On **Windows**, run the PowerShell equivalent from the project directory instead (`deploy.sh` needs WSL or Git Bash; `deploy.ps1` runs natively):
+
+```powershell
+.\deploy.ps1
+```
+
>Note: If you are updating in a homelab environment, edit `NEXTAUTH_URL` in your `.env` file to use your server IP address instead of `localhost`. See `.env.example` for the expected format.
## Features in Detail
diff --git a/deploy.ps1 b/deploy.ps1
new file mode 100644
index 0000000..ded66a5
--- /dev/null
+++ b/deploy.ps1
@@ -0,0 +1,101 @@
+# JobSync Deployment Script (Windows / PowerShell)
+# Usage: .\deploy.ps1 [branch-name]
+# Example: .\deploy.ps1 main
+# Example: .\deploy.ps1 develop
+#
+# PowerShell equivalent of deploy.sh, for Windows hosts without WSL/Git Bash.
+# Requires: Docker Desktop and Git for Windows.
+
+param([string]$Branch = "main")
+
+$ErrorActionPreference = "Stop"
+# We check $LASTEXITCODE for native commands, so don't let them auto-throw
+# (PowerShell 7.3+ would otherwise abort the reachability retry loop).
+$PSNativeCommandUseErrorActionPreference = $false
+
+function Assert-LastExit($msg) {
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host $msg -ForegroundColor Red
+ exit $LASTEXITCODE
+ }
+}
+
+Write-Host "========================================" -ForegroundColor Yellow
+Write-Host "JobSync Deployment Script" -ForegroundColor Yellow
+Write-Host "========================================" -ForegroundColor Yellow
+Write-Host ""
+
+Set-Location -Path $PSScriptRoot
+Write-Host "[1/5] Current directory: $PSScriptRoot" -ForegroundColor Green
+Write-Host ""
+
+# Detect Docker Compose (v2 plugin or v1 standalone)
+docker compose version *> $null
+$UseV2 = ($LASTEXITCODE -eq 0)
+if (-not $UseV2) {
+ docker-compose version *> $null
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host "Error: Docker Compose not found" -ForegroundColor Red
+ exit 1
+ }
+}
+
+function Compose {
+ if ($UseV2) { & docker compose @args } else { & docker-compose @args }
+}
+
+Write-Host "Using: $(if ($UseV2) { 'docker compose' } else { 'docker-compose' })" -ForegroundColor Yellow
+Write-Host ""
+
+if (-not (Test-Path ".git")) {
+ Write-Host "Error: Not a git repository" -ForegroundColor Red
+ exit 1
+}
+
+Write-Host "[2/5] Fetching latest changes from GitHub..." -ForegroundColor Green
+git fetch origin
+Assert-LastExit "git fetch failed"
+
+Write-Host "[3/5] Checking out branch: $Branch" -ForegroundColor Green
+git checkout $Branch
+Assert-LastExit "git checkout failed"
+git pull origin $Branch
+Assert-LastExit "git pull failed"
+
+Write-Host "[4/5] Stopping existing containers..." -ForegroundColor Green
+Compose down
+Assert-LastExit "docker compose down failed"
+
+Write-Host "[5/5] Pulling latest images and starting containers..." -ForegroundColor Green
+Compose pull
+Assert-LastExit "docker compose pull failed"
+Compose up -d --force-recreate
+Assert-LastExit "docker compose up failed"
+
+# Poll the app until it actually responds, so the success message below only
+# prints once the app is reachable in a browser — not just "container started".
+# The probe runs inside the container (busybox wget is always in the image),
+# so the only host dependency is Docker itself. The loop exits the instant the
+# app answers; the 5-minute deadline is only a ceiling for a boot that never
+# comes up.
+Write-Host "Waiting for app to become reachable..." -ForegroundColor Yellow
+$deadline = (Get-Date).AddMinutes(5)
+while ($true) {
+ Compose exec -T app wget --spider -q http://127.0.0.1:3737 *> $null
+ if ($LASTEXITCODE -eq 0) { break }
+ if ((Get-Date) -ge $deadline) {
+ Write-Host "App did not become reachable within 5 minutes." -ForegroundColor Red
+ Compose logs --tail=40
+ exit 1
+ }
+ Start-Sleep -Seconds 2
+}
+
+Write-Host ""
+Write-Host "========================================" -ForegroundColor Green
+Write-Host "Deployment completed successfully!" -ForegroundColor Green
+Write-Host "========================================" -ForegroundColor Green
+Write-Host ""
+Write-Host "Branch: $Branch" -ForegroundColor Yellow
+Write-Host ""
+Compose ps
diff --git a/deploy.sh b/deploy.sh
index 1e14c28..a9977d9 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -66,6 +66,24 @@ echo -e "${GREEN}[5/5]${NC} Pulling latest images and starting containers..."
$COMPOSE_CMD pull
$COMPOSE_CMD up -d --force-recreate
+# Poll the app until it actually responds, so the success message below only
+# prints once the app is reachable in a browser — not just "container started".
+# The probe runs *inside* the container (busybox wget is always in the image),
+# so the only host dependency is Docker itself — works on Windows, macOS,
+# Raspberry Pi, etc. without needing curl/wget on the host. The loop exits the
+# instant the app answers; the 5-minute deadline is only a ceiling for a boot
+# that never comes up.
+echo -e "${YELLOW}Waiting for app to become reachable...${NC}"
+DEADLINE=$((SECONDS + 300))
+until $COMPOSE_CMD exec -T app wget --spider -q http://127.0.0.1:3737 >/dev/null 2>&1; do
+ if [ "$SECONDS" -ge "$DEADLINE" ]; then
+ echo -e "${RED}App did not become reachable within 5 minutes.${NC}"
+ $COMPOSE_CMD logs --tail=40
+ exit 1
+ fi
+ sleep 2
+done
+
echo ""
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN}Deployment completed successfully!${NC}"