Skip to content

Latest commit

 

History

History
162 lines (131 loc) · 4.13 KB

File metadata and controls

162 lines (131 loc) · 4.13 KB

🚀 Azure Deployment Guide - משפחת עשור Fight Tracker

Prerequisites

  • Azure account
  • Azure CLI installed (brew install azure-cli on macOS)
  • Git installed

Quick Deploy to Azure App Service

1. Login to Azure

az login

2. Create Resource Group

az group create --name eshor-fights-rg --location westeurope

3. Create Azure PostgreSQL Database

# Create PostgreSQL server
az postgres flexible-server create \
  --resource-group eshor-fights-rg \
  --name eshor-fights-db \
  --location westeurope \
  --admin-user eshoradmin \
  --admin-password YOUR_SECURE_PASSWORD_HERE \
  --sku-name Standard_B1ms \
  --tier Burstable \
  --version 14

# Create database
az postgres flexible-server db create \
  --resource-group eshor-fights-rg \
  --server-name eshor-fights-db \
  --database-name fighttracker

# Allow Azure services to connect
az postgres flexible-server firewall-rule create \
  --resource-group eshor-fights-rg \
  --name eshor-fights-db \
  --rule-name AllowAzureServices \
  --start-ip-address 0.0.0.0 \
  --end-ip-address 0.0.0.0

4. Create App Service

# Create App Service Plan
az appservice plan create \
  --name eshor-fights-plan \
  --resource-group eshor-fights-rg \
  --sku B1 \
  --is-linux

# Create Web App
az webapp create \
  --resource-group eshor-fights-rg \
  --plan eshor-fights-plan \
  --name eshor-fights-app \
  --runtime "PYTHON:3.11"

5. Configure Environment Variables

# Get your PostgreSQL connection string
# Format: postgresql://eshoradmin:YOUR_PASSWORD@eshor-fights-db.postgres.database.azure.com:5432/fighttracker?sslmode=require

az webapp config appsettings set \
  --resource-group eshor-fights-rg \
  --name eshor-fights-app \
  --settings \
    DATABASE_URL="postgresql://eshoradmin:YOUR_PASSWORD@eshor-fights-db.postgres.database.azure.com:5432/fighttracker?sslmode=require" \
    SECRET_KEY="$(python3 -c 'import secrets; print(secrets.token_hex(32))')" \
    FLASK_DEBUG="False"

6. Configure Startup Command

az webapp config set \
  --resource-group eshor-fights-rg \
  --name eshor-fights-app \
  --startup-file "gunicorn --bind=0.0.0.0 --timeout 600 wsgi:app"

7. Deploy the Code

# Initialize git if not already
git init
git add .
git commit -m "Initial commit"

# Deploy using Azure CLI
az webapp deployment source config-local-git \
  --resource-group eshor-fights-rg \
  --name eshor-fights-app

# Get the deployment URL and push
git remote add azure <deployment-url-from-above>
git push azure main

Alternative: Deploy via GitHub Actions

  1. Go to Azure Portal → Your Web App → Deployment Center
  2. Connect to your GitHub repository
  3. Azure will automatically create a GitHub Actions workflow

Local Development

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run locally (uses SQLite)
python app.py

Visit: http://localhost:5000

Default Users

שם משתמש סיסמה התחלתית הערות
נתי נתי יש לשנות בכניסה ראשונה
קובי קובי יש לשנות בכניסה ראשונה
מיכל מיכל יש לשנות בכניסה ראשונה
גלית גלית יש לשנות בכניסה ראשונה
אביבית אביבית יש לשנות בכניסה ראשונה
עלמא עלמא יש לשנות בכניסה ראשונה
אמיליה אמיליה יש לשנות בכניסה ראשונה
admin Oren203038500 מנהל מערכת

Estimated Costs (Azure)

  • App Service B1: ~$13/month
  • PostgreSQL Burstable B1ms: ~$15/month
  • Total: ~$28/month

💡 Tip: For even lower costs, use the Free tier for App Service during testing.

Troubleshooting

Check Logs

az webapp log tail --resource-group eshor-fights-rg --name eshor-fights-app

SSH into Container

az webapp ssh --resource-group eshor-fights-rg --name eshor-fights-app

Restart App

az webapp restart --resource-group eshor-fights-rg --name eshor-fights-app