Memealyzer
Memealyzer is an app built to demonstrate some the latest and greatest Azure tech to dev, debug, and deploy microservice applications.
Install / Use
/learn @jongio/MemealyzerREADME
Memealyzer
Meme + Analyzer = Memealyzer
Memealyzer determines if a meme's sentiment is positive, negative, or neutral.
For example, given this meme:

Memealyzer will extract the text, analyize the sentiment of that text, and then change the border color to red for negative sentiment, green for positive, and yellow for neutral.

Memealyzer is an app built to demonstrate some the latest and greatest Azure tech to dev, debug, and deploy microservice applications, including:
- Azure SDKs - to interact Azure services
- Bicep & Azure CLI - to provision Azure resources
- Project Tye to dev, debug, and deploy the solution
- Blazor - for a responsive client-side app built with .NET/C#.
- Azure Functions - to connect message queues with SignalR
- Azure SignalR Service - to send messages to the web app
Architecture

This is the current .NET architecture - we are in the process of developing for other languages and architectures as well.
Azure Resources
The following Azure resources are used in this application:
- Resource Group
- Storage Account
- Cognitive Services Form Recognizer
- Cognitive Services Text Analytics
- Cosmos DB
- Key Vault
- Azure Kubernetes Service
- Application Insights
- Azure SignalR Service
- Azure Functions
- Azure Service Bus
You can select the Data and Messaging Providers via environment variables. See the "Environment Variables" section below for more information.
Quickstart
We follow a 4 step process to go from nothing to a completely deployed Azure solution.
- Start Dev Environment with VS Code Remote Container (GitHub Codespaces coming soon)
- Provision Azure Resources with Bicep
- Run Locally with Tye
- Deploy to Azure with Tye or GitHub Actions

You will see
{BASENAME}throughout this document. Replace it with any unique text that you'd like, such as memealyzer007. That will be used as the basename for all your Azure resources, i.e. If you use memealyzer007, then the resource group will be named memealyzer007rg.
We use the Azure CLI to perform resource deployment and configuration. The scripts below will automatically prompt you to login to the Azure CLI and set your active Azure subscription. You can set the
AZURE_SUBSCRIPTION_IDenvironment variable in the.envfile if you don't want to be prompted every time you run these scripts.
1. Start Dev Environment
The fastest way to get to get the Memealyzer dev machine setup is to use the Codespaces Dev Container which includes all of your development dependencies.
- Install VS Code
- Install VS Code - Remote Containers Extension
- Open a Linux shell, such as bash or WSL bash
- Clone the repo:
git clone https://github.com/jongio/memealyzer
- Open the repo in VS Code
code memealyzer - Hit F1, then select "Remote Containers - Open Folder in Container"
- Select the memealyzer root folder and click the Open button.
It can take a while to open the Dev Container the first time, but subsequent opens will load much faster.
2. Provision Azure Resources
This will provision all the required Azure resources with Bicep.
./provision.sh {BASENAME}
It may take up to 30 minutes to provision all resources.
You can deprovision at any time with ./deprovision.sh {BASENAME}
3. Run Locally
Now that our Azure Resources are provisioned, we'll now use Tye to run our application locally.
./run.sh {BASENAME}- Open the Tye dashboard: http://localhost:8000 and ensure that all services are running.
The Azure Function takes a few minutes to start, so if you get an error while loading the app, then wait a few minutes before trying again.
- Open http://localhost:1080
- You can add memes by clicking on the "+" button
- You can start the memestream by clicking on the "∞" button. This will add a new meme every 5 seconds.
If you get build errors, then CD to
./src/netand run./clean.shto clean up the .NET dirs.
If the app doesn't start correctly, then stop using CTRL+C and re-run the run.sh command. We are researching why this happens.
4. Deploy to Azure
Now that we've provisioned our resources and tested locally, it is time to deploy our code to Azure with Tye.
./deploy.sh {BASENAME}- Click on the link that is outputted to the console - this address will be unique to your deployment.
Please also take a look at the GitHub Action in the .github/workflows folder to see how we are auto-deploying this to an environment.
VS Code Workspace
Execute the following command to open the VS Code workspace that has all the projects you need to get started:
code memealyzer-net.code-workspace
or
code-insiders memealyzer-net.code-workspace if you are using VS Code Insiders build.
Manual Dev Machine Setup
We recommend using a VS Code Dev Container, but you can setup on bare metal with these steps.
- Terminal - WSL2, Zsh, GitBash, PowerShell, not Windows Command prompt as this application uses bash script files.
- Azure CLI - v2.20.0+
- Git
- VS Code
- Docker
- Kubectl
- .NET SDK - 5.0
- Azure Functions Core Tools - v3.0.2881 minimum
- Project Tye
- Bicep -
az bicep install - Playwright - Test Automation - Install Playwright via npm and run this to install dependencies:
npx playwright install-deps
Troubleshooting
- Error while loading WebApp
If you see this error:
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in './src/net/WebApp/bin/Debug/net5.0/'.
Then stop running the soltion and run it again. We do not know why this occasionally happens.
- Error while building or running
If you see this error:
/opt/dotnet/5.0.100/sdk/5.0.100/Microsoft.Common.CurrentVersion.targets(4354,5): error MSB3021: Unable to copy file "obj/Debug/netstandard2.1/Lib.Model.dll" to "bin/Debug/netstandard2.1/Lib.Model.dll". Access to the path is denied. [/home/codespace/workspace/src/net/Libs/Lib.Model/Lib.Model.csproj]
Option 1: Run this from within the devcontainer to take ownership of the files: sudo chown -R codespace ~/workspace/src
Option 2: CD to ./src/net and run ./clean.sh to clean up the .NET dirs.
Configuration
Data Provider
You can configure which store the app uses to persist your image metadata, either Cosmos DB or Azure Table Storage.
- Open
.envfile that is in the root of this project. - Find or add the
AZURE_STORAGE_TYPEsetting - Set it to one of the following values:
COSMOS_SQL- This will instruct the app to use Cosmos DB.STORAGE_TABLE- This will instruct the app to use Azure Storage Tables.
Cosmos Emulator
You can now use the Cosmos Emulator instead of Azure Cosmos. Follow these steps to enable the emulator, which will tell the ./run.sh and ./debug.sh scripts to run the cosmos-emulator container. See, ./scripts/cosmos.sh for details.
- Open
.envfile that is in the root of this project. - Scroll to bottom and uncomment
USE_COSMOS_EMULATOR=true - Use the
./run.shand other commands as you normally would and the Cosmos Emulator will be used.
Troubleshooting
-
You may see this error message when starting the emulator:
Error: failed to start containers: cosmos-emulator, which is likely a false-negative and can be ignored. -
If you see this error while trying to run the app, then remove the container using docker tools and re-start memealyzer.
The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot
Azure Storage Emulation (Azurite)
You can locally emulate all three Azure Storage services: Blobs, Queues, and Tables with Azurite.
To emulate all three of them, all you need to do is set the USE_AZURITE environment variable in the .env file to true. You can also enable or disable
