File size: 3,480 Bytes
50a7bf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
128
129
130
131
# βœ… 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)
```bash

./start-services.sh

```

### 2. Start FastAPI Server
```bash

# 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
```bash

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:



1. Go to [Clerk Dashboard](https://dashboard.clerk.com/)

2. Navigate to **Webhooks** β†’ **Add Endpoint**

3. Enter your webhook URL:

   ```

   https://d4e9601ecb72.ngrok-free.app/api/v1/auth/webhooks/clerk

   ```

4. Select events: `user.created`, `user.updated`, `user.deleted`, `session.created`, `session.ended`

5. Copy the **Signing Secret** and add to your `.env`:

   ```env

   CLERK_WEBHOOK_SECRET=whsec_your_webhook_signing_secret_here
   ```



## πŸ“ Available Endpoints (Simple App)



- `GET /` - Welcome message

- `GET /health` - Health check

- `GET /config` - Configuration info



Test them:

```bash

curl https://d4e9601ecb72.ngrok-free.app/

curl https://d4e9601ecb72.ngrok-free.app/health

curl https://d4e9601ecb72.ngrok-free.app/config

```

## πŸ› οΈ Service Management

### Check Services
```bash

# Check Redis

redis-cli ping



# Check ngrok tunnels

curl -s http://localhost:4040/api/tunnels



# Check Docker containers

docker ps

```

### Stop Services
```bash

# Stop all related containers

docker stop $(docker ps -q --filter 'ancestor=redis:7-alpine' --filter 'ancestor=ngrok/ngrok:latest')

```

### Restart Services
```bash

./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:
```bash

curl -s http://localhost:4040/api/tunnels | jq -r '.tunnels[0].public_url'

```

### If Redis connection fails:
```bash

# 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:
```bash

python simple_app.py

```

## πŸŽ‰ Next Steps

1. **Test your webhook**: Use the public URL to set up Clerk webhooks
2. **Fix the main FastAPI app**: The config parsing issue needs to be resolved
3. **Add authentication**: Implement Clerk authentication middleware
4. **Add your business logic**: Build your video generation endpoints

## πŸ“‹ Working Files

- `start-services.sh` - Starts Redis and ngrok
- `simple_app.py` - Working FastAPI application
- `simple_config.py` - Working configuration
- `.env` - Environment variables (configured)

Your development environment is ready for webhook testing! πŸš€