Class: Bosh::Gen::Generators::PackageDockerImageGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/bosh/gen/generators/package_docker_image_generator.rb

Defined Under Namespace

Classes: RakeHelper

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



19
20
21
# File 'lib/bosh/gen/generators/package_docker_image_generator.rb', line 19

def self.source_root
  File.join(File.dirname(__FILE__), "package_docker_image_generator", "templates")
end

Instance Method Details

#check_nameObject

Raises:

  • (Thor::Error)


29
30
31
# File 'lib/bosh/gen/generators/package_docker_image_generator.rb', line 29

def check_name
  raise Thor::Error.new("'#{name}' is not a valid BOSH id") unless name.bosh_valid_id?
end

#check_root_is_releaseObject



23
24
25
26
27
# File 'lib/bosh/gen/generators/package_docker_image_generator.rb', line 23

def check_root_is_release
  unless File.exist?("jobs") && File.exist?("packages")
    raise Thor::Error.new("run inside a BOSH release project")
  end
end

#docker_saveObject



33
34
35
36
37
# File 'lib/bosh/gen/generators/package_docker_image_generator.rb', line 33

def docker_save
  FileUtils.mkdir_p("blobs/docker-images")
  RakeHelper.sh "docker pull #{docker_image}"
  RakeHelper.sh "docker save #{docker_image} > blobs/docker-images/#{image_filename}"
end

#jobsObject



39
40
41
# File 'lib/bosh/gen/generators/package_docker_image_generator.rb', line 39

def jobs
  directory "jobs"
end

#packagesObject



43
44
45
# File 'lib/bosh/gen/generators/package_docker_image_generator.rb', line 43

def packages
  directory "packages"
end

#readmeObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/bosh/gen/generators/package_docker_image_generator.rb', line 47

def readme
  say "Next steps:", :green
  say <<-README.gsub(/^        /, '')
    1. To use this BOSH release, first upload it and the docker release to your BOSH:
      bosh upload release https://bosh.io/releases/cloudfoundry-community/consul-docker
      bosh upload release https://bosh.io/d/github.com/cf-platform-eng/docker-boshrelease

    2. To use the docker image, your deployment job needs to start with the following:

      jobs:
      - name: some_job
      templates:
        # run docker daemon
        - {name: docker, release: docker}
        # warm docker image cache from bosh package
        - {name: #{job_name}, release: #{project_name_hyphenated}}

    3. To simply run a single container, try the 'containers' job from 'docker' release

      https://github.com/cloudfoundry-community/consul-docker-boshrelease/blob/master/templates/jobs.yml#L18-L40


  README
end