blob: 83ab58887da7d3b83ff901f0ba69fda5b295d1f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# frozen_string_literal: true
module QA
module Service
module DockerRun
class Smocker < Base
def initialize
@image = 'thiht/smocker:0.17.1'
@name = 'smocker-server'
@public_port = '8080'
@admin_port = '8081'
super
@network_cache = network
end
def host_name
return '127.0.0.1' unless QA::Runtime::Env.running_in_ci? || QA::Runtime::Env.qa_hostname
"#{@name}.#{@network_cache}"
end
def base_url
"http://#{host_name}:#{@public_port}"
end
def admin_url
"http://#{host_name}:#{@admin_port}"
end
def wait_for_running
Support::Waiter.wait_until(raise_on_failure: false, reload_page: false) do
running?
end
end
def register!
command = <<~CMD.tr("\n", ' ')
docker run -d --rm
--network #{@network_cache}
--hostname #{host_name}
--name #{@name}
--publish #{@public_port}:8080
--publish #{@admin_port}:8081
#{@image}
CMD
unless QA::Runtime::Env.running_in_ci? || QA::Runtime::Env.qa_hostname
command.gsub!("--network #{@network_cache} ", '')
end
shell command
end
end
end
end
end
|