A demo of deploying highly available webapps in Azure Red Hat OpenShift (ARO) that talk to cloud databases (Azure Cosmos DB & Azure SQL).
PLEASE BE AWARE that ARO + Azure SQL + Cosmos DB running in HA mode is closer to production Azure costs than a typical example's "Hello World" level of costs.
This example is based on the solution architecture diagram below:
Folder structure:
/modern-app
: a modern backend API (supporting OpenAPI) and a webpacked frontend UI/traditional-appserver
: the config and code for the traditional app server/database
: the scripts needed to setup the Azure SQL database/caching
: how to setup a caching service running in ARO
- If you haven't already, in your Azure account create an ARO cluster
- If you haven't already, clone this github repo to your local machine (this is so you can tweak things before you deploy)
- Make sure you have the latest .NET image streams installed to your ARO cluster
oc describe is dotnet -n openshift
- if not found, do this:
oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams.json -n openshift
- if old, do this:
oc replace -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams.json -n openshift
Assuming you have CLI access to your Azure account. Run the following commands to create a our databases for this example:
-
Check the script in
database/setupAzureSql.sh
and tweak as desired -
Run
./database/setupAzureSql.sh
-
Check the script in
database/setupCosmos.sh
and tweak as desired -
Run
./database/setupCosmos.sh
-
Note the connection strings that are printed - you'll need the primary one later
If you are completely new to Azure SQL and need a little more help, here's a full playlist that will help you: Azure SQL for beginners.
- Login to ARO and create a new project to deploy this example (you can do via webconsole or CLI:
oc new-project
) - Follow steps to deploy the
./modern-webapp/api
service - Follow steps to deploy the
./modern-webapp/ui
app - Follow steps to deploy one of the
./traditional-appserver
monolithic apps - Goto the ARO webconsole and check it all out
- Delete the project you're working in ARO
oc delete project PROJ-NAME
- Delete the database's Azure Resource Group
./database/deleteDatabases.sh
Yes, sorry. But it is intentional - I wanted to walk you through everything to help you understand all the parts. I'm planning on another example to show how you can automate all of these steps with CI/CD. If you want a sneak peak on how that could work read this blog post.