自訂 JBoss 伺服器的遷移計畫
您應查看建立遷移作業後產生的遷移計畫檔案。請先自訂檔案再執行遷移作業。遷移計畫的詳細資料會用來從來源中擷取工作負載容器構件。
本節將說明遷移作業的內容,以及執行遷移作業並產生部署構件前,您可能會考慮的客製化類型。
事前準備
本文假設您已建立遷移作業,並擁有遷移計畫檔案。
編輯遷移計畫
複製及分析檔案系統後,您可以在指定輸出路徑 ANALYSIS_OUTPUT_PATH/config.yaml
中建立的新目錄中找到遷移計畫。
視需要編輯遷移計畫並儲存變更。
遷移計畫結構
JBoss 工作負載的遷移計畫具有下列結構,您可以按照下列各節的說明自訂。
# Server name. Edit this to change the artifacts naming.
serverName: jboss-server
# JBoss home directory.
home: /opt/jboss/wildfly
# Parent Wildfly image for the generated container image.
fromImage: docker.io/jboss/wildfly:10.1.0.Final
# JBoss home directory in the target image.
targetImageHome: /opt/wildfly
# Configuration file path from source VM.
configurationFile: /opt/jboss/wildfly/standalone/configuration/standalone.xml
# Ports list to expose on the generated container image.
ports:
- name: management-http
port: 9990
- name: management-https
port: 9993
- name: ajp
port: 8009
- name: http
port: 8080
- name: https
port: 8433
- name: txn-recovery-environment
port: 4712
- name: txn-status-manager
port: 4713
# List of deployments files to copy.
deployments:
directory: /opt/jboss/wildfly/standalone/deployments
applications:
- test.war
# List of modules to copy in rsync filter format.
# Note: files under '/system/layers/base/' are JBoss/Wildfly binaries and should be copied only if they have been modified.
modules:
- '- system/layers/base'
# External paths required for running the JBoss server or apps.
additionalFiles: []
# Sensitive data which is filtered out of the container image.
# If includeSensitiveData is set to true the sensitive data is mounted on the container.
sensitiveData:
includeSensitiveData: false
sensitiveDataPaths:
- /opt/jboss/wildfly/standalone/configuration/application-roles.properties
- /opt/jboss/wildfly/standalone/configuration/application-users.properties
- /opt/jboss/wildfly/standalone/configuration/application.keystore
- /opt/jboss/wildfly/standalone/configuration/mgmt-groups.properties
- /opt/jboss/wildfly/standalone/configuration/mgmt-users.properties
如需視需要新增資訊,請查看遷移計畫詳細資料和指引性註解。
具體來說,請考慮針對下列部分進行編輯:
指定 Docker 映像檔
在遷移計畫中,我們會根據 JBoss 版本產生 Docker 社群映像檔標記。系統會偵測 JBoss 版本並轉換為主要版本 (不支援次要版本)。如果我們無法偵測 JBoss 版本,fromImage
就會包含空字串。
在遷移計畫中,fromImage
欄位代表用於容器映像檔基礎的 Docker 映像檔標記。
來源 VM 中偵測到的原始 JBoss 版本,包含在初始探索作業產生的 discovery-report.yaml
中。
如果您想變更 Docker 社群映像檔,或提供自己的 Docker 映像檔,可以使用下列格式修改遷移計畫中的 fromImage
標記:
# Parent Wildfly image for the generated container image. fromImage: docker.io/jboss/wildfly:10.1.0.Final
targetImageHome
欄位會指定目標映像檔中 JBoss 主目錄的路徑,並衍生自 fromImage
欄位。除非您使用 JBoss 映像檔,且 JBoss 主頁面值不同,否則不需要變更這個欄位的值。
指定應用程式
如要從容器映像檔中排除應用程式,請從應用程式清單中移除這些應用程式。
指定模組
module
清單包含現有 JBoss 模組的清單,這些模組標示為加號或減號。只有標有加號的模組會新增至產生的容器映像檔。標有減號的模組 (例如 (/system/layers/base)
) 已出現在社群圖片中,除非您重新標示為加號,否則不會遭到覆寫。
設定機密資料遷移
如要將敏感資料上傳至存放區,您必須將遷移計畫中的 includeSensitiveData
欄位設為 true
。密鑰會上傳至 secrets.yaml
。
sensitiveDataPaths
欄位會指定要從遷移計畫中篩除的檔案清單。這些檔案可能包含機密資訊,例如 JBoss 使用的憑證、密鑰儲存庫、使用者和密碼。如果您從 sensitiveDataPaths
欄位移除檔案路徑,檔案就會上傳至圖片。
後續步驟
- 瞭解如何執行遷移作業。