On Mon, Mar 01, 2021 at 08:02:33PM +0800, Wu Fengguang wrote:
只是加端口还不够。还需要加 *_HOST 变量. 因为解耦的最终目的,是希望不同的存储能自由分配到不同机器(HOST)上去。
got it
Thanks, Weitao
Thanks, Fengguang
On Mon, Mar 01, 2021 at 05:46:10PM +0800, Lu Weitao wrote:
[Why] split compass-ci/container/srv-http to 6 service pre dir pre service with a port
[How] SRV_HTTP_PORT => SRV_HTTP_RESULT_PORT, user: compass-ci/lib/mail_job_result.rb compass-ci/container/extract-stats SRV_HTTP_OS_PORT, user: compass-ci/sbin/download-rootfs SRV_HTTP_GIT_PORT, user: compass-ci/lib/mail_bisect_result.rb SRV_HTTP_CCI_PORT, user: compass-ci/lib/compass-ci/src/scheduler/find_job_boot.cr compass-ci/providers/lib/domain.rb add them(PORT) to: compass-ci/lib/constants.rb compass-ci/sparrow/3-code/dev-env
Signed-off-by: Lu Weitao luweitaobe@163.com
container/extract-stats/start | 6 +++--- container/scheduler/start | 4 ++-- lib/constants.rb | 4 +++- lib/mail_job_result.rb | 2 +- providers/lib/domain.rb | 2 +- sbin/download-rootfs | 2 +- sparrow/3-code/dev-env | 12 +++++++++--- src/scheduler/constants.cr | 2 +- src/scheduler/find_job_boot.cr | 2 +- 9 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/container/extract-stats/start b/container/extract-stats/start index c158977..ba259af 100755 --- a/container/extract-stats/start +++ b/container/extract-stats/start @@ -15,7 +15,7 @@ names = Set.new %w[ SEND_MAIL_HOST SEND_MAIL_PORT SRV_HTTP_HOST
- SRV_HTTP_PORT
- SRV_HTTP_RESULT_PORT lab
]
@@ -25,7 +25,7 @@ env = docker_env(defaults) DEFAULT_LKP = '/c/lkp-tests' DEFAULT_CCI = '/c/compass-ci' SRV_HTTP_HOST = defaults['SRV_HTTP_HOST'] || Open3.capture3('curl ip.sb')[0].chomp -SRV_HTTP_PORT = defaults['SRV_HTTP_PORT'] || '11300' +SRV_HTTP_RESULT_PORT = defaults['SRV_HTTP_RESULT_PORT'] || '11300' docker_rm "extract-stats"
cmd = %w[ @@ -37,7 +37,7 @@ cmd = %w[ -e LKP_SRC=#{DEFAULT_LKP} -e CCI_SRC=#{DEFAULT_CCI} -e SRV_HTTP_HOST=#{SRV_HTTP_HOST}
- -e SRV_HTTP_PORT=#{SRV_HTTP_PORT}
- -e SRV_HTTP_RESULT_PORT=#{SRV_HTTP_RESULT_PORT} -v #{ENV['LKP_SRC']}:#{DEFAULT_LKP} -v /etc/localtime:/etc/localtime:ro -v #{ENV['CCI_SRC']}:#{DEFAULT_CCI}
diff --git a/container/scheduler/start b/container/scheduler/start index 4aaa71d..d218626 100755 --- a/container/scheduler/start +++ b/container/scheduler/start @@ -26,7 +26,7 @@ names = Set.new %w[ SSHR_PORT_BASE SSHR_PORT_LEN SRV_HTTP_HOST
- SRV_HTTP_PORT
- SRV_HTTP_CCI_PORT lab
]
@@ -37,7 +37,7 @@ defaults['SSHR_PORT_LEN'] ||= 2000 defaults['SCHED_PORT'] ||= '3000' defaults['SCHED_HOST'] ||= '172.17.0.1' defaults['MASTER_FLUENTD_PORT'] ||= '24224' -defaults['SRV_HTTP_PORT'] ||= '11300' +defaults['SRV_HTTP_CCI_PORT'] ||= '11306' env = docker_env(defaults)
CCI_REPOS = ENV['CCI_REPOS'] || '/c' diff --git a/lib/constants.rb b/lib/constants.rb index 5ed4d57..431c8d6 100644 --- a/lib/constants.rb +++ b/lib/constants.rb @@ -12,7 +12,9 @@ SEND_MAIL_HOST ||= config['SEND_MAIL_HOST'] || '172.17.0.1' SEND_MAIL_PORT ||= config['SEND_MAIL_PORT'] || 49000
SRV_HTTP_HOST ||= config['SRV_HTTP_HOST'] || ENV['SRV_HTTP_HOST'] || '172.17.0.1' -SRV_HTTP_PORT ||= config['SRV_HTTP_PORT'] || ENV['SRV_HTTP_PORT'] || 11300 +SRV_HTTP_RESULT_PORT ||= config['SRV_HTTP_RESULT_PORT'] || ENV['SRV_HTTP_RESULT_PORT'] || 11300 +SRV_HTTP_OS_PORT ||= config['SRV_HTTP_OS_PORT'] || ENV['SRV_HTTP_OS_PORT'] || 11304 +SRV_HTTP_GIT_PORT ||= config['SRV_HTTP_GIT_PORT'] || ENV['SRV_HTTP_GIT_PORT'] || 11305
SRV_HTTP_DOMAIN ||= config['SRV_HTTP_DOMAIN'] || ENV['SRV_HTTP_DOMAIN'] || 'api.compass-ci.openeuler.org'
diff --git a/lib/mail_job_result.rb b/lib/mail_job_result.rb index 796a4f3..e93c6de 100644 --- a/lib/mail_job_result.rb +++ b/lib/mail_job_result.rb @@ -9,7 +9,7 @@ require 'json'
# compose and send email for job result class MailJobResult
- def initialize(job_id, result_host = SRV_HTTP_HOST, result_port = SRV_HTTP_PORT)
- def initialize(job_id, result_host = SRV_HTTP_HOST, result_port = SRV_HTTP_RESULT_PORT) @job_id = job_id @result_host = result_host @result_port = result_port
diff --git a/providers/lib/domain.rb b/providers/lib/domain.rb index 8df9c06..b3de90a 100644 --- a/providers/lib/domain.rb +++ b/providers/lib/domain.rb @@ -47,7 +47,7 @@ class Domain
def load_xml_file(filepath) host = @context.info['SRV_HTTP_HOST']
- port = @context.info['SRV_HTTP_PORT']
- port = @context.info['SRV_HTTP_CCI_PORT'] system "wget --timestamping --progress=bar:force http://#%7Bhost%7D:#%7Bport%7D/cci/libvirt-xml/#%7Bfilepath%7D" %x(basename #{filepath}).chomp end
diff --git a/sbin/download-rootfs b/sbin/download-rootfs index e1d4091..74afbf6 100755 --- a/sbin/download-rootfs +++ b/sbin/download-rootfs @@ -25,7 +25,7 @@ download_os_rootfs() mkdir -p $rootfs_dir cd $rootfs_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_PORT}/os/${os}/${os_arch}/${os_version}.cgz"
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_OS_PORT}/os/${os}/${os_arch}/${os_version}.cgz" wget $download_url [ "$?" -ne 0 ] && {
diff --git a/sparrow/3-code/dev-env b/sparrow/3-code/dev-env index cc94e01..4e6a4cd 100755 --- a/sparrow/3-code/dev-env +++ b/sparrow/3-code/dev-env @@ -17,7 +17,10 @@ server_name=$(hostname | cut -f1 -d.) : ${SEND_MAIL_HOST:=$server_ip} : ${SEND_MAIL_PORT:=49000} : ${SRV_HTTP_HOST:=$server_ip} -: ${SRV_HTTP_PORT:=11300} +: ${SRV_HTTP_RESULT_PORT:=11300} +: ${SRV_HTTP_OS_PORT:=11304} +: ${SRV_HTTP_GIT_PORT:=11305} +: ${SRV_HTTP_CCI_PORT:=11306} : ${LOGGING_ES_HOST:=$server_ip} : ${LOGGING_ES_PORT:=9202} : ${INITRD_HTTP_HOST:=$server_ip} @@ -50,7 +53,10 @@ OS_HTTP_HOST: $OS_HTTP_HOST GITCACHE_HOST: $gitcache_host GITCACHE_PORT: $gitcache_port SRV_HTTP_HOST: $SRV_HTTP_HOST -SRV_HTTP_PORT: $SRV_HTTP_PORT +SRV_HTTP_RESULT_PORT: $SRV_HTTP_RESULT_PORT +SRV_HTTP_OS_PORT: $SRV_HTTP_OS_PORT +SRV_HTTP_GIT_PORT: $SRV_HTTP_GIT_PORT +SRV_HTTP_CCI_PORT: $SRV_HTTP_CCI_PORT TASKQUEUE_HOST: $sched_host SEND_MAIL_HOST: $SEND_MAIL_HOST SEND_MAIL_PORT: $SEND_MAIL_PORT @@ -78,7 +84,7 @@ GIT_SERVER: GITCACHE_HOST: GITCACHE_PORT: SRV_HTTP_HOST: -SRV_HTTP_PORT: +SRV_HTTP_CCI_PORT: SEND_MAIL_HOST: SEND_MAIL_PORT: INITRD_HTTP_HOST: diff --git a/src/scheduler/constants.cr b/src/scheduler/constants.cr index 668da6d..2cb4588 100644 --- a/src/scheduler/constants.cr +++ b/src/scheduler/constants.cr @@ -24,7 +24,7 @@ OS_HTTP_HOST = (ENV.has_key?("OS_HTTP_HOST") ? ENV["OS_HTTP_HOST"] : "172.17.0.1 OS_HTTP_PORT = (ENV.has_key?("OS_HTTP_PORT") ? ENV["OS_HTTP_PORT"] : 8000).to_i32
SRV_HTTP_HOST = (ENV.has_key?("SRV_HTTP_HOST") ? ENV["SRV_HTTP_HOST"] : "172.17.0.1") -SRV_HTTP_PORT = (ENV.has_key?("SRV_HTTP_PORT") ? ENV["SRV_HTTP_PORT"] : "11300") +SRV_HTTP_CCI_PORT = (ENV.has_key?("SRV_HTTP_CCI_PORT") ? ENV["SRV_HTTP_CCI_PORT"] : "11306")
CCI_REPOS = (ENV.has_key?("CCI_REPOS") ? ENV["CCI_REPOS"] : "/c") LAB_REPO = "lab-z9" diff --git a/src/scheduler/find_job_boot.cr b/src/scheduler/find_job_boot.cr index 8dd22a8..9d46d72 100644 --- a/src/scheduler/find_job_boot.cr +++ b/src/scheduler/find_job_boot.cr @@ -192,7 +192,7 @@ class Sched "vt" => _vt, "RESULT_WEBDAV_PORT" => job["RESULT_WEBDAV_PORT"]? || "3080", "SRV_HTTP_HOST" => SRV_HTTP_HOST,
"SRV_HTTP_PORT" => SRV_HTTP_PORT,
}.to_json end"SRV_HTTP_CCI_PORT" => SRV_HTTP_CCI_PORT,
-- 2.23.0