β Working FastAPI + Docker + ngrok Setup
π― Current Status: WORKING!
Your development environment is successfully set up with:
- β Redis running in Docker
- β ngrok exposing your local server publicly
- β FastAPI server running locally
- β
Public HTTPS URL:
https://d4e9601ecb72.ngrok-free.app
π Quick Start Commands
1. Start Services (Redis + ngrok)
./start-services.sh
2. Start FastAPI Server
# Simple working version
python simple_app.py
# Or the full version (once config is fixed)
python -m uvicorn src.app.main:app --reload --host 0.0.0.0 --port 8000
3. Get Your Public URL
curl -s http://localhost:4040/api/tunnels | jq -r '.tunnels[0].public_url'
π Your URLs
- Local API: http://localhost:8000
- Public API: https://d4e9601ecb72.ngrok-free.app
- API Docs: https://d4e9601ecb72.ngrok-free.app/docs (when using simple_app.py)
- ngrok Dashboard: http://localhost:4040
- Redis: localhost:6379
π§ Configure Clerk Webhook
Now you can set up your Clerk webhook:
- Go to Clerk Dashboard
- Navigate to Webhooks β Add Endpoint
- Enter your webhook URL:
https://d4e9601ecb72.ngrok-free.app/api/v1/auth/webhooks/clerk - Select events:
user.created,user.updated,user.deleted,session.created,session.ended - Copy the Signing Secret and add to your
.env:CLERK_WEBHOOK_SECRET=whsec_your_webhook_signing_secret_here
π Available Endpoints (Simple App)
GET /- Welcome messageGET /health- Health checkGET /config- Configuration info
Test them:
curl https://d4e9601ecb72.ngrok-free.app/
curl https://d4e9601ecb72.ngrok-free.app/health
curl https://d4e9601ecb72.ngrok-free.app/config
π οΈ Service Management
Check Services
# Check Redis
redis-cli ping
# Check ngrok tunnels
curl -s http://localhost:4040/api/tunnels
# Check Docker containers
docker ps
Stop Services
# Stop all related containers
docker stop $(docker ps -q --filter 'ancestor=redis:7-alpine' --filter 'ancestor=ngrok/ngrok:latest')
Restart Services
./start-services.sh
π Troubleshooting
If ngrok URL changes:
The ngrok URL will change each time you restart ngrok (unless you have a paid plan). Get the new URL with:
curl -s http://localhost:4040/api/tunnels | jq -r '.tunnels[0].public_url'
If Redis connection fails:
# Check if Redis is running
docker ps | grep redis
# Restart Redis if needed
docker restart $(docker ps -q --filter 'ancestor=redis:7-alpine')
If FastAPI config fails:
Use the simple app for now:
python simple_app.py
π Next Steps
- Test your webhook: Use the public URL to set up Clerk webhooks
- Fix the main FastAPI app: The config parsing issue needs to be resolved
- Add authentication: Implement Clerk authentication middleware
- Add your business logic: Build your video generation endpoints
π Working Files
start-services.sh- Starts Redis and ngroksimple_app.py- Working FastAPI applicationsimple_config.py- Working configuration.env- Environment variables (configured)
Your development environment is ready for webhook testing! π