Sha256: 42aa3c17b7cbb07bf14675f7843c7d672204315b4a150cfafd4afa6fb22f6bc2

Contents?: true

Size: 760 Bytes

Versions: 6

Compression:

Stored size: 760 Bytes

Contents

module VagrantPlugins
  module Ventriloquist
    class Service
      CONTAINER_IDS_PATH = '/var/lib/ventriloquist/cids'

      attr_reader :name, :config, :docker_client

      def initialize(name, config, docker_client)
        @name, @config, @docker_client = name, config, docker_client
      end

      def provision(machine)
        machine.env.ui.info("Starting #{@name} service")
        machine.communicate.sudo("mkdir -p #{CONTAINER_IDS_PATH}")
        # Reduce network latency, see https://groups.google.com/d/msg/docker-user/Z3zQuRawIsE/2AEkl30WpTQJ
        # for more info
        @config[:dns]     = '127.0.0.1'
        @config[:cidfile] = "#{CONTAINER_IDS_PATH}/#{@name}"
        @docker_client.run_container(@config)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ventriloquist-0.3.2 lib/ventriloquist/service.rb
ventriloquist-0.3.1 lib/ventriloquist/service.rb
ventriloquist-0.3.0 lib/ventriloquist/service.rb
ventriloquist-0.2.1 lib/ventriloquist/service.rb
ventriloquist-0.2.0 lib/ventriloquist/service.rb
ventriloquist-0.1.0 lib/ventriloquist/service.rb