# Getting started with Semantic Search I've created a separate Google Cloud _project_ for our squad and managed to recreate the hackweek repo from scratch within that _project_. I've given permission to all engineers involved in the squad. Let me know if anyone else needs access to it. You can delete everything using command in step 10 and should be able to recreate it again following the guide below. 1 Use [Cloud Shell](https://ssh.cloud.google.com/cloudshell/editor) for free remote development environment or install [Google Cloud SDK](https://cloud.google.com/sdk/install) on your local machine. 2 Login from terminal using your `@servicerocket.com` Gmail account. Then check if you have been granted proper permissions by accessing [this page](https://console.cloud.google.com/kubernetes/list?project=sr-ml-green&organizationId=322500329658). ```bash gcloud auth login ``` 3 Configure your development env by running ```bash gcloud config set project sr-ml-green gcloud auth configure-docker gcloud container clusters get-credentials semanticsearch --zone us-west1-a kubectl config set-context --current --namespace=semanticsearch ``` 4 Configure eng-git SSH credentials, then clone the repo ```bash git clone ssh://git@eng-git.servicerocket.com:7999/fun/lde-semantic-search.git cd lde-semantic-search ``` 5 Build the ML docker image and push it to [GCR](https://console.cloud.google.com/gcr/images/sr-ml-green?project=sr-ml-green&folder&organizationId=322500329658). This takes about 7-10 mins as the docker image is few GBs in size. ```bash gcloud builds submit --tag gcr.io/sr-ml-green/bert-nq-baseline:latest ml/ ``` 6 Create/Update resources ```bash kubectl apply -f infra/namespace.yml kubectl apply -f infra/ml_deployment.yml kubectl apply -f infra/ml_service.yml kubectl apply -f infra/ingress.yml ``` 7 SSH into the container by ```bash kubectl get pods #docker ps kubectl exec -it <pod_name> bash #docker exec -it ``` 8 Access the ML server by ```bash curl -H "Content-Type: application/json" \ -d '{"page": "Larry Page founded Google", "question": "Who founded Google?"}' \ -X POST "http://localhost:8888/ml/" ``` or access the public endpoint by ```bash curl -H "Content-Type: application/json" \ -d '{"page": "Larry Page founded Google", "question": "Who founded Google?"}' \ -X POST "http://semanticsearch.learndot.com/ml/" ``` Should give a response like ```json { "LA": "<P> Larry Page founded Google </P>", "SA": "Larry Page" } ``` 9 Viewing logs ``` kubectl logs -f <pod_name> ``` 10 Deleting resources created in step #6 ```bash kubectl delete namespace semanticsearch ```