capistrano-docker-compose 0.1.0 → 0.1.1

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: f948091c0dcfdef9e8ed7404ac67b4db3b2d6332
4
- data.tar.gz: 1008f6236e835522c0b03db4aea307536d23c0c7
3
+ metadata.gz: c309bf938b62b19da661f3c67206bf67ac201619
4
+ data.tar.gz: e9921eebbf00477019f64e17574fd5534ab7b60b
5
5
  SHA512:
6
- metadata.gz: ff91f069c9c0ddc6dd7a2fffbec755420ffa90f696ddc9f76f53b965dc5b5fd4eb6a3b24ed592fd0e8b4f3ab291e3574d77c4420cf2368974226b89cba6c99dd
7
- data.tar.gz: df89b9b60d50222d928f34d683af932e6014c50c1bec52a89a517923f49cf5075dbae3981838bb49894303b0743ac09f25c5df75ee3b5e35ac5e9c1e203c540f
6
+ metadata.gz: b471c2559ca3a7a8419052bfe5c7fe378fe357df3a49fb86ae780a49b4fc5ad571006f05eb823305afb5b90f533331611ba8f9fe92b5cf96b797f2814b6fdd74
7
+ data.tar.gz: fec4895fa2d43e0951bee4cd65924be5da5715a70112fab79c1ae279dbdcc82e6de7d8ec6a0a124899446a2df27c4945f472050eba549e584ad15c0642ee80de
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Capistrano::Docker::Compose
1
+ # Capistrano::Docker::Compose [![Build Status](https://travis-ci.org/interactive-pioneers/capistrano-docker-compose.svg?branch=master)](https://travis-ci.org/interactive-pioneers/capistrano-docker-compose) [![Gem Version](https://badge.fury.io/rb/capistrano-docker-compose.svg)](https://badge.fury.io/rb/capistrano-docker-compose)
2
2
 
3
3
  Docker Compose specific tasks for Capistrano allowing seamless zero downtime containerised deployments.
4
4
 
@@ -33,6 +33,13 @@ Create Docker Compose descriptors for each environment leaving `docker-compose.y
33
33
  - `docker-compose-staging.yml`
34
34
  - `docker-compose-production.yml`
35
35
 
36
+ Make Compose YAML dynamic with following environment variables:
37
+
38
+ - `CAP_DOCKER_COMPOSE_ROOT_PATH` for shared path
39
+ - `CAP_DOCKER_COMPOSE_PORT` for port range
40
+
41
+ See also [Compose YAML example](https://github.com/interactive-pioneers/capistrano-docker-compose/blob/master/docker-compose-staging.example.yml).
42
+
36
43
  Add `capistrano-docker-compose` to `Capfile`:
37
44
 
38
45
  ``` ruby
@@ -40,18 +47,25 @@ Add `capistrano-docker-compose` to `Capfile`:
40
47
  require 'capistrano/docker/compose'
41
48
  ```
42
49
 
43
- You can configure following Docker Compose specific options in `config/deploy.rb` and/or `config/deploy/<environment>.rb`:
50
+ Configure following Docker Compose specific options in `config/deploy.rb` and/or `config/deploy/<environment>.rb`:
44
51
 
45
52
  ```ruby
46
- # User name when running the Docker image (reflecting Docker's USER instruction)
47
- # Example: set :docker_compose_user, 'pioneer'
48
- set :docker_compose_user, '<username>'
49
-
50
53
  # Define port range in respect to load balancer on server
51
54
  # If 2 or more environments reside on same server, configure port range as per environment
52
55
  # Ruby's Range object is expected, see http://ruby-doc.org/core-2.3.0/Range.html
53
56
  # Example: set :docker_compose_port_range, 2070..2071
54
57
  set :docker_compose_port_range, <port>..<port>
58
+
59
+ # OPTIONAL
60
+ # User name when running the Docker image (reflecting Docker's USER instruction)
61
+ # Example: set :docker_compose_user, 'pioneer'
62
+ set :docker_compose_user, '<username>'
63
+
64
+ # OPTIONAL
65
+ # Roles considered
66
+ # Defaults to :all
67
+ # Example: set :docker_compose_roles, :web
68
+ set :docker_compose_roles, <roles>
55
69
  ```
56
70
 
57
71
  Configure load balancer with port range defined in `docker_compose_port_range`, see [example configuration](https://github.com/interactive-pioneers/capistrano-docker-compose/blob/master/haproxy.example.cfg).
@@ -0,0 +1,14 @@
1
+ version: '2'
2
+ services:
3
+ web:
4
+ image: ipioneers/passenger-ruby:2.3
5
+ expose:
6
+ - 80
7
+ volumes:
8
+ - .:/home/app
9
+ - ../../shared:${CAP_DOCKER_COMPOSE_ROOT_PATH}/shared
10
+ ports:
11
+ - "${CAP_DOCKER_COMPOSE_PORT}:80"
12
+ environment:
13
+ - RAILS_ENV=staging
14
+ - PASSENGER_APP_ENV=staging
@@ -1,7 +1,7 @@
1
1
  module Capistrano
2
2
  module Docker
3
3
  module Compose
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
@@ -1,11 +1,17 @@
1
- SSHKit.config.command_map.prefix[:bundle].push("docker-compose exec web")
1
+ # Rewire key commands to container
2
+ %i(bundle rake).map do |command|
3
+ # FIXME: replace hard-coded web service with master service setting
4
+ # https://github.com/interactive-pioneers/capistrano-docker-compose/issues/7
5
+ SSHKit.config.command_map.prefix[command].push("docker-compose exec web")
6
+ end
2
7
 
3
8
  namespace :deploy do
4
9
 
5
10
  set :previous_release_path, nil
11
+ set :docker_compose_roles, :all
6
12
 
7
13
  task :pull_images do
8
- on roles(:docker), in: :groups, limit: 3, wait: 10 do
14
+ on roles(fetch(:docker_compose_roles)) do
9
15
  within release_path do
10
16
  execute :'docker-compose', 'pull'
11
17
  # TODO: confirm successful pull
@@ -14,7 +20,7 @@ namespace :deploy do
14
20
  end
15
21
 
16
22
  task :start_containers do
17
- on roles(:docker) do
23
+ on roles(fetch(:docker_compose_roles)) do
18
24
  set :previous_release_path, previous_release
19
25
  within release_path do
20
26
  with cap_docker_compose_root_path: fetch(:deploy_to), cap_docker_compose_port: detect_available_port do
@@ -27,7 +33,7 @@ namespace :deploy do
27
33
  task :claim_files_by_container do
28
34
  user = fetch(:docker_compose_user)
29
35
  unless user.nil?
30
- on roles(:docker) do
36
+ on roles(fetch(:docker_compose_roles)) do
31
37
  within release_path do
32
38
  execute :'docker-compose', 'exec', 'web', 'chown', '-R', "#{user}:#{user}", '.'
33
39
  end
@@ -36,7 +42,7 @@ namespace :deploy do
36
42
  end
37
43
 
38
44
  task :purge_old_containers do
39
- on roles(:docker) do
45
+ on roles(fetch(:docker_compose_roles)) do
40
46
  if fetch(:previous_release_path)
41
47
  info "Purging previous release containers at #{fetch(:previous_release_path)}"
42
48
  within fetch(:previous_release_path) do
@@ -47,7 +53,7 @@ namespace :deploy do
47
53
  end
48
54
 
49
55
  task :purge_failed_containers do
50
- on roles(:docker) do
56
+ on roles(fetch(:docker_compose_roles)) do
51
57
  within release_path do
52
58
  execute :'docker-compose', 'down'
53
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-docker-compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ain Tohvri
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-12 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -82,6 +82,7 @@ files:
82
82
  - README.md
83
83
  - Rakefile
84
84
  - capistrano-docker-compose.gemspec
85
+ - docker-compose-staging.example.yml
85
86
  - haproxy.example.cfg
86
87
  - lib/capistrano-docker-compose.rb
87
88
  - lib/capistrano/docker.rb