vagrant-docker-compose 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3930486d1aca6411df319ba44bf95db974ee92a0
4
- data.tar.gz: 5fc231c462804a9c894eac310df38a58efccbfe6
3
+ metadata.gz: cc49169ca96df9dafab14dc0bfebccee5a6f8d5e
4
+ data.tar.gz: 403a29721cdc20c3e3a317a1f37e222af87e102b
5
5
  SHA512:
6
- metadata.gz: faa873b961027a58f5eefa22064d4ea4c35145b0be46a4dcd3f3dd12ee75606dc2dea6b13efd16aeb2d29f1e1fe8a1f69ef9ac02eadb7fdd4c99fdf2a32932ae
7
- data.tar.gz: f20c1bbef3c16f41aebe8417ce72774cc3b75b354731b18a175662b1a6aa6827887a57655ee4f16c01567d2c301e2a8a9713efe2b44cbf98cfc9fd27087f21e9
6
+ metadata.gz: 741a3bdf7937076377412532d06137d88fcd17e7f8210984212d38de2549c07c3233e9a82e25f1261b58040ba7720d6e46f915f460ea37880e4ed390d9b63521
7
+ data.tar.gz: c7b17dcb7dc4f8077011c3f65ec71c77acdbb581b991d359da11f52bcd30334c6c0e04404e2337f042985e25a1eee97baf2a93d7c0f861c1f7b0893d25e2d415
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ gemspec
3
3
 
4
4
  group :development do
5
5
  gem "vagrant", git: "https://github.com/mitchellh/vagrant.git", tag: "v1.7.4"
6
+ gem "rake"
6
7
  end
7
8
 
8
9
  group :plugins do
data/README.md CHANGED
@@ -38,6 +38,29 @@ Equivalent to running:
38
38
  docker-compose -f [yml] up -d
39
39
  ```
40
40
 
41
+ ### To install and run docker-compose, with multiple files, on `vagrant up`
42
+
43
+ ```ruby
44
+ Vagrant.configure("2") do |config|
45
+ config.vm.box = "ubuntu/trusty64"
46
+
47
+ config.vm.provision :docker
48
+ config.vm.provision :docker_compose,
49
+ yml: [
50
+ "/vagrant/docker-compose-base.yml",
51
+ "/vagrant/docker-compose.yml",
52
+ ...
53
+ ],
54
+ run: "always"
55
+ end
56
+ ```
57
+
58
+ Equivalent to running:
59
+
60
+ ```bash
61
+ docker-compose -f [yml-0] -f [yml-1] ... up -d
62
+ ```
63
+
41
64
  ### To install, rebuild and run docker-compose on `vagrant up`
42
65
 
43
66
  ```ruby
@@ -80,6 +103,7 @@ docker-compose --x-networking -f [yml] up -d --timeout 20
80
103
 
81
104
  ### Other configs
82
105
 
106
+ * `yml` – one or more [Compose files](https://docs.docker.com/compose/compose-file/) (YAML), may be a `String` for a single file, or `Array` for multiple.
83
107
  * `compose_version` – defaults to `1.5.0`.
84
108
  * `project_name` – compose will default to naming the project `vagrant`.
85
109
  * `executable` – the location the executable will be stored, defaults to `/usr/local/bin/docker-compose`.
data/example/Vagrantfile CHANGED
@@ -11,8 +11,9 @@ Vagrant.configure("2") do |config|
11
11
  config.vm.box = "hashicorp/precise64"
12
12
 
13
13
  config.vm.network(:forwarded_port, guest: 8080, host: 8080)
14
+ config.vm.network(:forwarded_port, guest: 3333, host: 3333)
14
15
 
15
16
  config.vm.provision :shell, inline: "apt-get update"
16
17
  config.vm.provision :docker
17
- config.vm.provision :docker_compose, yml: "/vagrant/docker-compose.yml", rebuild: true, project_name: "myproject", run: "always"
18
+ config.vm.provision :docker_compose, yml: ["/vagrant/docker-compose-base.yml","/vagrant/docker-compose.yml"], rebuild: true, project_name: "myproject", run: "always"
18
19
  end
@@ -0,0 +1,10 @@
1
+ app:
2
+ build: ./app
3
+ links:
4
+ - redis
5
+ ports:
6
+ - "8080:8080"
7
+ volumes:
8
+ - ./app/:/app/
9
+ redis:
10
+ image: redis
@@ -1,10 +1,3 @@
1
1
  app:
2
- build: ./app
3
- links:
4
- - redis
5
2
  ports:
6
- - "8080:8080"
7
- volumes:
8
- - ./app/:/app/
9
- redis:
10
- image: redis
3
+ - "3333:8080"
@@ -9,7 +9,10 @@ module VagrantPlugins
9
9
  attr_accessor :yml, :rebuild, :project_name, :executable, :compose_version, :options, :command_options
10
10
 
11
11
  def yml=(yml)
12
- raise DockerComposeError, :yml_must_be_absolute if !Pathname.new(yml).absolute?
12
+ files = yml.is_a?(Array) ? yml : [yml]
13
+ files.each do |file|
14
+ raise DockerComposeError, :yml_must_be_absolute if !Pathname.new(file).absolute?
15
+ end
13
16
  @yml = yml
14
17
  end
15
18
 
@@ -11,7 +11,7 @@ module VagrantPlugins
11
11
  def build
12
12
  @machine.ui.detail(I18n.t(:docker_compose_build))
13
13
  @machine.communicate.tap do |comm|
14
- comm.sudo("#{@config.executable} #{@config.options} -f \"#{@config.yml}\" build #{@config.command_options[:build]}") do |type, data|
14
+ comm.sudo("#{@config.executable} #{@config.options} #{cli_options_for_yml_file} build #{@config.command_options[:build]}") do |type, data|
15
15
  handle_comm(type, data)
16
16
  end
17
17
  end
@@ -20,7 +20,7 @@ module VagrantPlugins
20
20
  def rm
21
21
  @machine.ui.detail(I18n.t(:docker_compose_rm))
22
22
  @machine.communicate.tap do |comm|
23
- comm.sudo("#{@config.executable} #{@config.options} -f \"#{@config.yml}\" rm #{@config.command_options[:rm]}") do |type, data|
23
+ comm.sudo("#{@config.executable} #{@config.options} #{cli_options_for_yml_file} rm #{@config.command_options[:rm]}") do |type, data|
24
24
  handle_comm(type, data)
25
25
  end
26
26
  end
@@ -29,7 +29,7 @@ module VagrantPlugins
29
29
  def up
30
30
  @machine.ui.detail(I18n.t(:docker_compose_up))
31
31
  @machine.communicate.tap do |comm|
32
- comm.sudo("#{@config.executable} #{@config.options} -f \"#{@config.yml}\" up #{@config.command_options[:up]}") do |type, data|
32
+ comm.sudo("#{@config.executable} #{@config.options} #{cli_options_for_yml_file} up #{@config.command_options[:up]}") do |type, data|
33
33
  handle_comm(type, data)
34
34
  end
35
35
  end
@@ -45,6 +45,13 @@ module VagrantPlugins
45
45
  when :stderr; @machine.ui.error(data)
46
46
  end
47
47
  end
48
+
49
+ private
50
+
51
+ def cli_options_for_yml_file
52
+ files = @config.yml.is_a?(Array) ? @config.yml : [@config.yml]
53
+ files.map { |file| "-f \"#{file}\"" }.join(" ")
54
+ end
48
55
  end
49
56
  end
50
57
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module DockerComposeProvisioner
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-docker-compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leigh McCulloch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2016-01-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Vagrant provisioner for docker compose.
14
14
  email:
@@ -25,6 +25,7 @@ files:
25
25
  - example/app/Dockerfile
26
26
  - example/app/index.html
27
27
  - example/app/init.sh
28
+ - example/docker-compose-base.yml
28
29
  - example/docker-compose.yml
29
30
  - lib/vagrant-docker-compose.rb
30
31
  - lib/vagrant-docker-compose/cap/linux/docker_compose_install.rb