Skip to content

New Using .NET Core with OCP topic #3017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2016
Merged

Conversation

ahardin-rh
Copy link
Contributor

@ahardin-rh ahardin-rh commented Oct 7, 2016

@ahardin-rh
Copy link
Contributor Author

@bparees @jerboaa Can you please help me fill out some missing information here? Some questions are embedded within. Thanks!

@ahardin-rh ahardin-rh self-assigned this Oct 7, 2016
@bparees
Copy link
Contributor

bparees commented Oct 9, 2016

I defer to @jerboaa

@jerboaa
Copy link

jerboaa commented Oct 11, 2016

@ahardin-rh I'll try to answer your questions, but I'm probably missing some context. This is specifically documenting "how to use the .Net core image on Openshift", right? I'm not sure how an Openshift install from scratch plus then adding the .Net image looks like. So please take my answers with a grain of salt ;-)

Also, is there a way to view the rendered doc? An example (e.g. equivalent Python/Java/Ruby doc) as to what you are looking for would be helpful.


.About This Task
This section explains how to install .NET Core 1.0 on Red Hat Enterprise Linux 7
and perform a simple Hello World! script.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this documenting how to install the image on RHEL 7 or using the image on OpenShift?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they shouldn't need to install it, the default imagestreams should include the .NET imagestream so it should be present like any other imagestream (eg ruby, python, etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving this to Using Images where it belongs

and perform a simple Hello World! script.

.Before You Begin
What needs done first?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, for my local install I had to add the image stream via oc create -f <imagestream.json>. Perhaps the imagestream is pre-installed? I don't know. If it's not installed, it can be downloaded from here: https://github.com/redhat-developer/s2i-dotnetcore/blob/master/dotnet_imagestreams.json

If this is documenting simple usage of the docker image on RHEL-7 something like this should work:

$ sudo docker pull dotnet/dotnetcore-10-rhel7
$ sudo s2i build git://github.com/redhat-developer/s2i-dotnetcore --context-dir=1.0/test/asp-net-hello-world dotnet/dotnetcore-10-rhel7 dotnet-sample-app
$ sudo docker run -p 8080-8081:8080-8081 dotnet-sample-app


== Configuring .NET on {product-title}

What environment variables does the user need to set?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No environment variables needed as of yet.


What environment variables does the user need to set?

What other configuration needs to happen to run .NET on OpenShift?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the image stream, then use the "Try it" button from the UI. There should be a way to use oc new-app, but I'm not sure if all pieces are in place for it to work.


How does the user deploy this?

What are the commands?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an example what you are looking for exactly?

@bparees
Copy link
Contributor

bparees commented Oct 11, 2016

why is this under "Creating images"? it should be under "using images" like the others, eg: https://docs.openshift.org/latest/using_images/s2i_images/nodejs.html

@bparees
Copy link
Contributor

bparees commented Oct 11, 2016

this doc should be reworked to follow the pattern here:
https://docs.openshift.org/latest/using_images/s2i_images/ruby.html

Note that that pattern isn't perfect, it doesn't really make sense to show how to pull the image from dockerhub, and we really ought to include an example of how to actually use the image to build an app (ie oc new-app against a sample repo).

@bparees
Copy link
Contributor

bparees commented Oct 11, 2016

also note that the reference in the ruby doc that points to the imagestreams, does not point to the .net imagestream because it is hosted elsewhere.


* .NET Core framework version 1.0.
* .NET is supported by Red Hat Enterprise Linux (RHEL) 7.
* {product-title} (formerly called Red Hat OpenShift Enterprise) versions 3.2 and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably drop the parenthetical about the OSE name. And while the image stream was shipped for 3.2.z, AFAICT the oc new-app detection feature was only added started in 3.3 (via openshift/origin#10463)... Dunno whether new-build got the same treatment?

@ahardin-rh ahardin-rh force-pushed the dot-net branch 2 times, most recently from 63d1369 to 8f39691 Compare October 11, 2016 20:35
@ahardin-rh
Copy link
Contributor Author

@bparees @jerboaa @adellape I made some changes, including getting this into Using Images where it belongs. I agree with Ben that this should mirror those other S2I images topics like Ruby. Please help me fill in anything that I'm missing. Thanks!

Here is a preview build: http://file.rdu.redhat.com/~ahardin/10112016/dot-net/using_images/s2i_images/dot_net_core.html

@@ -678,6 +678,8 @@ Topics:
File: index
- Name: Customizing S2I images
File: customizing_s2i_images
- Name: .NET Core
File: dot_net_core
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: make this list alphabetical

----

After you enter into the running container, your current directory is set to
*_/opt/app-root/src_*, where the source code is located.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems cut off?

also do we actually know that the .NET image supports hot deployment? Since it's a compiled language i'd expect at a minimum that you need to sync compiled files to the container, not just modify live source.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, AFAIK sources need compiling. Unlike Ruby or Python. Looping in @omajid who might know more about it. Not sure if a section on Hot Deployment makes sense for .Net.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.NET Core is very similar to Java in this regard: you will have to compile the sources before you can run your application. The current set of commands that do all that is dotnet restore && dotnet build to build and then dotnet run to run them.

.NET Core does not support hot deployment, at least not out of the box. There may be third party libraries that allow you to do that.

It's also worth noting that .NET hCore as support for producing a fat binary (that includes compiled user code and the .NET VM) that we can use to build a smaller VM for deployment.

without having to generate a new build.

Use the
xref:../../dev_guide/new_app.adoc#specifying-environment-variables[`oc new-app`]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somebody mentioned that oc new-app has support for .Net now. Perhaps we should name the exact example which works. @bparees would probably know. The sample app source is here: https://github.com/redhat-developer/s2i-dotnetcore/tree/master/1.0/test/asp-net-hello-world I.e. the equivalent of

sudo s2i build git://github.com/redhat-developer/s2i-dotnetcore --context-dir=1.0/test/asp-net-hello-world dotnet/dotnetcore-10-rhel7 dotnet-sample-app

but using oc new-app

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, new-app will recognize .net git repos now and pick the .net imagestream. i agree that we should have a sample using new-app and pointing to a sample .net app. is s2i-dotnetcore the home of the canonical .net sample app though? I thought we had a standalone sample repo.

new-app doesn't let you specify a contextDir within a repo, so it has to be pointed to a repo that contains the source you want to build in the root of the repo.

also none of the other image docs contain an example like this. they should, but they don't, so for now we can probably live without it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, we don't have a stand-alone repo with samples as of yet. I was not aware that new-app does not recognize contextDir. Let's leave this example out for now :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I was wrong, it is supported:

 oc new-app https://github.com/youruser/yourgitrepo --context-dir=src/build
      --context-dir='': Context directory to be used for the build.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'd expect this to work then:

$ oc new-app https://github.com/redhat-developer/s2i-dotnetcore --context-dir=1.0/test/asp-net-hello-world

I have no way to test this, though. If it does, we should add this example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that command works as long as the imagestream is installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bparees Thanks for confirming. How can the user ensure that the imagestream is installed before running oc new-app? Is there something specific they can run beforehand?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a topic worth discussing in this doc. if they used a standard install, the imagestream will be there.

== Supported Versions

* .NET Core framework version 1.0.
* .NET is supported by Red Hat Enterprise Linux (RHEL) 7.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

".NET" should be ".NET Core", right? RHEL doesn't support .NET Framework or other .NET implementations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@omajid Yes, .NET Core. Typo on my part.

@ahardin-rh ahardin-rh force-pushed the dot-net branch 2 times, most recently from 933336e to e430052 Compare October 13, 2016 17:56
@ahardin-rh
Copy link
Contributor Author

ahardin-rh commented Oct 13, 2016

* Access to many of the popular development frameworks such as .NET, Java, Ruby,
and Python from within {product-title}.

{nbsp}.NET Core can produce a multi-architecture binary, including compiled user
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerboaa @bparees I placed this here for now, but how would a user do this?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a question for @omajid. I, for one, have no idea ;-)

Copy link
Contributor

@omajid omajid Oct 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two ways of publishing (as .NET Core docs refer to them) applications:

  • Build the source code and produce an artifact that relies on the .NET Core runtime being present on the system where the code will be executed. Users use the dotnet publish command.
  • Build the source code and bundle in any dependencies - including the .NET Core runtime itself - to produce an application that will run without needing a .NET Core runtime on the system where it's being deployed. Users have to make sure the runtime (rhel.7-x64) is present in their project.json and then do dotnet publish <other args> -r rhel.7-x64).

Complete details for publishing both styles of code is available here: https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing to note: the fat binary (that includes both the built source and the .NET Core runtime) is not portable across architectures. It's a native binary. The version built for RHEL, for example, won't run on Windows.

----

[NOTE]
====
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bparees @jerboaa Added this as a note for now, but it would be nice to include a full example. Do we have a standalone sample repo?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No standalone sample repo as of yet.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please test the oc new-app example above with --context-dir and add it here if it works as desired. I don't have an OpenShift install with all pieces in place in order to test this. @bparees might be able to help.

[[dot-net-core-supported-versions]]
== Supported Versions

* .NET Core framework version 1.0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please change this to ".NET Core version 1.0"? .NET Core and .NET Framework are separate things and calling something ".NET Core framework" may confuse readers.

@@ -107,23 +107,27 @@ builder to use by the presence of certain files in the root of the repository:

|Language |Files

a|`ruby`
a|*_Rakefile_*, *_Gemfile_*, *_config.ru_*
a|`dotnet`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bparees I added .NET to the Languages Detected by new-app table. PTAL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ahardin-rh
Copy link
Contributor Author

@bparees @jerboaa @omajid @adellape Reworked this a bit. Updated preview build:
http://file.rdu.redhat.com/~ahardin/10112016/dot-net/using_images/s2i_images/dot_net_core.html

As it is broken up now, Quickly Deploying Applications from .NET Core Source is separated from Manually Deploying Applications. Some questions:

  • Where is the user running the manual steps? Do they have th SSH in beforehand?
  • Why would the user choose the manual way?
  • Would all of the manual steps automatically happen in the background while oc new-app is run?

Thanks in advance for helping me tighten this up.

+
----
$ dotnet publish <other args> -r rhel.7-x64
----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't understand this whole "deploying manually" section. If the intent is to explain to users how to build their application locally and then package it into an image and run that image, this section stops short of actually explaining how to package their compiled application into an image or get it deployed.

As it is, it just reads like a tutorial on how to locally build/package a dotnet app, which isn't relevant to either openshift or the dotnet image..so what is the intent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bparees Thanks. I removed that section.


[NOTE]
====
The fat binary. which includes both the built source and the .NET Core runtime,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/binary./binary,/

@ahardin-rh ahardin-rh changed the title [WIP]New Using .NET Core with OCP topic New Using .NET Core with OCP topic Oct 17, 2016
@ahardin-rh
Copy link
Contributor Author

@bparees @jerboaa @omajid @adellape I made further updates. Please take a look. Thanks.

@omajid
Copy link
Contributor

omajid commented Oct 17, 2016

Looks good to me.

@bparees
Copy link
Contributor

bparees commented Oct 17, 2016

@ahardin-rh our other image docs include a section that identifies the docker pull spec for the image(s), is there a reason this one does not?

https://github.com/openshift/openshift-docs/blob/master/using_images/s2i_images/nodejs.adoc#images

@ahardin-rh
Copy link
Contributor Author

@bparees No good reason. Only that I didn't understand that it was relevant here. I'd be happy to add that in with your guidance. What bits would need to change from the Node.js content you link to? Thanks!

@bparees
Copy link
Contributor

bparees commented Oct 17, 2016

i don't think we have a centos image, but @jerboaa would have to confirm.

otherwise you just need to change the image path (eg registry.access.redhat.com/openshift3/nodejs-010-rhel7) to whatever the imagepath is for the dotnet image.

also you'd want to strip this sentence "You can find example image stream definitions for all the provided {product-title} images." because the dotnet imagestream isn't found where that sentence points. Though if @jerboaa can give you a proper link to the dotnet core imagestream, you could include that instead.

@jerboaa
Copy link

jerboaa commented Oct 18, 2016

@bparees @ahardin-rh

There is no centos image mirror of the RHEL one as of yet that I'm aware of.

Image url for dotnet is registry.access.redhat.com/dotnet/dotnetcore-10-rhel7. Image stream which should be part of OpenShift is here:
https://github.com/redhat-developer/s2i-dotnetcore/blob/master/dotnet_imagestreams.json

@ahardin-rh ahardin-rh force-pushed the dot-net branch 2 times, most recently from 0be5dc4 to de88ade Compare October 18, 2016 17:53
@ahardin-rh
Copy link
Contributor Author

@bparees @jerboaa Thanks so much. These updates are made and the latest preview build can be found here:
http://file.rdu.redhat.com/~ahardin/10182016/dot-net/using_images/s2i_images/dot_net_core.html
Please let me know if any edits are needed. Thanks again!

@bparees
Copy link
Contributor

bparees commented Oct 18, 2016

lgtm.


[IMPORTANT]
====
The .NET image stream must first be installed. If you ran a standard
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerboaa
Copy link

jerboaa commented Oct 19, 2016

Looks good to me. Up to you whether you want to incorporate my last nit. :)

@ahardin-rh
Copy link
Contributor Author

@jerboaa Good idea. The link is now added. Thanks!

Got the thumbs up from QE, so I am merging now. Thanks to all!

@ahardin-rh ahardin-rh merged commit 71ce8eb into openshift:master Oct 19, 2016
@ahardin-rh
Copy link
Contributor Author

[rev_history]
|xref:../using_images/s2i_images/dot_net_core.adoc#using-images-using-dot-net-core[Source-to-Image (S2I) -> .NET Core]
|New topic about using .NET Core with {product-title}.
%

@ahardin-rh
Copy link
Contributor Author

@jerboaa @bparees Is this content relevant for Origin? I ask because we note that this is as being supported in OCP 3.3 and later. I am needing to conditionalize the content more, but need to know to what extent. Thanks!

@bparees
Copy link
Contributor

bparees commented Oct 27, 2016

as far as i know there's no centos image available, so it wouldn't be relevant to origin.

@jerboaa
Copy link

jerboaa commented Oct 28, 2016

@bparees is correct.

@ahardin-rh ahardin-rh deleted the dot-net branch November 9, 2017 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants