Sha256: 489632fc66ad8bd58acb860fd2ef827574a34c389aef4fde2c7b0c209e56e5ea
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
command :'ship host' do |c| c.summary = 'Create Docker containers defined in ops/containers/[host_name].yml' c.syntax = 'ops ship host [host_name]' c.description = "Create all docker containers described in #{Ops::CONTAINERS_DIR}/[host_name].yml" c.example "Create a container called 'www' in the host example.com. This is described in '#{Ops::CONTAINERS_DIR}/example.com.yml' like:\n # www:\n # detach: true\n # image: jlebrijo/prun\n # ports:\n # - '2222:22'\n # - '80:80'", 'ops ship example.com' c.action do |args, options| host = args[0] user = Ops::get_user_for(host) Docker::containers_for(host).each do |container_name, config| ports = config["ports"].map{|port| "-p #{port}"}.join(" ") options = [] config.reject{|k| Docker::SPECIAL_OPTS.include? k}.each do |option, value| options << "--#{option}=#{value}" end say "Container '#{container_name}' loading on #{host}, please wait ....\n" Net::SSH.start(host, user) do |ssh| command = "docker run #{options.join(" ")} --name #{container_name} #{ports} #{config["image"]} #{config["command"]}" say "Docker CMD: #{command}\n" ssh.exec command end sleep 5 config["post-conditions"].each { |c| system c } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
open-dock-0.0.11 | lib/open-dock/commands/ship_host.rb |