Spaces:
Sleeping
Sleeping
File size: 1,688 Bytes
f4beda6 | 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 | #!/bin/bash
RENDER_API_KEY="rnd_qDpbevpSatUQfUtbVGH70C6mnoGA"
GITHUB_REPO="https://github.com/koersenm70/TAM"
SERVICE_NAME="leadgen"
SECRET_KEY="supersecretkey123"
echo "🚀 Deploying to Render..."
# Get owner ID
OWNER_ID=$(curl -s -H "Authorization: Bearer $RENDER_API_KEY" \
"https://api.render.com/v1/owners?limit=1" | python3 -c "import sys,json; print(json.load(sys.stdin)[0]['owner']['id'])")
echo "Owner ID: $OWNER_ID"
# Create the web service
RESPONSE=$(curl -s -X POST "https://api.render.com/v1/services" \
-H "Authorization: Bearer $RENDER_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"type\": \"web_service\",
\"name\": \"$SERVICE_NAME\",
\"ownerId\": \"$OWNER_ID\",
\"repo\": \"$GITHUB_REPO\",
\"branch\": \"main\",
\"serviceDetails\": {
\"runtime\": \"docker\",
\"dockerfilePath\": \"./Dockerfile\",
\"healthCheckPath\": \"/health\",
\"envSpecificDetails\": {
\"buildCommand\": \"\",
\"startCommand\": \"\"
}
},
\"envVars\": [
{ \"key\": \"PORT\", \"value\": \"8000\" },
{ \"key\": \"SECRET_KEY\", \"value\": \"$SECRET_KEY\" }
]
}")
echo "$RESPONSE" | python3 -c "
import sys, json
data = json.load(sys.stdin)
if 'service' in data:
svc = data['service']
print('✅ Service created!')
print(' Name:', svc.get('name'))
print(' ID: ', svc.get('id'))
print(' URL: https://' + svc.get('serviceDetails', {}).get('url', '(deploying...)'))
print()
print('⏳ Build is starting. Check progress at:')
print(' https://dashboard.render.com/web/' + svc.get('id'))
else:
print('❌ Error:', json.dumps(data, indent=2))
"
|