Skip to content

Commit

Permalink
try to fix linter; roll back nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishekbhagwat committed Oct 29, 2024
1 parent c8ea058 commit 5ea0079
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 166 deletions.
8 changes: 8 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ESG
Eliud
Embs
Envane
envsubst
Esin
Eventarc
FAISS
Expand Down Expand Up @@ -115,6 +116,7 @@ GmbH
Googlers
HDFC
HIDPI
HIGHCPU
HMO
HREDRAW
HSA
Expand Down Expand Up @@ -163,6 +165,7 @@ Kipchoge
Knopf
Kohli
Kraizt
KSA
Kubeflow
Kudrow
LCEL
Expand Down Expand Up @@ -218,6 +221,7 @@ Niitsuma
Nintendo
Nominatim
Noogler
novnc
ODb
OOTB
Oberst
Expand Down Expand Up @@ -799,11 +803,13 @@ vapo
vectordb
vertexai
vesselin
vnc
vtotal
waterjet
wcontext
wcslen
websites
webpages
welcom
wiffle
windspeed
Expand All @@ -814,13 +820,15 @@ wparam
wscore
wscores
wstring
WXGA
xaxes
xaxis
xcassets
xcconfig
xcodeproj
xcscheme
xctest
XGA
xlabel
xmltodict
xsi
Expand Down
8 changes: 4 additions & 4 deletions partner-models/claude/computer-use-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Please use [this form](https://forms.gle/BT1hpBrqDPDUrCqo7) to provide feedback
## Quickstart: Deploying the app on Google Cloud using GKE and Cloud Build

We provide a simplied way to deploy this app on Google Cloud using Google Kubernetes Engine (GKE). To set this up, follow the steps below.
We provide a simplified way to deploy this app on Google Cloud using Google Kubernetes Engine (GKE). To set this up, follow the steps below.

1. Set up the environment variables

Expand Down Expand Up @@ -93,9 +93,9 @@ The container stores settings like the API key and custom system prompt in `~/.a
Alternative access points:
- Streamlit interface only: [http://localhost:8501](http://localhost:8501)
- Desktop view only: [http://localhost:6080/vnc.html](http://localhost:6080/vnc.html)
- Direct VNC connection: `vnc://localhost:5900` (for VNC clients)
* Streamlit interface only: [http://localhost:8501](http://localhost:8501)
* Desktop view only: [http://localhost:6080/vnc.html](http://localhost:6080/vnc.html)
* Direct VNC connection: `vnc://localhost:5900` (for VNC clients)
## Screen size
Expand Down
14 changes: 14 additions & 0 deletions partner-models/claude/computer-use-demo/cloudbuild-destroy.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
- id: 'delete-k8s-resources'
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
Expand Down
20 changes: 6 additions & 14 deletions partner-models/claude/computer-use-demo/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,18 @@ steps:
--quiet
fi
- id: 'pull-tag-push-image'
- id: 'build-push-image'
name: 'gcr.io/cloud-builders/docker'
waitFor: ['setup-artifact-registry']
entrypoint: 'bash'
args:
- '-c'
- |
# Pull the prebuilt image
docker pull ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest
# Tag for Artifact Registry
docker tag ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest \
${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_ID}/${_IMAGE_NAME}:${_IMAGE_TAG}
# Push to Artifact Registry
docker push ${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_ID}/${_IMAGE_NAME}:${_IMAGE_TAG}
- 'build'
- '-t'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_ID}/${_IMAGE_NAME}:${_IMAGE_TAG}'
- '.'

- id: 'setup-k8s-iam'
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
waitFor: ['pull-tag-push-image']
waitFor: ['build-push-image']
entrypoint: 'bash'
args:
- '-c'
Expand Down
223 changes: 75 additions & 148 deletions partner-models/claude/computer-use-demo/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: ServiceAccount
metadata:
Expand All @@ -6,88 +20,6 @@ metadata:
annotations:
iam.gke.io/gcp-service-account: ${_IAM_SA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
namespace: ${_NAMESPACE}
data:
nginx.conf: |
events {
worker_connections 1024;
}
http {
server {
listen 8080;
# Enable localhost redirects
server_name localhost 127.0.0.1;
# Serve the main app files
location / {
root /usr/share/nginx/html;
index index.html;
sub_filter 'http://localhost:8501' '';
sub_filter 'http://127.0.0.1:6080' '';
sub_filter_once off;
sub_filter_types *;
}
# Handle direct localhost:8501 access
location = /8501 {
return 302 $scheme://$host:8080/streamlit/;
}
# Handle direct localhost:6080 access
location = /6080 {
return 302 $scheme://$host:8080/vnc/;
}
# Proxy for Streamlit
location /streamlit/ {
proxy_pass http://127.0.0.1:8501/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 86400;
}
# Rewrite localhost:8501 to /streamlit/
location ~ ^http://localhost:8501/(.*)$ {
return 302 $scheme://$host:8080/streamlit/$1;
}
# Proxy for noVNC
location /vnc/ {
proxy_pass http://127.0.0.1:6080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 86400;
}
# Rewrite localhost:6080 to /vnc/
location ~ ^http://127.0.0.1:6080/(.*)$ {
return 302 $scheme://$host:8080/vnc/$1;
}
# Proxy for main app
location /app/ {
proxy_pass http://127.0.0.1:8088/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 86400;
}
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -104,70 +36,56 @@ spec:
app: ${_IMAGE_NAME}
spec:
serviceAccountName: ${_KSA_NAME}
volumes:
- name: nginx-config
configMap:
name: nginx-config
containers:
- name: nginx-proxy
image: nginx:alpine
ports:
- containerPort: 8080
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
- name: ${_IMAGE_NAME}
image: ${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_ID}/${_IMAGE_NAME}:${_IMAGE_TAG}
resources:
requests:
memory: "1Gi"
cpu: "1000m"
limits:
memory: "2Gi"
cpu: "1000m"
env:
- name: API_PROVIDER
value: "vertex"
- name: CLOUD_ML_REGION
value: "${_REGION}"
- name: ANTHROPIC_VERTEX_PROJECT_ID
value: "${PROJECT_ID}"
- name: WIDTH
value: "1024"
- name: HEIGHT
value: "768"
- name: VNC_PORT
value: "5900"
- name: NOVNC_PORT
value: "6080"
- name: WEBSOCKIFY_OPTIONS
value: "--web /opt/noVNC --cert=/opt/noVNC/self.pem"
- name: HTTP_SERVER_PORT
value: "8088"
ports:
- containerPort: 5900
name: vnc
- containerPort: 8501
name: streamlit
- containerPort: 6080
name: novnc
- containerPort: 8088
name: web
readinessProbe:
tcpSocket:
port: streamlit
initialDelaySeconds: 90
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
livenessProbe:
tcpSocket:
port: web
initialDelaySeconds: 120
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 6
- name: ${_IMAGE_NAME}
image: ${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_ID}/${_IMAGE_NAME}:${_IMAGE_TAG}
resources:
requests:
memory: "1Gi"
cpu: "1000m"
limits:
memory: "2Gi"
cpu: "1000m"
env:
- name: API_PROVIDER
value: "vertex"
- name: CLOUD_ML_REGION
value: "${_REGION}"
- name: ANTHROPIC_VERTEX_PROJECT_ID
value: "${PROJECT_ID}"
- name: WIDTH
value: "1024"
- name: HEIGHT
value: "768"
- name: VNC_PORT
value: "5900"
- name: NOVNC_PORT
value: "6080"
- name: WEBSOCKIFY_OPTIONS
value: "--web /opt/noVNC --cert=/opt/noVNC/self.pem"
ports:
- containerPort: 5900
name: vnc
- containerPort: 8501
name: streamlit
- containerPort: 6080
name: novnc
- containerPort: 8080
name: web
readinessProbe:
tcpSocket:
port: streamlit
initialDelaySeconds: 90
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
livenessProbe:
tcpSocket:
port: web
initialDelaySeconds: 120
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 6
---
apiVersion: v1
kind: Service
Expand All @@ -177,8 +95,17 @@ metadata:
spec:
type: LoadBalancer
ports:
- port: 8080
targetPort: 8080
name: web
- port: 5900
targetPort: vnc
name: vnc
- port: 8501
targetPort: streamlit
name: streamlit
- port: 6080
targetPort: novnc
name: novnc
- port: 8080
targetPort: web
name: web
selector:
app: ${_IMAGE_NAME}

0 comments on commit 5ea0079

Please sign in to comment.