A RESTful API that captures and provides scores for the game client for the Tabs vs Spaces demo during Breakout 254: Supercharging game dev with Microsoft's cloud native and AI technology. Built on Python with Flask, Docker, and Azure.
Disclaimer - This repository and all associated repository are provided as-is and for demo purposes only. The goal of this repository, and related respository, is to demonstrate the value-add of cloud-native technologies and approaches during the inner game dev loop.
First, pull down the repo:
git clone git@github.com:max-at-microsoft/tabs-vs-spaces-api.git
cd tabs-vs-spaces-api/Next, create a .env file in the the root of the project:
COSMOS_ENDPOINT=XXX
COSMOS_KEY=XXX
COSMOS_DATABASE=tabs-vs-spacesIf you are starting from scratch, you will need to run a one time setup and standup Azure infrasturcture to support the release pipeline. If you have already done this, you can skip down to Deployment
Set your active AZ subscription to your personal:
az login
az account set --name {your_alias}Here are the values you should use in your deployment:
| Environment Key | Value |
|---|---|
Resource Group |
tabs-vs-spaces |
Location |
westus |
Cosmos Account |
tabs-vs-spaces |
First, make sure the resource group is created:
az group create --location eastus --name tabs-vs-spaces-apiThis should create a resource group named tabs-vs-spaces in your current Azure subscription.
Next run this in the root directory:
az deployment group create --resource-group tabs-vs-spaces --template-file .azure/cosmos-db.bicepWith your newly created resources, update your .env to use the values.
To run the development harness locally with hot reloading, please run the following command:
docker compose up --build devThis will run the app at http://localhost:5001
To run the production harness locally, please run the following command:
docker compose up --build releaseThis will run the app at http://localhost
This will allow you to push your registry. Containers apps using latest tags will be updates upon a successful build.
az login
az acr login -n {REGISTRY_NAME}
az acr build --registry {REGISTRY_NAME} --image tabs-vs-spaces-api/release:latest .