theckang / openshiftexamples-aro-webapp-azuresql

Azure Red Hat OpenShift Example - started from Azure samples and then changed direction drastically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenShift Examples - ARO WebApp with Azure SQL

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: Diagram

Implementation Details

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

Prerequisites

  1. If you haven't already, in your Azure account create an ARO cluster
  2. If you haven't already, clone this github repo to your local machine (this is so you can tweak things before you deploy)
  3. 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

Setup Databases

Assuming you have CLI access to your Azure account. Run the following commands to create a our databases for this example:

  1. Check the script in database/setupAzureSql.sh and tweak as desired

  2. Run ./database/setupAzureSql.sh

  3. Check the script in database/setupCosmos.sh and tweak as desired

  4. Run ./database/setupCosmos.sh

  5. 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.

Deploy Apps

  1. Login to ARO and create a new project to deploy this example (you can do via webconsole or CLI:oc new-project)
  2. Follow steps to deploy the ./modern-webapp/api service
  3. Follow steps to deploy the ./modern-webapp/ui app
  4. Follow steps to deploy one of the ./traditional-appserver monolithic apps
  5. Goto the ARO webconsole and check it all out

Clean up when done

  1. Delete the project you're working in ARO oc delete project PROJ-NAME
  2. Delete the database's Azure Resource Group ./database/deleteDatabases.sh

This is a lot of manual steps

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.

About

Azure Red Hat OpenShift Example - started from Azure samples and then changed direction drastically

License:MIT License


Languages

Language:C# 67.5%Language:HTML 19.3%Language:JavaScript 3.3%Language:CSS 2.9%Language:SCSS 2.7%Language:Java 2.7%Language:Shell 0.8%Language:TSQL 0.6%Language:Dockerfile 0.3%