Git Product home page Git Product logo

denisyfrolov / openshifttestapp Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 864 KB

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.

Home Page: https://denisyfrolov.visualstudio.com/OpenShiftTestApp/

C# 53.65% Dockerfile 3.23% HTML 35.31% Shell 0.79% CSS 6.00% JavaScript 1.01%
dotnet dotnet-core mssql mssql-docker openshift docker github-actions azure-devops azure-pipelines

openshifttestapp's Introduction

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

openshifttestapp's People

Contributors

denisyfrolov avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.