Skip to content

Commit e4b2c73

Browse files
committed
feat: update Kubernetes deployment and service configurations to set replica count to 1, add WebSocket container command, and include Vercel environment variables
1 parent cd01da1 commit e4b2c73

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

k8s/deployment.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: ${AZURE_DEPLOYMENT_NAME}
55
spec:
6-
replicas: 2
6+
replicas: 1
77
selector:
88
matchLabels:
99
app: ${AZURE_APP_NAME}
@@ -15,6 +15,15 @@ spec:
1515
containers:
1616
- name: ${AZURE_CONTAINER_NAME}
1717
image: ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}
18+
command: ["/bin/sh", "-c"]
19+
args: ["/app/server/scripts/start-ws-server.sh --prod --cloud"]
20+
env:
21+
- name: VERCEL_TOKEN
22+
value: "${VERCEL_TOKEN}"
23+
- name: VERCEL_ORG_ID
24+
value: "${VERCEL_ORG_ID}"
25+
- name: VERCEL_PROJECT_ID
26+
value: "${VERCEL_PROJECT_ID}"
1827
ports:
1928
- containerPort: 3000
2029
- containerPort: 50000

k8s/service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ spec:
1616
targetPort: 3000
1717
- name: ws
1818
port: 50000
19+
protocol: TCP
1920
targetPort: 50000

scripts/deploy-containers-to-azure.sh

100644100755
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ echo "Reserved static public IP for WebSocket: $WS_INGRESS_IP"
246246
# Prepare and apply deployment manifest
247247
echo "Preparing deployment manifest..."
248248
export DOCKER_IMAGE_NAME DOCKER_IMAGE_TAG FORCE_REVISION_TIMESTAMP AZURE_BROWSERLESS_SERVICE_NAME
249+
# Add container command and Vercel environment variables
250+
export CONTAINER_CMD="/app/server/scripts/start-ws-server.sh --prod --cloud"
251+
export VERCEL_TOKEN VERCEL_ORG_ID VERCEL_PROJECT_ID
249252
cat k8s/deployment.yaml | envsubst >deployment.yaml
250253
echo "Applying deployment manifest..."
251254
kubectl apply -f deployment.yaml || {
@@ -649,3 +652,18 @@ echo " kubectl logs -n ingress-nginx -l app.kubernetes.io/component=controll
649652
echo ""
650653
echo " 4. Test internal connectivity:"
651654
echo " kubectl run -i --tty --rm debug --image=curlimages/curl --restart=Never -- curl -v http://${AZURE_BROWSERLESS_SERVICE_NAME}:50000"
655+
656+
# Add WebSocket fallback strategy
657+
echo ""
658+
echo "For WebSocket connectivity issues, consider these options:"
659+
echo " 1. Continue using the ingress WSS connection: wss://ws.${AZURE_DOMAIN_NAME}"
660+
echo " 2. Use direct WebSocket connection: ws://${WS_SERVICE_IP}:50000"
661+
echo ""
662+
echo "Alternative DNS configuration for more reliable WebSocket connections:"
663+
echo " You can point the ws.${AZURE_DOMAIN_NAME} domain directly to the dedicated WebSocket service:"
664+
if [ "$WS_SERVICE_IP" != "Not found" ]; then
665+
echo " - Update your DNS for ws.${AZURE_DOMAIN_NAME} to point to: ${WS_SERVICE_IP}"
666+
echo " - Use the ws:// protocol instead of wss:// (direct WebSocket service doesn't use TLS)"
667+
else
668+
echo " - WebSocket service IP not found. Check with: kubectl get service browserless-websocket"
669+
fi

0 commit comments

Comments
 (0)