-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
I defer to @jerboaa |
@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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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?
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 |
this doc should be reworked to follow the pattern here: 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). |
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 |
There was a problem hiding this comment.
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?
63d1369
to
8f39691
Compare
@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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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`] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
933336e
to
e430052
Compare
@bparees @jerboaa @adellape I made some updates. Please review. Thanks! Preview build: http://file.rdu.redhat.com/~ahardin/10112016/dot-net/using_images/s2i_images/dot_net_core.html |
* 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 ;-)
There was a problem hiding this comment.
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 theirproject.json
and then dodotnet 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/
There was a problem hiding this comment.
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] | ||
==== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@bparees @jerboaa @omajid @adellape Reworked this a bit. Updated preview build: As it is broken up now, Quickly Deploying Applications from .NET Core Source is separated from Manually Deploying Applications. Some questions:
Thanks in advance for helping me tighten this up. |
+ | ||
---- | ||
$ dotnet publish <other args> -r rhel.7-x64 | ||
---- |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/binary./binary,/
Looks good to me. |
@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? |
@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! |
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. |
There is no centos image mirror of the RHEL one as of yet that I'm aware of. Image url for dotnet is |
0be5dc4
to
de88ade
Compare
@bparees @jerboaa Thanks so much. These updates are made and the latest preview build can be found here: |
lgtm. |
|
||
[IMPORTANT] | ||
==== | ||
The .NET image stream must first be installed. If you ran a standard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.Net image stream
could be made a link to: https://github.com/redhat-developer/s2i-dotnetcore/blob/master/dotnet_imagestreams.json as well.
Looks good to me. Up to you whether you want to incorporate my last nit. :) |
@jerboaa Good idea. The link is now added. Thanks! Got the thumbs up from QE, so I am merging now. Thanks to all! |
[rev_history] |
as far as i know there's no centos image available, so it wouldn't be relevant to origin. |
@bparees is correct. |
Targeted for 3.3.1
https://bugzilla.redhat.com/show_bug.cgi?id=1382870