{"id":17545887,"url":"https://github.com/justindavies/cocoonaks","last_synced_at":"2026-04-14T04:03:14.749Z","repository":{"id":92464212,"uuid":"153175189","full_name":"justindavies/CocoOnAKS","owner":"justindavies","description":"Demo for Edinburgh OSS Summit","archived":false,"fork":false,"pushed_at":"2018-11-20T13:06:11.000Z","size":449,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-28T01:03:05.102Z","etag":null,"topics":["aks","azure","demo","keras","kubernetes","tensorflow","virtual-kublet"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justindavies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-15T20:11:09.000Z","updated_at":"2024-05-27T13:23:04.000Z","dependencies_parsed_at":"2023-05-17T09:01:12.149Z","dependency_job_id":null,"html_url":"https://github.com/justindavies/CocoOnAKS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/justindavies/CocoOnAKS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justindavies%2FCocoOnAKS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justindavies%2FCocoOnAKS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justindavies%2FCocoOnAKS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justindavies%2FCocoOnAKS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justindavies","download_url":"https://codeload.github.com/justindavies/CocoOnAKS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justindavies%2FCocoOnAKS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31781292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aks","azure","demo","keras","kubernetes","tensorflow","virtual-kublet"],"created_at":"2024-10-21T01:25:17.466Z","updated_at":"2026-04-14T04:03:14.743Z","avatar_url":"https://github.com/justindavies.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Demo for the Open Source Summit - Edinburgh 2018\n\nThis is a challenge I set myself to use Open Source components to demonstrate how great Cloud, and specifically Azure is.\n\nThe challenge was to use Machine Learning to churn through A LOT of data and do something with it.  I wanted it to be cool, but also a good demomnstration of how Cloud Services and OSS can work together to reduce the amount of time you would need to get an MVP up and running.\n\n## Cloud Services Used\n* Cosmos DB\n* Azure Service Bus\n* Azure Web Apps (for Containers)\n* Azure Storage\n* Azure Kubernetes Service\n\n## Open Source Frameworks and Languages used\n* Node\n* React\n* Python\n* Express\n* Tensorflow and Keras\n\n\n## Architecture\n![alt text](cocoonaksarch.png \"Cloud Architecture\")\n\n\n## Data \nFor the data to ingest and test I used the [COCO unlabelled images](http://images.cocodataset.org/zips/unlabeled2017.zip)\n\n### Important!\nYou can use any images you like, just put it on a storage account in a container called **images**\n\n## Caveats\nThis is a demo running on Azure - as such it is tightly coupled to some of our services.  In  [infer.py](./infer/infer.py) for example, we poll on the Azure Event Hub to see when a new message is received (in this case, the relative path of an image stored on Azure Blob Storage), it is then that the infer worker will pull the message of the queue and then process it.  As we scale the pods up using ACI/Virtual Kubelet, the queueing mechanism is the key to making sure we have consistency.\n\n# Setup the demo\n\nYou will need the following Azure Services:\n\n* Service Bus\n* CosmosDB\n* Azure Blob Storage\n\n\nPlace the following information in the [envs_template.sh](./utils/envs_template.sh) and [infer_secrets_template.yml](./kubernetes/infer_secrets_template.yml) files.  We use the connection details for both the Inference model on Kubernetes, as well as to inject data into the Service Bus (so that the Inference workers actually do something).\n\n## Service Bus information needed\nYou will need to capture:\n\n* SERVICEBUS_NAMESPACE=*name of your Service Bus*\n* SERVICEBUS_ACCESSKEY_NAME=RootManageSharedAccessKey (It's usually this)\n* SERVICEBUS_ACCESSKEY=*Your Service Bus Access Key*\n\n\n## CosmosDB information needed \n**This could be a kube service (MongoDB) too, it's using the pymongo and mongoose drivers in the ingest and API stages**\n\nYou will need to capture:\n\n* MONGODB=*CosmosDB Connection String*\n\n\n## Azure Storage information needed \n\n* STORAGE_ACCOUNT=*Storage account name*\n* STORAGE_KEY=*Storage account key*\n\n\n# Run the demo\n\n## Setup Virtual Kubelet\nFollow the instructions [here](https://docs.microsoft.com/en-us/azure/aks/virtual-kubelet) so get VK on your cluster.\n\n## Setup connection secrets\n\nEdit the file **infer_secrets_template.yml** and add your Storage, Cosmos and Service Bus credentials.\n\n```bash\n$ kubectl apply -f infer_secrets_template.yml\n```\n\n## Deploy the worker\n\n```bash\n$ kubectl apply -f infer.yml\n```\n\nYou should now see a single worker sitting there (after a couple of minutes).\n\nIt wont be doing much as nothing is in the Queue.\n\n## Push data to the worker\nThe script [inject.py](./utils/inject.py) will need to have environment variables set, so edit the file [envs_template.sh](./utils/envs_template.sh) with your backing credentials, and source the environment.\n\nAnd run the script...\n\n```bash\n$ ./utils/inject.py\n```\n\nThe script will read the list of files in your storage account and start pushing those onto the Queue.\n\nThe worker will pull each image and then try to categorise it.\n \nYou can check this is working by seeing the pod CPU utilisation (It should be falt out at 200%)\n\n```bash\n$ kubectl top pod\n```\n\nNow that the worker has been verified, it's time to setup the API and UI.\n\n## Setup the API\nFor the demo, I used WebApp for Containers for the API.  To deploy it, spin up a WebApp instance using the container **inklin/cocoapi**.  You will need to set the environmnet variable within the WebApp dashboard for MONGODB to your CosmosDB connection string.\n\n## Setup the Frontend\nFor the demo, I used WebApp for Containers for the Frontend too.\n\n### Edit the Frontend environments\nAs this is a React application we have to inject environment variables at build time.  To do this, edit the file [.env.production](./stats/.env.production) and replace\n\n```\nREACT_APP_API_SERVER=https://api-osssumit.azurewebsites.net\n```\n\nwith the location of the API server you installed in the previous step.\n\nYou will then need to build the React App (The Dockerfile will take care of it for you, just do a docker build -t stats .) and push your Frontend to a container registry and use that as the UI.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustindavies%2Fcocoonaks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustindavies%2Fcocoonaks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustindavies%2Fcocoonaks/lists"}