Giter VIP home page Giter VIP logo

s2i-dotnetcore-ex's Introduction

.NET Core Sample App on OpenShift

This repository contains an example project that can be built using the s2i-aspnet builder image, which can be used to create reproducible Docker images from your ASP.NET project’s source code. The resulting images can be run using Docker or deployed to OpenShift.

For more information about using these images with OpenShift, please see the official OpenShift Documentation.

Building and Running

The sample application can be built and run either within OpenShift or standalone by combining the application using s2i tool and running with existing image using Docker. The following sections describes these processes

OpenShift

After logging into an OpenShift environment and creating or using an existing project, create a new application which combines the ASP.NET S2I builder and the sample application from this repository

oc new-app registry.access.redhat.com/dotnet/dotnetcore-10-rhel7~https://github.com/redhat-developer/s2i-dotnetcore-ex --name=aspnet-app --context-dir=app

Create a new route so that the application is accessible outside the OpenShift environment

oc expose service aspnet-app

The application will now be available at http://aspnet-app-<project>.<default_subdomain>;

Use a template to build and deploy a sample application

A template has been provided to simplify the build and deployment of a ASP.NET application on OpenShift. The template is located in the templates folder in a file called [aspnet-s2i-template.json](templates/aspnet-s2i-template.json).

After logging into an OpenShift environment and creating or using an existing project, add the template to the project

oc create -f templates/aspnet-s2i-template.json
Note

Alternately, the template can be added to the openshift project so that it will be visible by all users. Using a user with permissions to modify resources in the openshift project, execute the following command:

oc create -f templates/aspnet-s2i-template.json -n openshift

Instantiate the template to build and deploy the sample application

oc new-app --template=aspnet-s2i -p GIT_URI=https://github.com/redhat-developer/s2i-dotnetcore-ex

The template can also be instantiated using the OpenShift web console. Login to the console and navigate to the desired project. Click the Add to Project button. Search and select the aspnet-s2i.

Click Create to start a build and deploy the sample application.

Once the build has completed and the resulting container started, the application will be available at http://aspnet-app-<project>.<default_subdomain>;

Standalone

To build a new ASP.NET application using a previously existing S2I builder, execute the following command:

git clone https://github.com/redhat-developer/s2i-dotnetcore-ex.git
cd s2i-dotnetcore-ex
s2i build app/ aspapp aspnet-app --loglevel=5

The resulting image can be executed using docker:

docker run -t -p 5000:5000 aspnet-app

Once the container is running, it should be accessible using:

curl 127.0.0.1:5000

Liveness and Readiness Application Health

The template has been configured with a liveness and readiness probe of which you can read more at https://docs.openshift.com/enterprise/latest/dev_guide/application_health.html. It checks if the container is healthy by doing a HTTP call to the root application. It checks if the application is ready by performing an HTTP call to /Home/About. If you’d like to see how the probe is working, just oc log -f <pod>.

Contributing

Contributions to this project (in the form of bug reports, patches, or pull requests) are gratefully accepted by the maintainer. Please see the Contributing.adoc file contained in this package for details.

Copyright 2016 by Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this package except in compliance with the License (see the LICENSE file included in this distribution). You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

s2i-dotnetcore-ex's People

Contributors

jerboaa avatar bparees avatar sabre1041 avatar jsvgoncalves avatar jawnsy avatar jperville avatar dinhxuanvu avatar

Watchers

 avatar James Cloos avatar  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.