Tweet Factory is a sample SaaS solution built on Kubernetes. The software being delivered with Tweet Factory is this Twitter sentiment analysis solution.
Short five-minute demo; refresh the page to start from the beginning. This video is also available on youtube.com, which may be easier to view from the beginning, pause, etc. I've also written some about my experience creating this solution here.
I've built this project to demonstrate concepts for building platforms on Kubernetes. The following technology is used in this solution:
- Kubernetes Custom Resources (TweetFactory)
- Kubernetes Service Catalog
- Open Service Broker for Azure
- Operator Framework
In order to run Tweet Factory, you need:
- Kubernete cluster with Helm configured
- Service Catalog installed on the cluster
- Open Service Broker for Azure (customized with this fork)
- Twitter API Consumer key and access token
Add this Helm repo:
helm repo add azure-samples https://azure-samples.github.io/helm-charts/
Start the operator:
helm install azure-samples/tweet-factory-operator -n tweet-factory
At this point, a custom resource definition (CRD) has been created that represents the Tweet Factory resource. When a new instance of the custom resource is created, the Tweet Factor operator creates an instance of the service.
To deploy a new instance, create a file named tweet-seattle.yaml
and copy in the following YAML. Update the Twitter consumer key, access token, and both secrets with the values from your twitter API application.
apiVersion: "tweet-factory.com/v1alpha1"
kind: "TweetFactory"
metadata:
name: "seattle"
spec:
consumerKey: ""
consumerSecret: ""
accessToken: ""
accessTokenSecret: ""
filterText: "Seattle"
Create the custom resource with kubectl apply
.
kubectl apply -f tweet-seattle.yaml
Once the resource is created, the Tweet Sentiment operator runs a Helm chart and following items are created:
- Azure Storage Queue - tweets to be processed are stored here
- Azure Cosmos DB - sentiment results are stored here
- Azure Text Analytics API - performs sentiment analysis
- Get tweet POD - gets tweets and stores them in Queue
- Process tweet POD - performs sentiment analysis and stores result in Cosmos DB
- Chart tweet POD - visualizes the results