-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ps1
More file actions
127 lines (103 loc) · 4.92 KB
/
deploy.ps1
File metadata and controls
127 lines (103 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# # Fly.io Deployment Script for Pulsefeed
# # Run this PowerShell script to deploy your app to Fly.io
# param(
# [string]$AppName = ""
# )
# Write-Host "Pulsefeed Deployment to Fly.io" -ForegroundColor Cyan
# Write-Host "========================================`n" -ForegroundColor Cyan
# # Check if flyctl is installed
# Write-Host "Checking for Fly CLI..." -ForegroundColor Yellow
# if (!(Get-Command fly -ErrorAction SilentlyContinue)) {
# Write-Host "[X] Fly CLI not found. Installing..." -ForegroundColor Red
# powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"
# Write-Host "[OK] Fly CLI installed. Please restart your terminal and run this script again." -ForegroundColor Green
# exit
# }
# Write-Host "[OK] Fly CLI found`n" -ForegroundColor Green
# # Authenticate with Fly.io
# Write-Host "Authenticating with Fly.io..." -ForegroundColor Yellow
# fly auth login
# if ($LASTEXITCODE -ne 0) {
# Write-Host "[X] Authentication failed. Please try again." -ForegroundColor Red
# exit 1
# }
# Write-Host "[OK] Authenticated`n" -ForegroundColor Green
# # Ask for app name if not provided
# if ([string]::IsNullOrWhiteSpace($AppName)) {
# $AppName = Read-Host "Enter your app name (or press Enter for 'bos-checklist-app')"
# if ([string]::IsNullOrWhiteSpace($AppName)) {
# $AppName = "bos-checklist-app"
# }
# }
# # Convert to lowercase and replace spaces with hyphens
# $AppName = $AppName.ToLower() -replace '\s+', '-'
# Write-Host "Using app name: $AppName`n" -ForegroundColor Cyan
# # Ask for region
# Write-Host "Available regions:" -ForegroundColor Yellow
# Write-Host " ord - Chicago, IL (US)" -ForegroundColor White
# Write-Host " iad - Ashburn, VA (US)" -ForegroundColor White
# Write-Host " lax - Los Angeles, CA (US)" -ForegroundColor White
# Write-Host " ewr - Secaucus, NJ (US)" -ForegroundColor White
# Write-Host " lhr - London (UK)" -ForegroundColor White
# Write-Host " fra - Frankfurt (Germany)" -ForegroundColor White
# Write-Host " syd - Sydney (Australia)" -ForegroundColor White
# $region = Read-Host "`nChoose region (default: ord)"
# if ([string]::IsNullOrWhiteSpace($region)) {
# $region = "ord"
# }
# # Update fly.toml with app name and region
# Write-Host "`nUpdating configuration..." -ForegroundColor Yellow
# $flyToml = Get-Content fly.toml
# $flyToml = $flyToml -replace 'app = "bos-checklist-app"', "app = `"$AppName`""
# $flyToml = $flyToml -replace 'primary_region = "ord"', "primary_region = `"$region`""
# $flyToml | Set-Content fly.toml
# Write-Host "[OK] Configuration updated`n" -ForegroundColor Green
# # Launch app
# Write-Host "Launching app on Fly.io..." -ForegroundColor Yellow
# fly launch --name $AppName --region $region --no-deploy
# if ($LASTEXITCODE -ne 0) {
# Write-Host "[X] App launch failed." -ForegroundColor Red
# exit 1
# }
# # Create persistent volume
# Write-Host "`nCreating persistent volume for database..." -ForegroundColor Yellow
# fly volumes create bos_data --region $region --size 1
# if ($LASTEXITCODE -ne 0) {
# Write-Host "[X] Volume creation failed." -ForegroundColor Red
# exit 1
# }
# Write-Host "[OK] Volume created`n" -ForegroundColor Green
# # Generate and set secret key
# Write-Host "Generating secure SECRET_KEY..." -ForegroundColor Yellow
# $secretKey = python -c "import secrets; print(secrets.token_hex(32))"
# fly secrets set SECRET_KEY=$secretKey
# if ($LASTEXITCODE -ne 0) {
# Write-Host "[X] Secret key setup failed." -ForegroundColor Red
# exit 1
# }
# Write-Host "[OK] Secret key configured`n" -ForegroundColor Green
# # Deploy
# Write-Host "Deploying application..." -ForegroundColor Yellow
# fly deploy
# if ($LASTEXITCODE -ne 0) {
# Write-Host "[X] Deployment failed." -ForegroundColor Red
# exit 1
# }
# Write-Host "`n[OK] Deployment successful!`n" -ForegroundColor Green
# # Open app
# Write-Host "Opening your app in browser..." -ForegroundColor Yellow
# fly open
# Write-Host "`n========================================" -ForegroundColor Cyan
# Write-Host "SUCCESS! Your app is now live!" -ForegroundColor Green
# Write-Host "`nYour app URL: https://$AppName.fly.dev" -ForegroundColor Cyan
# Write-Host "`nNext steps:" -ForegroundColor Yellow
# Write-Host " 1. Create an invite code to register your first user" -ForegroundColor White
# Write-Host " 2. Run: fly ssh console" -ForegroundColor Cyan
# Write-Host " 3. In the console, run: python" -ForegroundColor Cyan
# Write-Host " 4. Copy/paste the Python code from DEPLOYMENT.md" -ForegroundColor Cyan
# Write-Host "`nUseful commands:" -ForegroundColor Yellow
# Write-Host " fly logs - View application logs" -ForegroundColor White
# Write-Host " fly status - Check app status" -ForegroundColor White
# Write-Host " fly dashboard - Open web dashboard" -ForegroundColor White
# Write-Host " fly ssh console - SSH into your app" -ForegroundColor White
# Write-Host "`n========================================" -ForegroundColor Cyan