OpenShiftセカンド・ステップ
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
「[[.NET 開発基盤部会 Wiki>http://dotnetdevelopmentinfras...
-[[戻る>OpenShift]]
--[[OpenShiftファースト・ステップ]]
--OpenShiftセカンド・ステップ
*目次 [#x4916341]
#contents
*概要 [#lf3cae5d]
-「[[ファースト・ステップ>OpenShiftファースト・ステップ]]...
基本的操作とJBossアプリケーションのデプロイを行った。
-「セカンド・ステップ」では、~
ASP.NET Coreアプリケーションのデプロイを行う。
-[[必要であればローカルに.NET Coreが必要。>https://techin...
*立上 [#ica6cbbb]
-いきなり
>「まずは手順に従って、imagestreamを設定するのですが、~
最初は検証用のプロジェクトを作ってそのプロジェクトに~
imagestreamを作ってみましょう。」
>とあって、「[[imagestream>OpenShift#r01d6b00]]」なんて「...
出てきてないので、潔く「[[Red Hat Customer Portal>#we8ccd...
-「[[ファースト・ステップ>OpenShiftファースト・ステップ]]...
古いようなので、新しいバージョンを取得する。~
https://github.com/openshift/origin/releases
*詳細 [#sf031fab]
**2.1. Install [[Image Streams>OpenShift#r01d6b00]] [#v51...
***dotnetの一覧表示 [#d86a025e]
-既に OpenShift の一部である場合がある。
-次のコマンドで、名前空間で使用可能なdotnetを一覧表示する。
>oc describe is dotnet --namespace openshift
Name: dotnet
Namespace: openshift
Created: 51 minutes ago
Labels: <none>
Annotations: openshift.io/display-name=.NET C...
openshift.io/image.dockerReposit...
Docker Pull Spec: docker-registry.default.svc:5000...
Unique Images: 3
Tags: 4
2.0 (latest)
tagged from registry.access.redhat.com/dotnet/dotnet-2...
Build and run .NET Core 2.0 applications on RHEL 7. Fo...
Tags: builder, .net, dotnet, dotnetcore, rh-dotnet20
Supports: dotnet:2.0, dotnet
Example Repo: https://github.com/redhat-developer/s2i-...
* registry.access.redhat.com/dotnet/dotnet-20-rhel7@sh...
51 minutes ago
1.1
tagged from registry.access.redhat.com/dotnet/dotnetco...
Build and run .NET Core 1.1 applications on RHEL 7. Fo...
Tags: builder, .net, dotnet, dotnetcore, rh-dotnetcore11
Supports: dotnet:1.1, dotnet
Example Repo: https://github.com/redhat-developer/s2i-...
* registry.access.redhat.com/dotnet/dotnetcore-11-rhel...
51 minutes ago
1.0
tagged from registry.access.redhat.com/dotnet/dotnetco...
Build and run .NET Core 1.0 applications on RHEL 7. Fo...
Tags: builder, .net, dotnet, dotnetcore, rh-dotnetcore10
Supports: dotnet:1.0, dotnet
Example Repo: https://github.com/redhat-developer/s2i-...
* registry.access.redhat.com/dotnet/dotnetcore-10-rhel...
51 minutes ago
***[[Image Streams>OpenShift#r01d6b00]]を追加 [#h6fe4348]
希望のバージョンがない場合、[[Image Streams>OpenShift#r01...
>oc create -f https://raw.githubusercontent.com/redhat-d...
***[[Image Streams>OpenShift#r01d6b00]]をグローバルに追加...
権限があれば、[[Image Streams>OpenShift#r01d6b00]]をグロ...
>oc create --namespace openshift -f https://raw.githubus...
**2.2. Deploy Applications [#d7ebdc73]
***oc new-app [#b8fa42da]
github.comのredhat-developer/s2i-dotnetcore-exの~
dotnetcore-2.0ブランチのaspnetcore2アプリをappフォルダに...
(dotnet:2.0で)読み込んだ[[Image Streams>OpenShift#r01d6...
>oc new-app --name=exampleapp 'dotnet:2.0~https://github...
***進行状況の確認 [#ka02c0ae]
>oc logs -f bc/exampleapp
***[[サービス>OpenShift#l875353c]]のルートを作成する。 [#...
>oc expose svc/exampleapp
>oc get routes
**2.3. Configuration [#k34561d1]
***概要 [#s621136d]
-.NET Coreイメージは、.NET Core用の環境変数をサポートして...
-これらの変数は、
--ビルド構成の一部として設定することも、
--リポジトリの「.s2i/environment」ファイルに追加することも
>できる。
***環境変数の一覧 [#y7b1efea]
|#|名前|説明|既定値|h
|1|DOTNET_STARTUP_PROJECT|プロジェクト・ファイルを含むフ...
|2|DOTNET_ASSEMBLY_NAME|アセンブリ名(.dll拡張子を含めな...
|3|DOTNET_RESTORE_SOURCES|NuGetパッケージソースのスペース...
|4|DOTNET_NPM_TOOLS|NPMパッケージのリスト|Unset|
|5|DOTNET_TEST_PROJECTS|テストプロジェクトのフォルダのリ...
|6|DOTNET_CONFIGURATION|デバッグモード(Release)/リリー...
|7|ASPNETCORE_URLS|公開ポート(OpenShiftに於いて変更は非...
**2.4. Sample Applications [#s4593bee]
3つのサンプルアプリケーションが利用可能
***説明 [#caaf8051]
|#|名前|説明|h
|1|dotnet-example|デフォルトのMVCアプリケーション|
|2|dotnet-runtime-example|ランタイム・イメージとビルド・...
|3|dotnet-pgsql-persistent|Music Storeサンプルアプリケー...
***利用 [#u35c1046]
-ポータルを使用
--プロジェクトを参照
--[プロジェクトに追加]をクリック
-CLIを使用
--プロジェクトに追加
---dotnet-example
>oc create -f https://raw.githubusercontent.com/redhat-d...
---dotnet-runtime-example
>oc create -f https://raw.githubusercontent.com/redhat-d...
---dotnet-pgsql-persistent.json
> oc create -f https://raw.githubusercontent.com/redhat-...
--グローバルに追加
---dotnet-example
>oc create -n openshift -f https://raw.githubusercontent...
>oc replace -n openshift -f https://raw.githubuserconten...
---dotnet-runtime-example
>oc create -n openshift -f https://raw.githubusercontent...
>oc replace -n openshift -f https://raw.githubuserconten...
---dotnet-pgsql-persistent.json
>oc create -n openshift -f https://raw.githubusercontent...
>oc replace -n openshift -f https://raw.githubuserconten...
**2.5. Create a Runtime Image [#mb1e4050]
-[[chaining-buildsのBuild Configuration>OpenShift#tf47d74...
dotnet-runtime-example templateが参考になる。
-このテンプレートでは、
--「*-build」と
--「*-runtime」の
>[[Build Configuration>OpenShift#tf47d740]]を定義する。
***ビルド・イメージ [#i8f20e54]
-GitHubプロジェクトから構築され、
-変更を自動的に再構築するトリガを持つ。
--プロジェクトが変更されたとき
--またはベース・イメージ(dotnet-20-rhel7)が更新されたとき
***ランタイム・イメージ [#t6a48587]
-dotnet-20-runtime-rhel7ベース・イメージから構築される。
--ビルド・イメージからtar.gzファイルを取得。
--ビルド設定でこのソース定義を使用。
-変更を自動的に再構築するトリガを持つ。
--プロジェクトの内部[[Image Streams>OpenShift#r01d6b00]]...
--またはdotnet-20-runtime-rhel7ベースイメージが更新された...
-ランタイムイメージ用に定義されたデプロイメントを持つ。
--ビルドイメージにはデプロイメントは必要ない。
***トリガ [#pca91ef7]
トリガを使用すると、イメージやコードが更新されたときに、~
チェーン内のオブジェクトが必要に応じて再構築される。
*演習 [#x661662d]
-ログイン
>oc login https://opnshdnsxx.centralus.cloudapp.azure.co...
**dotnet-example [#b08fcd4a]
***[[Image Streams>OpenShift#r01d6b00]] + GitソースURIか...
-プロジェクトを生成
>oc new-project pj11
-[[Image Streams>OpenShift#r01d6b00]]の読込。
>oc create -f https://raw.githubusercontent.com/redhat-d...
imagestream "dotnet" created
imagestream "dotnet-runtime" created
-アプリケーションを生成
>oc new-app --name=exampleapp "dotnet:2.0~https://github...
--> Found image 98871f3 (8 days old) in image stream "pj...
.NET Core 2.0
-------------
Platform for building and running .NET Core 2.0 appl...
Tags: builder, .net, dotnet, dotnetcore, rh-dotnet20
* A source build using source code from https://gith...
* The resulting image will be pushed to image stre...
* Use 'start-build' to trigger a new build
* This image will be deployed in deployment config "...
* Port 8080/tcp will be load balanced by service "ex...
* Other containers can access this service through...
--> Creating resources ...
imagestream "exampleapp" created
buildconfig "exampleapp" created
deploymentconfig "exampleapp" created
service "exampleapp" created
--> Success
Build scheduled, use 'oc logs -f bc/exampleapp' to t...
Run 'oc status' to view your app.
-進行状況の確認~
>oc logs -f bc/exampleapp
Cloning "https://github.com/redhat-developer/s2i-dotnetc...
Commit: 0543be02d0be779d08e6c43f82ef9f0610f5d4e3...
Author: Severin Gehwolf <jerboaa@gmail.com>
Date: Mon Aug 21 18:00:03 2017 +0200
Using SDK: 2.0.3
---> Copying application source ...
---> Restoring application dependencies...
Restoring packages for /opt/app-root/src/app/app.csproj...
Restoring packages for /opt/app-root/src/app/app.csproj...
Installing System.Xml.XmlSerializer 4.0.11.
・・・
Generating MSBuild file /opt/app-root/src/app/obj/app.cs...
Generating MSBuild file /opt/app-root/src/app/obj/app.cs...
Restore completed in 20.24 sec for /opt/app-root/src/app...
---> Publishing application...
Microsoft (R) Build Engine version 15.4.8.50081 for .NET...
Copyright (C) Microsoft Corporation. All rights reserved.
app -> /opt/app-root/src/app/bin/Release/netcoreapp2.0/a...
app -> /opt/app-root/app/
Pushing image docker-registry.default.svc:5000/pj11/exam...
Pushed 0/5 layers, 5% complete
Pushed 1/5 layers, 30% complete
Pushed 2/5 layers, 44% complete
Pushed 3/5 layers, 79% complete
Pushed 4/5 layers, 96% complete
Pushed 5/5 layers, 100% complete
Push successful
-[[サービス>OpenShift#l875353c]]のルートを作成する。
>oc get routes
No resources found.
>oc expose svc/exampleapp
route "exampleapp" exposed
>oc get routes
NAME HOST/PORT PAT...
exampleapp exampleapp-pj11.XXX.XXX.XXX.XXX.nip.io ...
-[[サービス>OpenShift#l875353c]]にアクセスする。~
プレーンなMVCアプリが起動する。
***テンプレートからデプロイする。 [#z54b90a2]
-プロジェクトを生成
>oc new-project pj12
-テンプレートの読込
>oc create -f https://raw.githubusercontent.com/redhat-d...
template "dotnet-example" created
-アプリケーションを生成
>oc new-app dotnet-example --name=exampleapp
--> Deploying template "openshift/dotnet-example" to pr...
.NET Core Example
---------
An example .NET Core application.
* With parameters:
* Name=dotnet-example
* Memory Limit=512Mi
* .NET builder=dotnet:2.0
* Namespace=openshift
* Git Repository URL=https://github.com/redhat-d...
* Git Reference=dotnetcore-2.0
* Context Directory=
* Application Hostname=
* GitHub Webhook Secret=Hagf1B7MCijAH1myO8dWjQRc...
* Generic Webhook Secret=FjstfIOXLbWdFixVqo0cyJ5...
* Startup Project=app
* Startup Assembly=
* Npm Tools=bower gulp
* Test projects=
* Configuration=Release
* NuGet package sources=
--> Creating resources ...
route "dotnet-example" created
service "dotnet-example" created
imagestream "dotnet-example" created
buildconfig "dotnet-example" created
deploymentconfig "dotnet-example" created
--> Success
Build scheduled, use 'oc logs -f bc/dotnet-example' ...
Run 'oc status' to view your app.
-進行状況の確認~
>oc logs -f bc/dotnet-example
C:\Users\nishi>oc logs -f bc/dotnet-example
Cloning "https://github.com/redhat-developer/s2i-dotnetc...
Commit: 0543be02d0be779d08e6c43f82ef9f0610f5d4e3...
Author: Severin Gehwolf <jerboaa@gmail.com>
Date: Mon Aug 21 18:00:03 2017 +0200
---> Installing npm tools ...
・・・
---> Copying application source ...
---> Restoring application dependencies...
Restoring packages for /opt/app-root/src/app/app.csproj...
Restoring packages for /opt/app-root/src/app/app.csproj...
Installing System.Xml.XmlSerializer 4.0.11.
・・・
Generating MSBuild file /opt/app-root/src/app/obj/app.cs...
Generating MSBuild file /opt/app-root/src/app/obj/app.cs...
Restore completed in 20.62 sec for /opt/app-root/src/app...
---> Publishing application...
Microsoft (R) Build Engine version 15.4.8.50081 for .NET...
Copyright (C) Microsoft Corporation. All rights reserved.
app -> /opt/app-root/src/app/bin/Release/netcoreapp2.0/a...
app -> /opt/app-root/app/
Pushing image docker-registry.default.svc:5000/pj12/dotn...
Pushed 4/5 layers, 82% complete
Pushed 5/5 layers, 100% complete
Push successful
-[[サービス>OpenShift#l875353c]]のルートを確認。
>oc get routes
NAME HOST/PORT ...
dotnet-example dotnet-example-pj12.XXX.XXX.XXX.XXX.nip...
-[[サービス>OpenShift#l875353c]]にアクセスする。~
プレーンなMVCアプリが起動する。
**dotnet-runtime-example [#z9e1fb1d]
***テンプレートからデプロイする。 [#y8812782]
-プロジェクトを生成
>oc new-project pj2
-テンプレートの読込
>oc create -f https://raw.githubusercontent.com/redhat-d...
template "dotnet-runtime-example" created
-アプリケーションを生成
>oc new-app dotnet-runtime-example --name=runtimeexample...
-進行状況の確認~
>oc logs -f bc/dotnet-runtime-example-build
>oc logs -f bc/dotnet-runtime-example-runtime
-[[サービス>OpenShift#l875353c]]のルートを確認。
>oc get routes
NAME HOST/PORT ...
dotnet-runtime-example dotnet-runtime-example-pj2.XXX....
-[[サービス>OpenShift#l875353c]]にアクセスする。~
プレーンなMVCアプリが起動する。
**dotnet-pgsql-persistent [#r7fc29bf]
***テンプレートからデプロイする。 [#v2a7923f]
-プロジェクトを生成
>oc new-project pj3
-テンプレートの読込
> oc create -f https://raw.githubusercontent.com/redhat-...
template "dotnet-pgsql-persistent" created
-アプリケーションを生成
>oc new-app dotnet-pgsql-persistent --name=persistentapp
-進行状況の確認~
>oc logs -f bc/musicstore
-[[サービス>OpenShift#l875353c]]のルートを確認。
>oc get routes
NAME HOST/PORT PATH...
musicstore musicstore-pj3.XXX.XXX.XXX.XXX.nip.io ...
-エラーになって起動できない。
>oc get pods
NAME READY STATUS RESTARTS AGE
musicstore-1-build 0/1 Completed 0 16m
musicstore-1-deploy 0/1 Error 0 14m
postgresql-1-deploy 0/1 Error 0 16m
-[[サービス>OpenShift#l875353c]]にアクセスする。~
musicstoreアプリが起動するハズだったが...。
**自作アプリ [#ga229368]
https://github.com/daisukenishino2/opneshift
***[[Image Streams>OpenShift#r01d6b00]] + GitソースURIか...
-プロジェクトを生成
>oc new-project pj4
-[[Image Streams>OpenShift#r01d6b00]]の読込。
>oc create -f https://raw.githubusercontent.com/redhat-d...
imagestream "dotnet" created
imagestream "dotnet-runtime" created
-アプリケーションを生成
>oc new-app --name=daisukenishino2opneshift "dotnet:2.0~...
-進行状況の確認~
>oc logs -f bc/daisukenishino2opneshift
-[[サービス>OpenShift#l875353c]]のルートを作成する。
>oc get routes
No resources found.
>oc expose svc/daisukenishino2opneshift
route "daisukenishino2opneshift" exposed
>oc get routes
NAME HOST/PORT ...
daisukenishino2opneshift daisukenishino2opneshift-pj4....
-[[サービス>OpenShift#l875353c]]にアクセスする。~
プレーンなMVCアプリが起動する。
*参考 [#sa74f43c]
**[[OpenShiftファースト・ステップ]] [#y5fda9ca]
**銀の光と碧い空 [#c6a0a798]
-OpenShift で .NET Core 2.0を使いはじめる~
http://tech.tanaka733.net/entry/2017/09/06/OpenShift_%E3%...
**redhat.com [#ga8c3948]
-Developing .NET Core 2.0 Web Applications on OpenShift -...
https://developers.redhat.com/blog/2017/11/22/developing-...
***Red Hat Customer Portal [#we8ccdea]
-Getting Started Guide~
https://access.redhat.com/documentation/en-us/net_core/2....
--Chapter 1. .NET Core 2.0 on Red Hat Enterprise Linux~
https://access.redhat.com/documentation/en-us/net_core/2....
---1.1. Install and Register Red Hat Enterprise Linux
---1.2. Install .NET Core
---1.3. Create an Application
---1.4. Publish Applications~
1.4.1. Publish .NET Core Applications~
1.4.2. Publish ASP.NET Core Applications
---1.5. Run Applications on Docker
--Chapter 2. .NET Core 2.0 on Red Hat OpenShift Container...
https://access.redhat.com/documentation/en-us/net_core/2....
---2.1. Install Image Streams
---2.2. Deploy Applications
---2.3. Configuration
---2.4. Sample Applications
---2.5. Create a Runtime Image
**openshift.com [#n82796b5]
-Announcing .NET Core 2.0 Support for OpenShift – OpenShi...
https://blog.openshift.com/announcing-net-core-2-0-suppor...
終了行:
「[[.NET 開発基盤部会 Wiki>http://dotnetdevelopmentinfras...
-[[戻る>OpenShift]]
--[[OpenShiftファースト・ステップ]]
--OpenShiftセカンド・ステップ
*目次 [#x4916341]
#contents
*概要 [#lf3cae5d]
-「[[ファースト・ステップ>OpenShiftファースト・ステップ]]...
基本的操作とJBossアプリケーションのデプロイを行った。
-「セカンド・ステップ」では、~
ASP.NET Coreアプリケーションのデプロイを行う。
-[[必要であればローカルに.NET Coreが必要。>https://techin...
*立上 [#ica6cbbb]
-いきなり
>「まずは手順に従って、imagestreamを設定するのですが、~
最初は検証用のプロジェクトを作ってそのプロジェクトに~
imagestreamを作ってみましょう。」
>とあって、「[[imagestream>OpenShift#r01d6b00]]」なんて「...
出てきてないので、潔く「[[Red Hat Customer Portal>#we8ccd...
-「[[ファースト・ステップ>OpenShiftファースト・ステップ]]...
古いようなので、新しいバージョンを取得する。~
https://github.com/openshift/origin/releases
*詳細 [#sf031fab]
**2.1. Install [[Image Streams>OpenShift#r01d6b00]] [#v51...
***dotnetの一覧表示 [#d86a025e]
-既に OpenShift の一部である場合がある。
-次のコマンドで、名前空間で使用可能なdotnetを一覧表示する。
>oc describe is dotnet --namespace openshift
Name: dotnet
Namespace: openshift
Created: 51 minutes ago
Labels: <none>
Annotations: openshift.io/display-name=.NET C...
openshift.io/image.dockerReposit...
Docker Pull Spec: docker-registry.default.svc:5000...
Unique Images: 3
Tags: 4
2.0 (latest)
tagged from registry.access.redhat.com/dotnet/dotnet-2...
Build and run .NET Core 2.0 applications on RHEL 7. Fo...
Tags: builder, .net, dotnet, dotnetcore, rh-dotnet20
Supports: dotnet:2.0, dotnet
Example Repo: https://github.com/redhat-developer/s2i-...
* registry.access.redhat.com/dotnet/dotnet-20-rhel7@sh...
51 minutes ago
1.1
tagged from registry.access.redhat.com/dotnet/dotnetco...
Build and run .NET Core 1.1 applications on RHEL 7. Fo...
Tags: builder, .net, dotnet, dotnetcore, rh-dotnetcore11
Supports: dotnet:1.1, dotnet
Example Repo: https://github.com/redhat-developer/s2i-...
* registry.access.redhat.com/dotnet/dotnetcore-11-rhel...
51 minutes ago
1.0
tagged from registry.access.redhat.com/dotnet/dotnetco...
Build and run .NET Core 1.0 applications on RHEL 7. Fo...
Tags: builder, .net, dotnet, dotnetcore, rh-dotnetcore10
Supports: dotnet:1.0, dotnet
Example Repo: https://github.com/redhat-developer/s2i-...
* registry.access.redhat.com/dotnet/dotnetcore-10-rhel...
51 minutes ago
***[[Image Streams>OpenShift#r01d6b00]]を追加 [#h6fe4348]
希望のバージョンがない場合、[[Image Streams>OpenShift#r01...
>oc create -f https://raw.githubusercontent.com/redhat-d...
***[[Image Streams>OpenShift#r01d6b00]]をグローバルに追加...
権限があれば、[[Image Streams>OpenShift#r01d6b00]]をグロ...
>oc create --namespace openshift -f https://raw.githubus...
**2.2. Deploy Applications [#d7ebdc73]
***oc new-app [#b8fa42da]
github.comのredhat-developer/s2i-dotnetcore-exの~
dotnetcore-2.0ブランチのaspnetcore2アプリをappフォルダに...
(dotnet:2.0で)読み込んだ[[Image Streams>OpenShift#r01d6...
>oc new-app --name=exampleapp 'dotnet:2.0~https://github...
***進行状況の確認 [#ka02c0ae]
>oc logs -f bc/exampleapp
***[[サービス>OpenShift#l875353c]]のルートを作成する。 [#...
>oc expose svc/exampleapp
>oc get routes
**2.3. Configuration [#k34561d1]
***概要 [#s621136d]
-.NET Coreイメージは、.NET Core用の環境変数をサポートして...
-これらの変数は、
--ビルド構成の一部として設定することも、
--リポジトリの「.s2i/environment」ファイルに追加することも
>できる。
***環境変数の一覧 [#y7b1efea]
|#|名前|説明|既定値|h
|1|DOTNET_STARTUP_PROJECT|プロジェクト・ファイルを含むフ...
|2|DOTNET_ASSEMBLY_NAME|アセンブリ名(.dll拡張子を含めな...
|3|DOTNET_RESTORE_SOURCES|NuGetパッケージソースのスペース...
|4|DOTNET_NPM_TOOLS|NPMパッケージのリスト|Unset|
|5|DOTNET_TEST_PROJECTS|テストプロジェクトのフォルダのリ...
|6|DOTNET_CONFIGURATION|デバッグモード(Release)/リリー...
|7|ASPNETCORE_URLS|公開ポート(OpenShiftに於いて変更は非...
**2.4. Sample Applications [#s4593bee]
3つのサンプルアプリケーションが利用可能
***説明 [#caaf8051]
|#|名前|説明|h
|1|dotnet-example|デフォルトのMVCアプリケーション|
|2|dotnet-runtime-example|ランタイム・イメージとビルド・...
|3|dotnet-pgsql-persistent|Music Storeサンプルアプリケー...
***利用 [#u35c1046]
-ポータルを使用
--プロジェクトを参照
--[プロジェクトに追加]をクリック
-CLIを使用
--プロジェクトに追加
---dotnet-example
>oc create -f https://raw.githubusercontent.com/redhat-d...
---dotnet-runtime-example
>oc create -f https://raw.githubusercontent.com/redhat-d...
---dotnet-pgsql-persistent.json
> oc create -f https://raw.githubusercontent.com/redhat-...
--グローバルに追加
---dotnet-example
>oc create -n openshift -f https://raw.githubusercontent...
>oc replace -n openshift -f https://raw.githubuserconten...
---dotnet-runtime-example
>oc create -n openshift -f https://raw.githubusercontent...
>oc replace -n openshift -f https://raw.githubuserconten...
---dotnet-pgsql-persistent.json
>oc create -n openshift -f https://raw.githubusercontent...
>oc replace -n openshift -f https://raw.githubuserconten...
**2.5. Create a Runtime Image [#mb1e4050]
-[[chaining-buildsのBuild Configuration>OpenShift#tf47d74...
dotnet-runtime-example templateが参考になる。
-このテンプレートでは、
--「*-build」と
--「*-runtime」の
>[[Build Configuration>OpenShift#tf47d740]]を定義する。
***ビルド・イメージ [#i8f20e54]
-GitHubプロジェクトから構築され、
-変更を自動的に再構築するトリガを持つ。
--プロジェクトが変更されたとき
--またはベース・イメージ(dotnet-20-rhel7)が更新されたとき
***ランタイム・イメージ [#t6a48587]
-dotnet-20-runtime-rhel7ベース・イメージから構築される。
--ビルド・イメージからtar.gzファイルを取得。
--ビルド設定でこのソース定義を使用。
-変更を自動的に再構築するトリガを持つ。
--プロジェクトの内部[[Image Streams>OpenShift#r01d6b00]]...
--またはdotnet-20-runtime-rhel7ベースイメージが更新された...
-ランタイムイメージ用に定義されたデプロイメントを持つ。
--ビルドイメージにはデプロイメントは必要ない。
***トリガ [#pca91ef7]
トリガを使用すると、イメージやコードが更新されたときに、~
チェーン内のオブジェクトが必要に応じて再構築される。
*演習 [#x661662d]
-ログイン
>oc login https://opnshdnsxx.centralus.cloudapp.azure.co...
**dotnet-example [#b08fcd4a]
***[[Image Streams>OpenShift#r01d6b00]] + GitソースURIか...
-プロジェクトを生成
>oc new-project pj11
-[[Image Streams>OpenShift#r01d6b00]]の読込。
>oc create -f https://raw.githubusercontent.com/redhat-d...
imagestream "dotnet" created
imagestream "dotnet-runtime" created
-アプリケーションを生成
>oc new-app --name=exampleapp "dotnet:2.0~https://github...
--> Found image 98871f3 (8 days old) in image stream "pj...
.NET Core 2.0
-------------
Platform for building and running .NET Core 2.0 appl...
Tags: builder, .net, dotnet, dotnetcore, rh-dotnet20
* A source build using source code from https://gith...
* The resulting image will be pushed to image stre...
* Use 'start-build' to trigger a new build
* This image will be deployed in deployment config "...
* Port 8080/tcp will be load balanced by service "ex...
* Other containers can access this service through...
--> Creating resources ...
imagestream "exampleapp" created
buildconfig "exampleapp" created
deploymentconfig "exampleapp" created
service "exampleapp" created
--> Success
Build scheduled, use 'oc logs -f bc/exampleapp' to t...
Run 'oc status' to view your app.
-進行状況の確認~
>oc logs -f bc/exampleapp
Cloning "https://github.com/redhat-developer/s2i-dotnetc...
Commit: 0543be02d0be779d08e6c43f82ef9f0610f5d4e3...
Author: Severin Gehwolf <jerboaa@gmail.com>
Date: Mon Aug 21 18:00:03 2017 +0200
Using SDK: 2.0.3
---> Copying application source ...
---> Restoring application dependencies...
Restoring packages for /opt/app-root/src/app/app.csproj...
Restoring packages for /opt/app-root/src/app/app.csproj...
Installing System.Xml.XmlSerializer 4.0.11.
・・・
Generating MSBuild file /opt/app-root/src/app/obj/app.cs...
Generating MSBuild file /opt/app-root/src/app/obj/app.cs...
Restore completed in 20.24 sec for /opt/app-root/src/app...
---> Publishing application...
Microsoft (R) Build Engine version 15.4.8.50081 for .NET...
Copyright (C) Microsoft Corporation. All rights reserved.
app -> /opt/app-root/src/app/bin/Release/netcoreapp2.0/a...
app -> /opt/app-root/app/
Pushing image docker-registry.default.svc:5000/pj11/exam...
Pushed 0/5 layers, 5% complete
Pushed 1/5 layers, 30% complete
Pushed 2/5 layers, 44% complete
Pushed 3/5 layers, 79% complete
Pushed 4/5 layers, 96% complete
Pushed 5/5 layers, 100% complete
Push successful
-[[サービス>OpenShift#l875353c]]のルートを作成する。
>oc get routes
No resources found.
>oc expose svc/exampleapp
route "exampleapp" exposed
>oc get routes
NAME HOST/PORT PAT...
exampleapp exampleapp-pj11.XXX.XXX.XXX.XXX.nip.io ...
-[[サービス>OpenShift#l875353c]]にアクセスする。~
プレーンなMVCアプリが起動する。
***テンプレートからデプロイする。 [#z54b90a2]
-プロジェクトを生成
>oc new-project pj12
-テンプレートの読込
>oc create -f https://raw.githubusercontent.com/redhat-d...
template "dotnet-example" created
-アプリケーションを生成
>oc new-app dotnet-example --name=exampleapp
--> Deploying template "openshift/dotnet-example" to pr...
.NET Core Example
---------
An example .NET Core application.
* With parameters:
* Name=dotnet-example
* Memory Limit=512Mi
* .NET builder=dotnet:2.0
* Namespace=openshift
* Git Repository URL=https://github.com/redhat-d...
* Git Reference=dotnetcore-2.0
* Context Directory=
* Application Hostname=
* GitHub Webhook Secret=Hagf1B7MCijAH1myO8dWjQRc...
* Generic Webhook Secret=FjstfIOXLbWdFixVqo0cyJ5...
* Startup Project=app
* Startup Assembly=
* Npm Tools=bower gulp
* Test projects=
* Configuration=Release
* NuGet package sources=
--> Creating resources ...
route "dotnet-example" created
service "dotnet-example" created
imagestream "dotnet-example" created
buildconfig "dotnet-example" created
deploymentconfig "dotnet-example" created
--> Success
Build scheduled, use 'oc logs -f bc/dotnet-example' ...
Run 'oc status' to view your app.
-進行状況の確認~
>oc logs -f bc/dotnet-example
C:\Users\nishi>oc logs -f bc/dotnet-example
Cloning "https://github.com/redhat-developer/s2i-dotnetc...
Commit: 0543be02d0be779d08e6c43f82ef9f0610f5d4e3...
Author: Severin Gehwolf <jerboaa@gmail.com>
Date: Mon Aug 21 18:00:03 2017 +0200
---> Installing npm tools ...
・・・
---> Copying application source ...
---> Restoring application dependencies...
Restoring packages for /opt/app-root/src/app/app.csproj...
Restoring packages for /opt/app-root/src/app/app.csproj...
Installing System.Xml.XmlSerializer 4.0.11.
・・・
Generating MSBuild file /opt/app-root/src/app/obj/app.cs...
Generating MSBuild file /opt/app-root/src/app/obj/app.cs...
Restore completed in 20.62 sec for /opt/app-root/src/app...
---> Publishing application...
Microsoft (R) Build Engine version 15.4.8.50081 for .NET...
Copyright (C) Microsoft Corporation. All rights reserved.
app -> /opt/app-root/src/app/bin/Release/netcoreapp2.0/a...
app -> /opt/app-root/app/
Pushing image docker-registry.default.svc:5000/pj12/dotn...
Pushed 4/5 layers, 82% complete
Pushed 5/5 layers, 100% complete
Push successful
-[[サービス>OpenShift#l875353c]]のルートを確認。
>oc get routes
NAME HOST/PORT ...
dotnet-example dotnet-example-pj12.XXX.XXX.XXX.XXX.nip...
-[[サービス>OpenShift#l875353c]]にアクセスする。~
プレーンなMVCアプリが起動する。
**dotnet-runtime-example [#z9e1fb1d]
***テンプレートからデプロイする。 [#y8812782]
-プロジェクトを生成
>oc new-project pj2
-テンプレートの読込
>oc create -f https://raw.githubusercontent.com/redhat-d...
template "dotnet-runtime-example" created
-アプリケーションを生成
>oc new-app dotnet-runtime-example --name=runtimeexample...
-進行状況の確認~
>oc logs -f bc/dotnet-runtime-example-build
>oc logs -f bc/dotnet-runtime-example-runtime
-[[サービス>OpenShift#l875353c]]のルートを確認。
>oc get routes
NAME HOST/PORT ...
dotnet-runtime-example dotnet-runtime-example-pj2.XXX....
-[[サービス>OpenShift#l875353c]]にアクセスする。~
プレーンなMVCアプリが起動する。
**dotnet-pgsql-persistent [#r7fc29bf]
***テンプレートからデプロイする。 [#v2a7923f]
-プロジェクトを生成
>oc new-project pj3
-テンプレートの読込
> oc create -f https://raw.githubusercontent.com/redhat-...
template "dotnet-pgsql-persistent" created
-アプリケーションを生成
>oc new-app dotnet-pgsql-persistent --name=persistentapp
-進行状況の確認~
>oc logs -f bc/musicstore
-[[サービス>OpenShift#l875353c]]のルートを確認。
>oc get routes
NAME HOST/PORT PATH...
musicstore musicstore-pj3.XXX.XXX.XXX.XXX.nip.io ...
-エラーになって起動できない。
>oc get pods
NAME READY STATUS RESTARTS AGE
musicstore-1-build 0/1 Completed 0 16m
musicstore-1-deploy 0/1 Error 0 14m
postgresql-1-deploy 0/1 Error 0 16m
-[[サービス>OpenShift#l875353c]]にアクセスする。~
musicstoreアプリが起動するハズだったが...。
**自作アプリ [#ga229368]
https://github.com/daisukenishino2/opneshift
***[[Image Streams>OpenShift#r01d6b00]] + GitソースURIか...
-プロジェクトを生成
>oc new-project pj4
-[[Image Streams>OpenShift#r01d6b00]]の読込。
>oc create -f https://raw.githubusercontent.com/redhat-d...
imagestream "dotnet" created
imagestream "dotnet-runtime" created
-アプリケーションを生成
>oc new-app --name=daisukenishino2opneshift "dotnet:2.0~...
-進行状況の確認~
>oc logs -f bc/daisukenishino2opneshift
-[[サービス>OpenShift#l875353c]]のルートを作成する。
>oc get routes
No resources found.
>oc expose svc/daisukenishino2opneshift
route "daisukenishino2opneshift" exposed
>oc get routes
NAME HOST/PORT ...
daisukenishino2opneshift daisukenishino2opneshift-pj4....
-[[サービス>OpenShift#l875353c]]にアクセスする。~
プレーンなMVCアプリが起動する。
*参考 [#sa74f43c]
**[[OpenShiftファースト・ステップ]] [#y5fda9ca]
**銀の光と碧い空 [#c6a0a798]
-OpenShift で .NET Core 2.0を使いはじめる~
http://tech.tanaka733.net/entry/2017/09/06/OpenShift_%E3%...
**redhat.com [#ga8c3948]
-Developing .NET Core 2.0 Web Applications on OpenShift -...
https://developers.redhat.com/blog/2017/11/22/developing-...
***Red Hat Customer Portal [#we8ccdea]
-Getting Started Guide~
https://access.redhat.com/documentation/en-us/net_core/2....
--Chapter 1. .NET Core 2.0 on Red Hat Enterprise Linux~
https://access.redhat.com/documentation/en-us/net_core/2....
---1.1. Install and Register Red Hat Enterprise Linux
---1.2. Install .NET Core
---1.3. Create an Application
---1.4. Publish Applications~
1.4.1. Publish .NET Core Applications~
1.4.2. Publish ASP.NET Core Applications
---1.5. Run Applications on Docker
--Chapter 2. .NET Core 2.0 on Red Hat OpenShift Container...
https://access.redhat.com/documentation/en-us/net_core/2....
---2.1. Install Image Streams
---2.2. Deploy Applications
---2.3. Configuration
---2.4. Sample Applications
---2.5. Create a Runtime Image
**openshift.com [#n82796b5]
-Announcing .NET Core 2.0 Support for OpenShift – OpenShi...
https://blog.openshift.com/announcing-net-core-2-0-suppor...
ページ名: