blob: 21455f9eae0bc0ac587015e3dc3ee6609d7b8e46 (
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
|
require 'ruby_terraform'
require 'open3'
class GovukGuix::GenerateVmImageAndSystemJob < GovukGuix::Job
@retry_interval = 30
def run(mini_environment_id)
logger.info "#{self.class}: Building mini environment #{mini_environment_id}"
mini_environment = MiniEnvironment.find(mini_environment_id)
slug = mini_environment.name.parameterize
command = [
"#{mini_environment.govuk_guix_revision.store_path}/bin/govuk",
"system",
"build",
"--output=vm-image-and-system",
"--rails-environment=production",
"--app-domain=#{slug}.aws.cbaines.net",
"--web-domain=www.#{slug}.aws.cbaines.net",
"--use-high-ports=false",
"--use-https=certbot",
"--fallback",
"whitehall",
]
run_command(command) do |output|
store_path = output.last.strip
logger.debug "#{self.class}: vm_image_and_system: #{store_path}"
mini_environment.update(
backend_data: {
vm_image_and_system: store_path
}
)
end
end
end
|