すべてのタイプのコンポーネントは、Docker イメージが公開するエンドポイントを指定できます。CodeReady Workspaces クラスターが OpenShift Ingress または OpenShift ルートを使用し、ワークスペース内の他のコンポーネントを使用して実行している場合は、これらのエンドポイントにアクセスできます。アプリケーションまたはデータベースサーバーがポートをリッスンし、直接対話できるようにする場合や、他のコンポーネントで対話できるようにする場合は、アプリケーションまたはデータベースのエンドポイントを作成できます。
apiVersion: 1.0.0
metadata:
name: MyDevfile
projects:
- name: my-go-project
clonePath: go/src/github.com/acme/my-go-project
source:
type: git
location: https://github.com/acme/my-go-project.git
components:
- type: dockerimage
image: golang
memoryLimit: 512Mi
mountSources: true
command: ['sleep', 'infinity']
env:
- name: GOPATH
value: $(CHE_PROJECTS_ROOT)/go
- name: GOCACHE
value: /tmp/go-cache
endpoints:
- name: web
port: 8080
attributes:
discoverable: false
public: true
protocol: http
- type: dockerimage
image: postgres
memoryLimit: 512Mi
env:
- name: POSTGRES_USER
value: user
- name: POSTGRES_PASSWORD
value: password
- name: POSTGRES_DB
value: database
endpoints:
- name: postgres
port: 5432
attributes:
discoverable: true
public: false
apiVersion: 1.0.0
metadata:
name: MyDevfile
projects:
- name: my-go-project
clonePath: go/src/github.com/acme/my-go-project
source:
type: git
location: https://github.com/acme/my-go-project.git
components:
- type: dockerimage
image: golang
memoryLimit: 512Mi
mountSources: true
command: ['sleep', 'infinity']
env:
- name: GOPATH
value: $(CHE_PROJECTS_ROOT)/go
- name: GOCACHE
value: /tmp/go-cache
endpoints:
- name: web
port: 8080
attributes:
discoverable: false
public: true
protocol: http
- type: dockerimage
image: postgres
memoryLimit: 512Mi
env:
- name: POSTGRES_USER
value: user
- name: POSTGRES_PASSWORD
value: password
- name: POSTGRES_DB
value: database
endpoints:
- name: postgres
port: 5432
attributes:
discoverable: true
public: false
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
ここでは、2 つの Docker イメージがあり、1 つのエンドポイントを定義します。エンドポイントは、ワークスペース内や、一般に UI からアクセス可能なアクセス可能なポートです。各エンドポイントには名前とポートがあります。これは、コンテナー内で実行中の特定のサーバーがリッスンするポートです。エンドポイントに設定できる属性を以下に示します。
apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
- type: cheEditor
alias: theia-editor
id: eclipse/che-theia/next
endpoints:
- name: 'theia-extra-endpoint'
port: 8880
attributes:
discoverable: true
public: true
- type: chePlugin
id: redhat/php/latest
memoryLimit: 1Gi
endpoints:
- name: 'php-endpoint'
port: 7777
- type: chePlugin
alias: theia-editor
id: eclipse/che-theia/next
endpoints:
- name: 'theia-extra-endpoint'
port: 8880
attributes:
discoverable: true
public: true
- type: openshift
alias: webapp
reference: webapp.yaml
endpoints:
- name: 'web'
port: 8080
attributes:
discoverable: false
public: true
protocol: http
- type: openshift
alias: mongo
reference: mongo-db.yaml
endpoints:
- name: 'mongo-db'
port: 27017
attributes:
discoverable: true
public: false
apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
- type: cheEditor
alias: theia-editor
id: eclipse/che-theia/next
endpoints:
- name: 'theia-extra-endpoint'
port: 8880
attributes:
discoverable: true
public: true
- type: chePlugin
id: redhat/php/latest
memoryLimit: 1Gi
endpoints:
- name: 'php-endpoint'
port: 7777
- type: chePlugin
alias: theia-editor
id: eclipse/che-theia/next
endpoints:
- name: 'theia-extra-endpoint'
port: 8880
attributes:
discoverable: true
public: true
- type: openshift
alias: webapp
reference: webapp.yaml
endpoints:
- name: 'web'
port: 8080
attributes:
discoverable: false
public: true
protocol: http
- type: openshift
alias: mongo
reference: mongo-db.yaml
endpoints:
- name: 'mongo-db'
port: 27017
attributes:
discoverable: true
public: false
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow