Class: Orchestration::DockerCompose::MongoService

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestration/docker_compose/mongo_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ MongoService

Returns a new instance of MongoService.



6
7
8
# File 'lib/orchestration/docker_compose/mongo_service.rb', line 6

def initialize(config)
  @config = config
end

Instance Method Details

#definitionObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/orchestration/docker_compose/mongo_service.rb', line 10

def definition
  return nil if @config.settings.nil?

  # REVIEW: If the host application defines multiple mongo hosts then we
  # create one service instance and point them all at the same service.
  # Instead we should probably create a separate service for each.
  ports = @config.ports.map do |port|
    "#{port}:#{Orchestration::Services::Mongo::PORT}"
  end

  {
    'image' => 'library/mongo',
    'ports' => ports
  }
end