This is a demo application written in Go to showcase Azure Cognitive Services running in Docker Containers. It is a websocket chat web application. It parses all messages using Azure Cognitive Services Sentimnet Analysis. If the sentiment is below a set threshold (ie. the message is too mean) then the AI Chat Moderator will broadcast to everyone to be nice.
This demo uses the Azure Cognitive Services container deployment. This means that all analysis is done locally and not in Azure. A Cognitive Services deployment in Azure is still required for billing purposes but all the analysis is done locally.
- AKS Cluster Created. See kubernetes-cluster-setup
- Azure Storage Account for Terraform state storage
- Azure Container Repository for Helm Chart
- Docker Hub Repository for the docker container (could re-use Azur Container Repository)
- Excute .github/workflows/infrastructure.yaml
cd infrastructure
terraform init -backend=true -backend-config="access_key=WY4ruq........" -backend-config="key=app.terraform.tfstate"
terraform plan -out="uat.plan" -var "resource_group_name=DevSub02_ChatApp_RG" -var-file="uat.tfvars"
terraform apply "uat.plan"
#Set your GOPATH
go get github.com/gorilla/websocket
go get github.com/gin-contrib/cors
go get github.com/gin-gonic/gin
go get github.com/gin-gonic/contrib/static
go get gopkg.in/resty.v1
cd ./src
docker build -t chatw
cd ./chart
helm package .
az acr helm push -n ${ACR_NAME} sentimentchat-0.2.${VERAION}.tgz --force
- Excute .github/workflows/build.yaml
- The repository is configured to deploy this application via flux