vagrant-docker-compose 1.4.0 → 1.5.0

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
  SHA256:
3
- metadata.gz: f3e5d58d541465149e8fb373443011d2d1463d55fea729cb72a392f5733b59b2
4
- data.tar.gz: dbab6628e49ddcdf9457e44aa410f541a913b77a7b3eb249786b449c8164184c
3
+ metadata.gz: e2094b1904e3f3ffc9fb8082535a07fd879ca225acd2675b10f34f2bd3be01c6
4
+ data.tar.gz: 64fb9993e20906189927735d7d8a27d66d3a98a63910a4e4c2709322f121d155
5
5
  SHA512:
6
- metadata.gz: 8c68389a3fd34d089e3d1d8060c02b33599ccabb5374ba592becb192078260c6bd55140cd496a4f4e12c189ee0d8b028c729e298714a9e75c594c76cd7ed7255
7
- data.tar.gz: 2da064848a49afb2fc599b5ecff62702145c318256bbf923c1afcb009102bf93860fcd1a1bca6609678b88fd6569b007e510c34e730f7d765baca5265750ec7e
6
+ metadata.gz: dbb9e8572f25ebe7688817b34120ad9209ea853a65fa0967ee4f838d2cd3e692bacd952a41bc506dc7cc3d95b0515019793d00444942fb9664663361fd719d23
7
+ data.tar.gz: ed6a09c25f4168c10767bb13904fa32e9e1caeedabf3ad8ed2b75fef5dad9237b9e9735432d2a91c470eb0def94a3511408308f9a8fe5133bb6ffbcd48fc4a59
data/README.md CHANGED
@@ -104,7 +104,7 @@ docker-compose --x-networking -f [yml] up -d --timeout 20
104
104
  ### Other configs
105
105
 
106
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.
107
- * `compose_version` – defaults to `1.8.0`.
107
+ * `compose_version` – defaults to `1.24.1`.
108
108
  * `project_name` – compose will default to naming the project `vagrant`.
109
109
  * `env` – a `Hash` of environment variables to value that are passed to the `docker-compose` commands, defaults to an empty `Hash`.
110
110
  * `executable_symlink_path` – the location the executable will be symlinked to, defaults to `/usr/local/bin/docker-compose`.
data/Vagrantfile ADDED
@@ -0,0 +1,42 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # ==============================================================================
5
+ # This Vagrantfile is for testing the plugin. For an example of how to use the
6
+ # plugin look at the Vagrantfile in the example directory.
7
+ #
8
+ # If you are developing or contributing to this plugin you can use this
9
+ # Vagrantfile. It is designed to be run inside a Docker container that is
10
+ # already on a network called 'devenv'. The Vagrantfile tells Vagrant to start
11
+ # the machine on the 'devenv' network, and to give the container's name
12
+ # 'vagrant'. While portforwarding to the host for SSH still takes place it is
13
+ # ignored and Vagrant connects directly to the SSH port on the 'vagrant'
14
+ # container.
15
+ #
16
+ # Before using this file you'll want to run this command to install vagrant as
17
+ # a gem:
18
+ # bundle install
19
+ #
20
+ # To start vagrant it is important to always use bundle exec:
21
+ # bundle exec vagrant up
22
+ #
23
+ # To SSH into the container:
24
+ # bundle exec vagrant ssh
25
+ #
26
+ # To delete the container when finished:
27
+ # bundle exec vagrant destroy -f
28
+ #
29
+ # ==============================================================================
30
+
31
+ Vagrant.configure("2") do |config|
32
+ config.vm.provider :docker do |d|
33
+ d.image = "vagrant" # https://github.com/leighmcculloch/vagrant-docker-image
34
+ d.has_ssh = true
35
+ d.create_args = ["--name=vagrant", "--network=devenv"]
36
+ end
37
+
38
+ config.ssh.host = "vagrant"
39
+ config.ssh.port = 22
40
+
41
+ config.vm.provision :docker_compose, run: "always"
42
+ end
data/example/Vagrantfile CHANGED
@@ -8,7 +8,7 @@ unless Vagrant.has_plugin?("vagrant-docker-compose")
8
8
  end
9
9
 
10
10
  Vagrant.configure("2") do |config|
11
- config.vm.box = "hashicorp/precise64"
11
+ config.vm.box = "ubuntu/trusty64"
12
12
 
13
13
  port = 9090
14
14
 
@@ -0,0 +1,31 @@
1
+ module VagrantPlugins
2
+ module DockerComposeProvisioner
3
+ module Cap
4
+ module Linux
5
+ module DockerComposeGetInfo
6
+ def self.docker_compose_get_info(machine, config)
7
+ comm = machine.communicate
8
+
9
+ kernel_name = ""
10
+ comm.execute("uname -s") do |type, data|
11
+ if type == :stdout
12
+ kernel_name << data
13
+ end
14
+ end
15
+ kernel_name.strip!
16
+
17
+ machine_hardware_name = ""
18
+ comm.execute("uname -m") do |type, data|
19
+ if type == :stdout
20
+ machine_hardware_name << data
21
+ end
22
+ end
23
+ machine_hardware_name.strip!
24
+
25
+ [machine_hardware_name, kernel_name]
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -3,11 +3,10 @@ module VagrantPlugins
3
3
  module Cap
4
4
  module Linux
5
5
  module DockerComposeInstall
6
- def self.docker_compose_install(machine, config)
7
- machine.communicate.tap do |comm|
8
- comm.sudo("curl -L https://github.com/docker/compose/releases/download/#{config.compose_version}/docker-compose-`uname -s`-`uname -m` > #{config.executable_install_path}")
9
- comm.sudo("chmod +x #{config.executable_install_path}")
10
- end
6
+ def self.docker_compose_install(machine, config, remote_tmp_path)
7
+ comm = machine.communicate
8
+ comm.sudo("mv #{remote_tmp_path} #{config.executable_install_path}")
9
+ comm.sudo("chmod +x #{config.executable_install_path}")
11
10
  end
12
11
  end
13
12
  end
@@ -0,0 +1,25 @@
1
+ module VagrantPlugins
2
+ module DockerComposeProvisioner
3
+ module Cap
4
+ module Linux
5
+ module DockerComposeUpload
6
+ def self.docker_compose_upload(machine, config, local_tmp_path)
7
+ comm = machine.communicate
8
+
9
+ remote_tmp_path = ""
10
+ comm.execute("mktemp") do |type, data|
11
+ if type == :stdout
12
+ remote_tmp_path << data
13
+ end
14
+ end
15
+ remote_tmp_path.strip!
16
+
17
+ comm.upload(local_tmp_path, remote_tmp_path)
18
+
19
+ remote_tmp_path
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -10,8 +10,25 @@ module VagrantPlugins
10
10
  @machine.ui.detail(I18n.t(:checking_installation))
11
11
 
12
12
  if !@machine.guest.capability(:docker_compose_installed, @config)
13
+ @machine.ui.detail(I18n.t(:getting_info))
14
+ machine_hardware_name, kernel_name = @machine.guest.capability(:docker_compose_get_info, @config)
15
+
16
+ @machine.ui.detail(I18n.t(:downloading, version: @config.compose_version, kernel: kernel_name, machine: machine_hardware_name))
17
+ url = "https://github.com/docker/compose/releases/download/#{@config.compose_version}/docker-compose-#{kernel_name}-#{machine_hardware_name}"
18
+ remote_tmp_path = nil
19
+ Dir.mktmpdir do |local_tmp_dir|
20
+ local_tmp_path = File.join(local_tmp_dir, "docker-compose")
21
+ File.open(local_tmp_path, "w") do |f|
22
+ contents = fetch_file(url)
23
+ f.write(contents)
24
+ end
25
+
26
+ @machine.ui.detail(I18n.t(:uploading, version: @config.compose_version))
27
+ remote_tmp_path = @machine.guest.capability(:docker_compose_upload, @config, local_tmp_path)
28
+ end
29
+
13
30
  @machine.ui.detail(I18n.t(:installing, version: @config.compose_version))
14
- @machine.guest.capability(:docker_compose_install, @config)
31
+ @machine.guest.capability(:docker_compose_install, @config, remote_tmp_path)
15
32
 
16
33
  if !@machine.guest.capability(:docker_compose_installed, @config)
17
34
  raise DockerComposeError, :install_failed
@@ -23,6 +40,19 @@ module VagrantPlugins
23
40
 
24
41
  @machine.guest.capability(:docker_compose_set_project_name, @config)
25
42
  end
43
+
44
+ def fetch_file(url)
45
+ response = Net::HTTP.get_response(URI(url))
46
+ case response
47
+ when Net::HTTPSuccess then
48
+ return response.body
49
+ when Net::HTTPRedirection then
50
+ new_url = response['location']
51
+ return fetch_file(new_url)
52
+ else
53
+ raise "Error: unable to download docker-compose: #{url}"
54
+ end
55
+ end
26
56
  end
27
57
  end
28
58
  end
@@ -4,8 +4,11 @@ en:
4
4
  install_failed: Docker Compose installation failed
5
5
  not_supported_on_guest: Not supported on the guest operating system
6
6
  checking_installation: Checking for Docker Compose installation...
7
- installing: Installing Docker Compose %{version}
8
- symlinking: Symlinking Docker Compose %{version}
7
+ getting_info: Getting machine and kernel name from guest machine...
8
+ downloading: Downloading Docker Compose %{version} for %{kernel} %{machine}
9
+ uploading: Uploading Docker Compose %{version} to guest machine...
10
+ installing: Installing Docker Compose %{version} in guest machine...
11
+ symlinking: Symlinking Docker Compose %{version} in guest machine...
9
12
  docker_compose_up: Running docker-compose up...
10
13
  docker_compose_rm: Running docker-compose rm...
11
14
  docker_compose_build: Running docker-compose build...
@@ -19,6 +19,16 @@ module VagrantPlugins
19
19
  Cap::Linux::DockerComposeInstalled
20
20
  end
21
21
 
22
+ guest_capability("linux", "docker_compose_get_info") do
23
+ require_relative "cap/linux/docker_compose_get_info"
24
+ Cap::Linux::DockerComposeGetInfo
25
+ end
26
+
27
+ guest_capability("linux", "docker_compose_upload") do
28
+ require_relative "cap/linux/docker_compose_upload"
29
+ Cap::Linux::DockerComposeUpload
30
+ end
31
+
22
32
  guest_capability("linux", "docker_compose_install") do
23
33
  require_relative "cap/linux/docker_compose_install"
24
34
  Cap::Linux::DockerComposeInstall
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module DockerComposeProvisioner
3
- VERSION = "1.4.0"
3
+ VERSION = "1.5.0"
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: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leigh McCulloch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2019-09-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Vagrant provisioner for docker compose.
14
14
  email:
@@ -21,6 +21,7 @@ files:
21
21
  - LICENSE.md
22
22
  - README.md
23
23
  - Rakefile
24
+ - Vagrantfile
24
25
  - example/Vagrantfile
25
26
  - example/app/Dockerfile
26
27
  - example/app/index.html
@@ -28,10 +29,12 @@ files:
28
29
  - example/docker-compose-base.yml
29
30
  - example/docker-compose.yml
30
31
  - lib/vagrant-docker-compose.rb
32
+ - lib/vagrant-docker-compose/cap/linux/docker_compose_get_info.rb
31
33
  - lib/vagrant-docker-compose/cap/linux/docker_compose_install.rb
32
34
  - lib/vagrant-docker-compose/cap/linux/docker_compose_installed.rb
33
35
  - lib/vagrant-docker-compose/cap/linux/docker_compose_set_project_name.rb
34
36
  - lib/vagrant-docker-compose/cap/linux/docker_compose_symlink.rb
37
+ - lib/vagrant-docker-compose/cap/linux/docker_compose_upload.rb
35
38
  - lib/vagrant-docker-compose/config.rb
36
39
  - lib/vagrant-docker-compose/docker_compose.rb
37
40
  - lib/vagrant-docker-compose/errors/docker_compose_error.rb