Modern ERP Reports Application with microservices architecture Tech Stack: - Backend: FastAPI + python-oracledb (Oracle DB integration) - Frontend: Vue.js 3 + PrimeVue + Vite - Telegram Bot: python-telegram-bot + SQLite - Infrastructure: Shared database pool, JWT authentication, SSH tunnel Features: - FastAPI backend with async Oracle connection pool - Vue.js 3 responsive frontend with PrimeVue components - Telegram bot alternative interface - Microservices architecture with shared components - Complete deployment support (Linux Docker + Windows IIS) - Comprehensive testing (Playwright E2E + pytest) Repository Structure: - reports-app/ - Main application (backend, frontend, telegram-bot) - shared/ - Shared components (database pool, auth, utils) - deployment/ - Deployment scripts (Linux & Windows) - docs/ - Project documentation - security/ - Security scanning and git hooks
71 lines
2.4 KiB
PowerShell
71 lines
2.4 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Start ROA2WEB Telegram Bot Service
|
|
|
|
.DESCRIPTION
|
|
Starts the ROA2WEB Telegram Bot Windows service and validates it's running properly.
|
|
|
|
.EXAMPLE
|
|
.\Start-TelegramBot.ps1
|
|
#>
|
|
|
|
[CmdletBinding()]
|
|
param(
|
|
[string]$ServiceName = "ROA2WEB-TelegramBot",
|
|
[int]$Timeout = 30,
|
|
[int]$HealthPort = 8002
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
Write-Host "`n[*] Starting ROA2WEB Telegram Bot Service..." -ForegroundColor Cyan
|
|
|
|
try {
|
|
$service = Get-Service -Name $ServiceName -ErrorAction Stop
|
|
|
|
if ($service.Status -eq "Running") {
|
|
Write-Host " [OK] Service is already running" -ForegroundColor Green
|
|
exit 0
|
|
}
|
|
|
|
# Start service
|
|
Start-Service -Name $ServiceName
|
|
Write-Host " [*] Service start command issued" -ForegroundColor Yellow
|
|
|
|
# Wait for service to start
|
|
$elapsed = 0
|
|
while ($service.Status -ne "Running" -and $elapsed -lt $Timeout) {
|
|
Start-Sleep -Seconds 1
|
|
$service.Refresh()
|
|
$elapsed++
|
|
Write-Host " [*] Waiting for service to start... ($elapsed/$Timeout)" -ForegroundColor Yellow
|
|
}
|
|
|
|
if ($service.Status -eq "Running") {
|
|
Write-Host " [OK] Service started successfully" -ForegroundColor Green
|
|
|
|
# Wait a bit and test health endpoint
|
|
Start-Sleep -Seconds 5
|
|
try {
|
|
$response = Invoke-WebRequest -Uri "http://localhost:$HealthPort/internal/health" -UseBasicParsing -TimeoutSec 10
|
|
if ($response.StatusCode -eq 200) {
|
|
$content = $response.Content | ConvertFrom-Json
|
|
Write-Host " [OK] Health check passed: $($content.status)" -ForegroundColor Green
|
|
Write-Host " [OK] Database: $($content.database.status)" -ForegroundColor Green
|
|
}
|
|
} catch {
|
|
Write-Host " [WARN] Health check failed (service may still be starting): $_" -ForegroundColor Yellow
|
|
Write-Host " Check logs: C:\inetpub\wwwroot\roa2web\telegram-bot\logs\stderr.log" -ForegroundColor Yellow
|
|
}
|
|
|
|
exit 0
|
|
} else {
|
|
Write-Host " [ERROR] Service failed to start (Status: $($service.Status))" -ForegroundColor Red
|
|
Write-Host " Check logs: C:\inetpub\wwwroot\roa2web\telegram-bot\logs\stderr.log" -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
} catch {
|
|
Write-Host " [ERROR] Failed to start service: $_" -ForegroundColor Red
|
|
exit 1
|
|
}
|