Skip to content

This is a very basic example of ASP.NET Core MVC + EF Core application runned on an OpenShift cluster along with a containerized MSSQL database. It also demonstrates how to use both Azure Pipelines and GitHub Actions to build and deploy .NET Core applications directly to an OpenShift cluster.

Notifications You must be signed in to change notification settings

denisyfrolov/OpenShiftTestApp

Repository files navigation

OpenShiftTestApp

Installation Prerequisites

Installation

Step 1

Using OpenShift CLI create a project and a service account in the cluster.

NOTE

Before continue please ensure that you have successfully logged into your cluster (Get the sign in URL for your cluster):

oc login --server=[CLUSTER_URL]

After you logged in:

create_project_and_serviceaccount.sh creates everything automatically.

Alternatively you can run the same manually:

  • Create a project:
oc new-project openshifttestapp
  • Create a service account for deployment:
oc create serviceaccount devops
oc policy add-role-to-user admin system:serviceaccount:openshifttestapp:devops
oc serviceaccounts get-token devops

TOKEN

Save the token you obtained after the last command. You will need it later.

TOKEN

Step 2

The last part is to setup environment variables in your deployment pipelines.

Both Azure Pipelines Secrets and GitHub Actions Secrets use the same subset of environment variables:

VARIABLE NAME VALUE
CONNECTIONSTRING Server=localhost; Database=MvcOSTAContext; user id=sa; password=YOUR_DB_PASSWORD;
DATABASENAME MvcOSTAContext
DATABASEPASSWORD YOUR_DB_PASSWORD
DATABASEUSER sa
REGISTRY_NAME The private registry name you used here
REGISTRY_USERNAME Username of Admin account
REGISTRY_PASSWORD Password of Admin account
OCTOKEN Token of devops service account
OCURL Get the sign in URL for your cluster

Step 3

After all the environment variables are setted up, run the pipeline or just make a commit to the master brunch.

After the pipeline is successfully finished, run the below command to obtain a public facing URL of the application:

echo http://$(oc get route openshifttestapp-application-route -o jsonpath="{.status.ingress[0].host}")

Introduction

This is a very basic example of ASP.NET Core MVC + EF Core application runned on an OpenShift cluster along with a containerized MSSQL database.

It also demonstrates how to use both Azure Pipelines and GitHub Actions to build and deploy .NET Core applications directly to an OpenShift cluster.

🚨 IMPORTANT: This project is a Proof of Concept and provided AS IS. The only purpose this project is to demonstrate a working concept. PLEASE DO NOT USE THIS PROJECT IN YOUR PRODUCTION ENVIREMENT!

🚨 IMPORTANT: This project ships with many references to third party dependencies, verisons of wich are not controlled. Build and deployment pipelines may fail in many cases of backward compatibility breaks, network and other availability issues. PLEASE DO NOT USE THIS PROJECT IN YOUR PRODUCTION ENVIREMENT!

🚨 IMPORTANT: This example uses sa user (Server Administrator) to connect to a database. This is only on purpose to simplify the demo case. PLEASE DO NOT USE THE SA USER IN YOUR PRODUCTION ENVIREMENT!

Features

  • Azure Pipelines and GitHub Actions
  • Docker and OpenShift
  • Containerized MSSQL database
  • EF Core Migrations

Contribute

Contributions to the package are always welcome!

Author

About

This is a very basic example of ASP.NET Core MVC + EF Core application runned on an OpenShift cluster along with a containerized MSSQL database. It also demonstrates how to use both Azure Pipelines and GitHub Actions to build and deploy .NET Core applications directly to an OpenShift cluster.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published