Deploying Susi on Google Cloud with Kubernetes
Susi (acronym for Scientific User Support Intelligence) is an advanced AI made by people at FOSSASIA. It is an AI made by the people and for the people.
Susi is an Open Source Project under LGPL Licence.
SUSI.AI already has many Skills and anyone can add new skills through simple console rules.
If you want to participate in the development of the SUSI server you can start by learning to deploy it on a cloud system like Google Cloud.
This way whenever you make a change to Susi Server, you can test it out on various Susi Apps instantly.
Google Cloud with Kubernetes provide this ability. Let’s dig deep into what is Google Cloud Platform and Kubernetes.
What is Google Cloud Platform ?
Google Cloud Platform lets you build and host applications and websites, store data, and analyze data on Google’s scalable infrastructure.
Google Cloud Platform (at the time of writing this article) also provides free credits worth $300 for 1 year for testing out the Platform and test your applications.
What is Kubernetes ?
Kubernetes is an open-source system for automatic deployment, management and scaling of containerized applications. It makes it easy to roll out updates to your application with simple commands from your development machine and scale horizontally easily by adding more clusters as demand increase.
Deploying Susi Server on Kubernetes
Deploying Susi Server on Kubernetes is a fairly easy task. Follow up the steps to get it running.
Create a Google Cloud Account
Sign up for a Google Cloud Account (https://cloud.google.com/free-trial/) and get 300$ credits for initial use.
Create a New Project
After successful sign up, create a new project on Google Cloud Console.
Let’s name it Susi-Kubernetes .
You will be provided a ProjectID. Remember it for further reference.
Install Google Cloud SDK and kubectl
Go to https://cloud.google.com/sdk/ and see instructions to setup Google Cloud SDK on your respective OS.
After Google Cloud SDK install, run
gcloud components install kubectl
This will install kubectl for interacting with Kubernetes.
Login and setup project
- Login to your Google Cloud Account using
$ gcloud auth login
2. List all the projects using
$ gcloud config list project
project = <PROJECT_ID>
3. Select your project
$ gcloud config set project <PROJECT_ID>
4. Install JDK8 for susi_server setup and set it as default.
5. Clone your fork of the Susi Server Repository
$ git clone https://github.com/<your_username>/susi_server.git
$ cd susi_server/
6. Build project and run Susi Server locally
$ ./gradlew build
Susi server must have been started started and web interface is accessible on http://localhost:4000
Install Docker and build Docker image for Susi
- Install Docker.
Debian and derivatives: sudo apt install docker
Arch Linux: sudo pacman -S docker
- Build Docker Image for Susi
$ docker build -t gcr.io/<Project_id>/susi:v1 .
3. Push Image to Google Container Registry private to your project.
$ gcloud docker -- push gcr.io/<Project_id>/susi:v1
Create Cluster and Deploy your Susi Server there
- Create Cluster. You may specify different zone, number of nodes and machine type depending upon requirement.
$ gcloud container clusters create <Cluster-Name> --num-nodes 2 --machine-type n1-standard-1 --zone us-central1-c
2. Run your deployment. You may specify any name for deployment.
$ kubectl run <deployment_name> --image=gcr.io/<Project_id>/susi:v1 --port=80
$ kubectl get deployments
$ kubectl expose deployment susi --type=LoadBalancer
3. Check your deployment and get Public IP for Access.
$ kubectl get services
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 10.3.240.1 <none> 443/TCP 1d
susi 10.3.241.145 <PUBLIC_IP> 80:31155/TCP 1d
4. Go to provided public IP to check, if Susi Server is running.
Congratulations, you successfully setup Susi Server on Google Cloud with Kubernetes.
Updating the deployment
Next step is to update deployment when you wish to roll out changes. To do so.
Build Docker Image and Push it to Google Container Registry
$ docker build -t gcr.io/<Project_Id>/susi:v2 .
$ gcloud docker -- push gcr.io/<Project_Id>/susi:v2
Update Deployment Image with Kubernetes
$ kubectl set image deployment/<Deployment_Name> \
deployment "<Deployment_Name>" image updated
Go to public ip to see the changes.
That’s it. Now, you have fully running Susi Server on your own Google Cloud Cluster using Kubernetes.