This sample will show you how to create a multi-container app topology in Azure Container Apps using the Azure Developer CLI. Here's a 5-minute video that walks you through a demo of using the repo to set it up yourself.
- 📤 One-click setup: Open a new Codespace, giving you a fully configured cloud developer environment.
▶️ Run, one-click again: Use VS Code's built-in Run command and open the forwarded port 8080 in your browser.- 🔄 Iterate quickly: Codespaces updates the server on each save, and VS Code's debugger lets you dig into the code execution.
This repository can be run in Codespaces, in Dev Containers, or locally on your development machine.
- Clone the repo to your local machine
git clone https://github.com/bradygaster/dotnet-redis-pubsub
- Open repo in VS Code
-
Open the
docker-compose.yml
file -
Right-click anywhere in the file and select Docker Compose - Up
-
Switch to the Docker extension to see the containers start up
-
Right-click the
publisher
container and select theOpen in Browser
menu item -
You should see
Publisher is up
in your browser -
Add the URL slug
/swagger
to the end of the URL in your browser to open the Swagger UI test page -
Open the
POST
method, and replace the JSON body in the test window with this:{ "date": "2023-06-10T04:52:16.323Z", "temperatureC": 30, "summary": "Hot" }
-
Right-click the
subscriber
container in the Docker containers pane, and selectView logs
-
The logs should open up in your terminal window, and you should see evidence that the
subscriber
is receiving messages from the Redis subscription:info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: /app info: Program[0] Message received from test-channel : Hot (85) at 06/10/2023 04:52:16 info: Program[0] Message received from test-channel : Hot (85) at 06/10/2023 04:52:16
-
Send a few more messages using the Swagger UI tool whilst viewing the subscriber's logs in the editor
You can deploy the app to Azure using the Azure Developer CLI, from any of the environments above.
NOTE: If you are running locally, then you first need to install the Azure Developer CLI
- Open a terminal
- Run
azd auth login
- Run
azd up
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.