dip 6.0.0 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 965a10ab510e886e51a4e307a152358177caceb7c6504ac2c15d222c537ebb12
4
- data.tar.gz: 2d9c98f79718a7774ba7f12f66ecb8495b7f965db3f6aac855586cfe8bb0b7cd
3
+ metadata.gz: 5e42a461aef491ba31638884320252a28f891416510128a0dee140d8c8b3e8a8
4
+ data.tar.gz: 836d775a9c88f2df8bc807207710f84b39502b4e1f7e19747cf4f231fb3e7b06
5
5
  SHA512:
6
- metadata.gz: 3d44176de01f624cff9e98b578c23e525e7c4b6ddc4ad9bdf35cfa54923851f6bea24633c377f20167263deb0b133482f92d3203adffbc6e79b09cdf0c390f71
7
- data.tar.gz: ff3ba16f8461fe8e1eb8a5070e312f88702c06c2f2cdcf4f4e0a61390bee09bdd69ce3510c1bd26100addc1bca163e876aa9a78aa615fb2394b2d2a55fbaea01
6
+ metadata.gz: 88e61d6a5dfe78dd7dba7f1993ea8260f991fabc1921c144157dd4778bf1ccd4839472436327548d12b29222437bcfc08588f25a94e724fc74701b3a81c2d904
7
+ data.tar.gz: 564e4cc1f1fe2aa824b9ca061a0e7a446074faeadb24ee620192cc53bcb3f7fab0cdf3d4849611ee963f7a0d3700089bc1932911096f740212165420b45e452d
data/README.md CHANGED
@@ -16,9 +16,11 @@ A command-line utility that gives the "native" interaction with applications con
16
16
  ## Presentations and examples
17
17
 
18
18
  - [Local development with Docker containers](https://slides.com/bibendi/dip)
19
- - Dockerized Ruby on Rails applications: [one](https://github.com/bibendi/dip-example-rails), [two](https://github.com/evilmartians/evil_chat)
19
+ - Dockerized Ruby on Rails applications: [one](https://github.com/lewagon/rails-k8s-demo), [two](https://github.com/bibendi/dip-example-rails), [three](https://github.com/evilmartians/evil_chat)
20
20
  - Dockerized Node.js application: [one](https://github.com/bibendi/twinkle.js), [two](https://github.com/bibendi/yt-graphql-react-event-booking-api)
21
21
  - [Dockerized Ruby gem](https://github.com/bibendi/schked)
22
+ - [Dockerizing Ruby and Rails development](https://evilmartians.com/chronicles/ruby-on-whales-docker-for-ruby-rails-development)
23
+ - [Reusable development containers with Docker Compose and Dip](https://evilmartians.com/chronicles/reusable-development-containers-with-docker-compose-and-dip)
22
24
 
23
25
  [![asciicast](https://asciinema.org/a/210236.svg)](https://asciinema.org/a/210236)
24
26
 
@@ -36,6 +38,7 @@ After that we can type commands without `dip` prefix. For example:
36
38
  <run-command> *any-args
37
39
  compose *any-compose-arg
38
40
  up <service>
41
+ build
39
42
  down
40
43
  provision
41
44
  ```
@@ -53,41 +56,11 @@ After that, it will be automatically applied when you open your preferred termin
53
56
 
54
57
  ## Installation
55
58
 
56
- You have many ways.
57
-
58
- ### Homebrew
59
-
60
-
61
- You can use [Homebrew](https://brew.sh) on macOS (or [Linux](https://docs.brew.sh/Homebrew-on-Linux)).
62
-
63
- Today Homebrew tap for DIP is located at https://github.com/bibendi/homebrew-dip
64
-
65
- ```sh
66
- brew tap bibendi/dip
67
- brew install dip
68
- ```
69
-
70
- ### Ruby Gem
71
-
72
59
  ```sh
73
60
  gem install dip
74
61
  ```
75
62
 
76
- ### Precompiled binary
77
-
78
- If you don't have installed Ruby, then you could copy a precompiled binary to your system.
79
- It can be found at [releases page](https://github.com/bibendi/dip/releases)
80
- or type bellow into your terminal:
81
-
82
- ```sh
83
- curl -L https://github.com/bibendi/dip/releases/download/v6.0.0/dip-`uname -s`-`uname -m` > /usr/local/bin/dip
84
- chmod +x /usr/local/bin/dip
85
- ```
86
-
87
- ## Docker installation
88
-
89
- - [Ubuntu](docs/docker-ubuntu-install.md)
90
- - [Mac OS](docs/docker-for-mac-install.md)
63
+ The compiled binary is no more provided since version 7, because of new version of [Ruby Packer](https://github.com/pmq20/ruby-packer) not released for a long time with recent Ruby version. Also there was a lot of work to prepare each release of Dip for MacOS version.
91
64
 
92
65
  ## Usage
93
66
 
@@ -108,7 +81,7 @@ Also, you can check out examples at the top.
108
81
 
109
82
  ```yml
110
83
  # Required minimum dip version
111
- version: '4.1'
84
+ version: '7.1'
112
85
 
113
86
  environment:
114
87
  COMPOSE_EXT: development
@@ -121,7 +94,7 @@ compose:
121
94
  project_name: bear
122
95
 
123
96
  interaction:
124
- bash:
97
+ shell:
125
98
  description: Open the Bash shell in app's container
126
99
  service: app
127
100
  command: bash
@@ -169,8 +142,19 @@ interaction:
169
142
  default_args: db_dev
170
143
  command: psql -h pg -U postgres
171
144
 
145
+ setup_key:
146
+ description: Copy key
147
+ service: app
148
+ command: cp `pwd`/config/key.pem /root/keys/
149
+ shell: false # you can disable shell interpolations on the host machine and send the command as is
150
+
151
+ clean_cache:
152
+ description: Delete cache files on the host machine
153
+ command: rm -rf $(pwd)/tmp/cache/*
154
+
172
155
  provision:
173
156
  - dip compose down --volumes
157
+ - dip clean_cache
174
158
  - dip compose up -d pg redis
175
159
  - dip bash -c ./bin/setup
176
160
  ```
@@ -237,7 +221,7 @@ dip VERSION=12352452 rake db:rollback
237
221
  Use options `-p, --publish=[]` if you need to additionally publish a container's port(s) to the host unless this behaviour is not configured at dip.yml:
238
222
 
239
223
  ```sh
240
- dip run -p 3000:3000 bundle exec rackup config.ru
224
+ dip run -p 3000:3000 bundle exec rackup config.ru
241
225
  ```
242
226
 
243
227
  ### dip ls
@@ -292,6 +276,21 @@ volumes:
292
276
  name: ssh_data
293
277
  ```
294
278
 
279
+ if you want to use non-root user you can specify UID like so:
280
+
281
+ ```
282
+ dip ssh up -u 1000
283
+ ```
284
+
285
+ This especially helpful if you have something like this in your docker-compose.yml:
286
+
287
+ ```
288
+ services:
289
+ web:
290
+ user: "1000:1000"
291
+
292
+ ```
293
+
295
294
  ### dip nginx
296
295
 
297
296
  Runs Nginx server container based on [bibendi/nginx-proxy](https://github.com/bibendi/nginx-proxy) image. An application's docker-compose.yml should contain environment variable `VIRTUAL_HOST` and `VIRTUAL_PATH` and connects to external network `frontend`.
data/exe/dip CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- lib_path = File.expand_path('../lib', __dir__)
4
+ lib_path = File.expand_path("../lib", __dir__)
5
5
  $LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
6
6
 
7
7
  begin
8
- require 'pry-byebug' if ENV["DIP_ENV"] == "debug"
8
+ require "pry-byebug" if ENV["DIP_ENV"] == "debug"
9
9
  rescue LoadError
10
10
  # do nothing
11
11
  end
12
12
 
13
- require 'dip'
14
- require 'dip/cli'
15
- require 'dip/run_vars'
13
+ require "dip"
14
+ require "dip/cli"
15
+ require "dip/run_vars"
16
16
 
17
- Signal.trap('INT') do
17
+ Signal.trap("INT") do
18
18
  warn("\n#{caller.join("\n")}: interrupted")
19
19
  exit(1)
20
20
  end
data/lib/dip.rb CHANGED
@@ -18,7 +18,7 @@ module Dip
18
18
  $PROGRAM_NAME.start_with?("./") ? File.expand_path($PROGRAM_NAME) : "dip"
19
19
  end
20
20
 
21
- %w(test debug).each do |key|
21
+ %w[test debug].each do |key|
22
22
  define_method("#{key}?") do
23
23
  ENV["DIP_ENV"] == key
24
24
  end
data/lib/dip/cli.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thor'
4
- require 'dip/run_vars'
3
+ require "thor"
4
+ require "dip/run_vars"
5
5
 
6
6
  module Dip
7
7
  class CLI < Thor
@@ -34,25 +34,30 @@ module Dip
34
34
 
35
35
  stop_on_unknown_option! :run
36
36
 
37
- desc 'version', 'dip version'
37
+ desc "version", "dip version"
38
38
  def version
39
- require_relative 'version'
39
+ require_relative "version"
40
40
  puts Dip::VERSION
41
41
  end
42
- map %w(--version -v) => :version
42
+ map %w[--version -v] => :version
43
43
 
44
- desc 'ls', 'List available run commands'
44
+ desc "ls", "List available run commands"
45
45
  def ls
46
- require_relative 'commands/list'
46
+ require_relative "commands/list"
47
47
  Dip::Commands::List.new.execute
48
48
  end
49
49
 
50
- desc 'compose CMD [OPTIONS]', 'Run docker-compose commands'
50
+ desc "compose CMD [OPTIONS]", "Run docker-compose commands"
51
51
  def compose(*argv)
52
- require_relative 'commands/compose'
52
+ require_relative "commands/compose"
53
53
  Dip::Commands::Compose.new(*argv).execute
54
54
  end
55
55
 
56
+ desc "build [OPTIONS] SERVICE", "Run `docker-compose build` command"
57
+ def build(*argv)
58
+ compose("build", *argv)
59
+ end
60
+
56
61
  desc "up [OPTIONS] SERVICE", "Run `docker-compose up` command"
57
62
  def up(*argv)
58
63
  compose("up", *argv)
@@ -63,50 +68,50 @@ module Dip
63
68
  compose("stop", *argv)
64
69
  end
65
70
 
66
- desc "down all services [OPTIONS]", "Run `docker-compose down` command"
71
+ desc "down [OPTIONS]", "Run `docker-compose down` command"
67
72
  def down(*argv)
68
73
  compose("down", *argv)
69
74
  end
70
75
 
71
- desc 'run [OPTIONS] CMD [ARGS]', 'Run configured command in a docker-compose service. `run` prefix may be omitted'
72
- method_option :publish, aliases: '-p', type: :string, repeatable: true,
76
+ desc "run [OPTIONS] CMD [ARGS]", "Run configured command in a docker-compose service. `run` prefix may be omitted"
77
+ method_option :publish, aliases: "-p", type: :string, repeatable: true,
73
78
  desc: "Publish a container's port(s) to the host"
74
- method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
79
+ method_option :help, aliases: "-h", type: :boolean, desc: "Display usage information"
75
80
  def run(*argv)
76
81
  if argv.empty? || options[:help]
77
- invoke :help, ['run']
82
+ invoke :help, ["run"]
78
83
  else
79
- require_relative 'commands/run'
84
+ require_relative "commands/run"
80
85
  Dip::Commands::Run.new(*argv, publish: options[:publish]).execute
81
86
  end
82
87
  end
83
88
 
84
89
  desc "provision", "Execute commands within provision section"
85
- method_option :help, aliases: '-h', type: :boolean,
86
- desc: 'Display usage information'
90
+ method_option :help, aliases: "-h", type: :boolean,
91
+ desc: "Display usage information"
87
92
  def provision
88
93
  if options[:help]
89
- invoke :help, ['provision']
94
+ invoke :help, ["provision"]
90
95
  else
91
- require_relative 'commands/provision'
96
+ require_relative "commands/provision"
92
97
  Dip::Commands::Provision.new.execute
93
98
  end
94
99
  end
95
100
 
96
- require_relative 'cli/ssh'
101
+ require_relative "cli/ssh"
97
102
  desc "ssh", "ssh-agent container commands"
98
103
  subcommand :ssh, Dip::CLI::SSH
99
104
 
100
- require_relative 'cli/dns'
105
+ require_relative "cli/dns"
101
106
  desc "dns", "DNS server for automatic docker container discovery"
102
107
  subcommand :dns, Dip::CLI::DNS
103
108
 
104
- require_relative 'cli/nginx'
109
+ require_relative "cli/nginx"
105
110
  desc "nginx", "Nginx reverse proxy server"
106
111
  subcommand :nginx, Dip::CLI::Nginx
107
112
 
108
- require_relative 'cli/console'
109
- desc "console", "Integrate Dip commands into shell (only ZSH and Bash is supported)"
113
+ require_relative "cli/console"
114
+ desc "console", "Integrate Dip commands into shell (only ZSH and Bash are supported)"
110
115
  subcommand :console, Dip::CLI::Console
111
116
  end
112
117
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thor'
3
+ require "thor"
4
4
  require_relative "./base"
5
5
  require_relative "../commands/console"
6
6
 
@@ -8,11 +8,11 @@ module Dip
8
8
  class CLI
9
9
  class Console < Base
10
10
  desc "start", "Integrate Dip into current shell"
11
- method_option :help, aliases: '-h', type: :boolean,
12
- desc: 'Display usage information'
11
+ method_option :help, aliases: "-h", type: :boolean,
12
+ desc: "Display usage information"
13
13
  def start
14
14
  if options[:help]
15
- invoke :help, ['start']
15
+ invoke :help, ["start"]
16
16
  else
17
17
  Dip::Commands::Console::Start.new.execute
18
18
  end
@@ -21,11 +21,11 @@ module Dip
21
21
  default_task :start
22
22
 
23
23
  desc "inject", "Inject aliases"
24
- method_option :help, aliases: '-h', type: :boolean,
25
- desc: 'Display usage information'
24
+ method_option :help, aliases: "-h", type: :boolean,
25
+ desc: "Display usage information"
26
26
  def inject
27
27
  if options[:help]
28
- invoke :help, ['inject']
28
+ invoke :help, ["inject"]
29
29
  else
30
30
  Dip::Commands::Console::Inject.new.execute
31
31
  end
data/lib/dip/cli/dns.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thor'
3
+ require "thor"
4
4
  require_relative "./base"
5
5
  require_relative "../commands/dns"
6
6
 
@@ -9,23 +9,23 @@ module Dip
9
9
  # See more https://github.com/aacebedo/dnsdock
10
10
  class DNS < Base
11
11
  desc "up", "Run dnsdock container"
12
- method_option :help, aliases: '-h', type: :boolean,
13
- desc: 'Display usage information'
14
- method_option :name, aliases: '-n', type: :string, default: "dnsdock",
15
- desc: 'Container name'
16
- method_option :socket, aliases: '-s', type: :string, default: "/var/run/docker.sock",
17
- desc: 'Path to docker socket'
18
- method_option :net, aliases: '-t', type: :string, default: "frontend",
19
- desc: 'Container network name'
20
- method_option :publish, aliases: '-p', type: :string, default: "53/udp",
21
- desc: 'Container port'
22
- method_option :image, aliases: '-i', type: :string, default: "aacebedo/dnsdock:latest-amd64",
23
- desc: 'Docker image name'
24
- method_option :domain, aliases: '-d', type: :string, default: "docker",
25
- desc: 'Top level domain'
12
+ method_option :help, aliases: "-h", type: :boolean,
13
+ desc: "Display usage information"
14
+ method_option :name, aliases: "-n", type: :string, default: "dnsdock",
15
+ desc: "Container name"
16
+ method_option :socket, aliases: "-s", type: :string, default: "/var/run/docker.sock",
17
+ desc: "Path to docker socket"
18
+ method_option :net, aliases: "-t", type: :string, default: "frontend",
19
+ desc: "Container network name"
20
+ method_option :publish, aliases: "-p", type: :string, default: "53/udp",
21
+ desc: "Container port"
22
+ method_option :image, aliases: "-i", type: :string, default: "aacebedo/dnsdock:latest-amd64",
23
+ desc: "Docker image name"
24
+ method_option :domain, aliases: "-d", type: :string, default: "docker",
25
+ desc: "Top level domain"
26
26
  def up
27
27
  if options[:help]
28
- invoke :help, ['up']
28
+ invoke :help, ["up"]
29
29
  else
30
30
  Dip::Commands::DNS::Up.new(
31
31
  name: options.fetch(:name),
@@ -39,13 +39,13 @@ module Dip
39
39
  end
40
40
 
41
41
  desc "down", "Stop dnsdock container"
42
- method_option :help, aliases: '-h', type: :boolean,
43
- desc: 'Display usage information'
44
- method_option :name, aliases: '-n', type: :string, default: "dnsdock",
45
- desc: 'Container name'
42
+ method_option :help, aliases: "-h", type: :boolean,
43
+ desc: "Display usage information"
44
+ method_option :name, aliases: "-n", type: :string, default: "dnsdock",
45
+ desc: "Container name"
46
46
  def down
47
47
  if options[:help]
48
- invoke :help, ['down']
48
+ invoke :help, ["down"]
49
49
  else
50
50
  Dip::Commands::DNS::Down.new(
51
51
  name: options.fetch(:name)
@@ -54,11 +54,11 @@ module Dip
54
54
  end
55
55
 
56
56
  desc "restart", "Stop and start dnsdock container"
57
- method_option :help, aliases: '-h', type: :boolean,
58
- desc: 'Display usage information'
57
+ method_option :help, aliases: "-h", type: :boolean,
58
+ desc: "Display usage information"
59
59
  def restart(*args)
60
60
  if options[:help]
61
- invoke :help, ['restart']
61
+ invoke :help, ["restart"]
62
62
  else
63
63
  Dip::CLI::DNS.start(["down"] + args)
64
64
  sleep 1
@@ -67,15 +67,15 @@ module Dip
67
67
  end
68
68
 
69
69
  desc "ip", "Get ip address of dnsdock container"
70
- method_option :help, aliases: '-h', type: :boolean,
71
- desc: 'Display usage information'
72
- method_option :name, aliases: '-n', type: :string, default: "dnsdock",
73
- desc: 'Container name'
74
- method_option :net, aliases: '-t', type: :string, default: "frontend",
75
- desc: 'Container network name'
70
+ method_option :help, aliases: "-h", type: :boolean,
71
+ desc: "Display usage information"
72
+ method_option :name, aliases: "-n", type: :string, default: "dnsdock",
73
+ desc: "Container name"
74
+ method_option :net, aliases: "-t", type: :string, default: "frontend",
75
+ desc: "Container network name"
76
76
  def ip
77
77
  if options[:help]
78
- invoke :help, ['status']
78
+ invoke :help, ["status"]
79
79
  else
80
80
  Dip::Commands::DNS::IP.new(
81
81
  name: options.fetch(:name),
data/lib/dip/cli/nginx.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thor'
3
+ require "thor"
4
4
  require_relative "./base"
5
5
  require_relative "../commands/nginx"
6
6
 
@@ -9,24 +9,24 @@ module Dip
9
9
  # See more https://github.com/bibendi/nginx-proxy
10
10
  class Nginx < Base
11
11
  desc "up", "Run nginx container"
12
- method_option :help, aliases: '-h', type: :boolean,
13
- desc: 'Display usage information'
14
- method_option :name, aliases: '-n', type: :string, default: "nginx",
15
- desc: 'Container name'
16
- method_option :socket, aliases: '-s', type: :string, default: "/var/run/docker.sock",
17
- desc: 'Path to docker socket'
18
- method_option :net, aliases: '-t', type: :string, default: "frontend",
19
- desc: 'Container network name'
20
- method_option :publish, aliases: '-p', type: :array, default: ["80:80"],
21
- desc: 'Container port(s). For more than one port, separate them by a space'
22
- method_option :image, aliases: '-i', type: :string, default: "bibendi/nginx-proxy:latest",
23
- desc: 'Docker image name'
24
- method_option :domain, aliases: '-d', type: :string, default: "docker",
25
- desc: 'Top level domain'
26
- method_option :certs, aliases: '-c', type: :string, desc: 'Path to ssl certificates'
12
+ method_option :help, aliases: "-h", type: :boolean,
13
+ desc: "Display usage information"
14
+ method_option :name, aliases: "-n", type: :string, default: "nginx",
15
+ desc: "Container name"
16
+ method_option :socket, aliases: "-s", type: :string, default: "/var/run/docker.sock",
17
+ desc: "Path to docker socket"
18
+ method_option :net, aliases: "-t", type: :string, default: "frontend",
19
+ desc: "Container network name"
20
+ method_option :publish, aliases: "-p", type: :array, default: ["80:80"],
21
+ desc: "Container port(s). For more than one port, separate them by a space"
22
+ method_option :image, aliases: "-i", type: :string, default: "bibendi/nginx-proxy:latest",
23
+ desc: "Docker image name"
24
+ method_option :domain, aliases: "-d", type: :string, default: "docker",
25
+ desc: "Top level domain"
26
+ method_option :certs, aliases: "-c", type: :string, desc: "Path to ssl certificates"
27
27
  def up
28
28
  if options[:help]
29
- invoke :help, ['up']
29
+ invoke :help, ["up"]
30
30
  else
31
31
  Dip::Commands::Nginx::Up.new(
32
32
  name: options.fetch(:name),
@@ -41,13 +41,13 @@ module Dip
41
41
  end
42
42
 
43
43
  desc "down", "Stop nginx container"
44
- method_option :help, aliases: '-h', type: :boolean,
45
- desc: 'Display usage information'
46
- method_option :name, aliases: '-n', type: :string, default: "nginx",
47
- desc: 'Container name'
44
+ method_option :help, aliases: "-h", type: :boolean,
45
+ desc: "Display usage information"
46
+ method_option :name, aliases: "-n", type: :string, default: "nginx",
47
+ desc: "Container name"
48
48
  def down
49
49
  if options[:help]
50
- invoke :help, ['down']
50
+ invoke :help, ["down"]
51
51
  else
52
52
  Dip::Commands::Nginx::Down.new(
53
53
  name: options.fetch(:name)
@@ -56,11 +56,11 @@ module Dip
56
56
  end
57
57
 
58
58
  desc "restart", "Stop and start nginx container"
59
- method_option :help, aliases: '-h', type: :boolean,
60
- desc: 'Display usage information'
59
+ method_option :help, aliases: "-h", type: :boolean,
60
+ desc: "Display usage information"
61
61
  def restart(*args)
62
62
  if options[:help]
63
- invoke :help, ['restart']
63
+ invoke :help, ["restart"]
64
64
  else
65
65
  Dip::CLI::Nginx.start(["down"] + args)
66
66
  sleep 1