Python Backend (Azure Container Apps)
The Python backend provides memory and AI processing services, deployed to Azure Container Apps with automated CI/CD.Deployment Overview
- Platform: Azure Container Apps
- Workflow:
.github/workflows/backend-deploy.yml - Container Registry: Docker Hub (
thecubestar/tabby-backend) - Production URL: tabby-backend.jollydesert-22a4756c.centralindia.azurecontainerapps.io
- Trigger: Push to
backend/directory onmainbranch
Prerequisites
Configure Azure resources
Create the following Azure resources:
- Resource Group:
tabby-rg(or your preferred name) - Container App:
tabby-backend - Container Apps Environment: Required for running the container app
You can create these via Azure Portal or Azure CLI. The deployment workflow assumes these resources already exist.
Docker Configuration
The backend uses a multi-stage Python 3.12 Dockerfile (backend/Dockerfile:1-24):
- Uses uv for fast dependency management
- Python 3.12 slim base image for minimal size
- Runs uvicorn ASGI server on port 8000
- Production-ready with
--frozendependency installation
Deployment Workflow
The Azure deployment workflow automatically triggers when:Build Docker image
The workflow builds a Docker image using buildx with caching:Each build creates two tags:
latest: Points to the most recent build<git-sha>: Immutable tag for the specific commit
Environment Variables
The workflow sets these environment variables:Modify these values in
.github/workflows/backend-deploy.yml if you use different resource names.Manual Deployment
To deploy manually:Next.js Backend (Vercel)
The Next.js shared API backend provides common API endpoints, deployed to Vercel.Deployment Overview
- Platform: Vercel
- Workflow:
.github/workflows/vercel-deploy.yml - Production URL: tabby-api-psi.vercel.app
- Trigger: Push to
nextjs-backend/directory onmainbranch
Prerequisites
Create Vercel project
- Sign in to Vercel
- Create a new project from your repository
- Set the root directory to
nextjs-backend - Note the Organization ID and Project ID
Generate Vercel token
- Go to Settings → Tokens in Vercel dashboard
- Create a new token with appropriate scopes
- Save the token securely
Deployment Workflow
The Vercel deployment workflow (.github/workflows/vercel-deploy.yml:1-22) automatically deploys on changes:
Environment Variables in Vercel
Configure environment variables in Vercel dashboard:- Go to your project Settings → Environment Variables
- Add required variables for your Next.js backend
- Set appropriate environments (Production, Preview, Development)
Monitoring Deployments
Azure Container Apps
Monitor your Python backend:- Azure Portal: View logs and metrics in Container Apps
- Application Insights: Configure for detailed telemetry
- GitHub Actions: Check workflow runs for deployment status
Vercel
Monitor your Next.js backend:- Vercel Dashboard: View deployment logs and analytics
- GitHub Actions: Check workflow status
- Vercel CLI: Use
vercel logsfor real-time logs
Rollback Procedures
Azure Container Apps
Rollback to a previous image:Vercel
- Go to Deployments in Vercel dashboard
- Find the previous successful deployment
- Click Promote to Production
Troubleshooting
Azure Deployment Fails
- Check Azure credentials are valid and have proper permissions
- Verify Docker Hub credentials in GitHub Secrets
- Review workflow logs for specific error messages
- Ensure resource group and container app exist
Vercel Deployment Fails
- Verify Vercel token is valid
- Check organization ID and project ID are correct
- Review build logs in Vercel dashboard
- Ensure
nextjs-backenddirectory has valid Next.js project
Container App Not Starting
- Check application logs in Azure Portal
- Verify environment variables are set correctly
- Test Docker image locally before deploying
- Ensure port 8000 is exposed and application binds to
0.0.0.0