capistrano-decompose 0.1 → 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: 982e23a46591cd5584c87a1396f53a4ccd176d94
4
- data.tar.gz: ba306eae0a21a5da1b05bc7e4021be83c1baea8a
3
+ metadata.gz: 2ee987eae8bc6a437a8964b9d7a40d012ac764d9
4
+ data.tar.gz: 67c6f9504c421d0f760990647a5169a93e8bb9b8
5
5
  SHA512:
6
- metadata.gz: 5a3af8ccc36f021f2815b60bdf5dd01108ef44a34f3ebb229bf7b43018efe8a1809f5aeee2552b926dc077f5a1860a8323ff5a865ed05e55e54ec8bff5fa95a1
7
- data.tar.gz: 6f8704eac3994023b425e50626d26b7d9382617fbdf66e79749ec4e29d090031efcf1f38d5e2625358531df052e67fd46ea32478d52e3d4ad49e5323b8838273
6
+ metadata.gz: 2c1206bb0dbd43f6e80052994366aa258cfc9f03f94636134cf201f6475cba0ed339428aff33a9c748609de3c40c058bd6e601f836e21e310888e2acc01fae64
7
+ data.tar.gz: 09a6537feacf72d0558d432d9ed2ff82b1458e44ab6d7884b22f627a07346714c81ef9ace409032c8f8c11bc334bb24c4c441c636cd5183a5b5d02a4b173175e
data/README.md CHANGED
@@ -1,16 +1,23 @@
1
1
  # Capistrano::Decompose
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/capistrano-decompose.svg)](https://badge.fury.io/rb/capistrano-decompose)
4
+
3
5
  Add tasks for capistrano to deploy with docker-compose.
4
6
 
7
+ ## Why?
8
+
9
+ when I was working on my project [Who is popular today](https://www.whoispopulartoday.com) I had that problem that I have a VPS server and I need to isolate each of my apps to a separate environment so the solutions are pretty limited in here, it's Docker or LXC,
10
+ I choose Docker and Docker-Compose as it's easier to get a set of disposable environments up and running in no time and link them to the host data directories which is what I needed, but there where not any kind of integeration with Capistrano to roll out new versions, so here is Capistrano-Decompose a Docker-Compose integeration with capistrano, I hope it solves your problem as it did to mine.
11
+
5
12
  ## How it works
6
13
 
7
- after capistrano pull your repo and link it to the `current` directory, decompose will invoke `docker-compose build` to build your images and then run some rake tasks that you configured in your deployment with the key `decompose_rake_tasks`, you can add your rails tasks like `db:migration`, `assets:precompile`...etc here, then it will invoke `docker-compose up` or restart only the web service you specified in key `decompose_restart`, also you can use `cap <env> decompose:run` to run any command inside a service, so anytime you need to invoke `rails console` inside you docker image on your server you can use `cap production decompose:run rails console`.
14
+ After capistrano pull your repo and link it to the `current` directory, decompose will invoke `docker-compose build` to build your images and then run some rake tasks that you configured in your deployment with the key `decompose_rake_tasks`, you can add your rails tasks like `db:migration`, `assets:precompile`...etc here, then it will invoke `docker-compose up` or restart only the web service you specified in key `decompose_restart`, also you can use `cap <env> decompose:run` to run any command inside a service, so anytime you need to invoke `rails console` inside you docker image on your server you can use `cap production decompose:run rails console`.
8
15
 
9
- at the end decompose will delete the older images from remote server to keep the server clean.
16
+ At the end decompose will delete the older images from remote server to keep the server clean.
10
17
 
11
18
  ## Installation
12
19
 
13
- add this line to your Gemfile
20
+ Add this line to your Gemfile
14
21
 
15
22
  ``` ruby
16
23
  gem 'capistrano-decompose'
@@ -38,30 +45,39 @@ require 'capistrano/decompose
38
45
 
39
46
  ## Options for deployment
40
47
 
41
- you can specify the following options in you `deploy.rb` script or the environment specific deploy file:
48
+ You can specify the following options in you `deploy.rb` script or the environment specific deploy file:
42
49
 
43
- ``` ruby
44
- decompose_restart: an array of services that should be restarted each deployment, if not specified decompose will restart all services
45
- decompose_web_service: the web service that will be used to execute commands inside like `rake` or any interactive command from `decompose:run`, default value: :web
46
- decompose_rake_tasks: a set of rake tasks to execute after each deploy, default value is `nil`
47
- ```
50
+ * **decompose_restart**: An array of services that should be restarted each deployment, if not specified decompose will restart all services
51
+ * **decompose_web_service**: The web service that will be used to execute commands inside like `rake` or any interactive command from `decompose:run`, default value: :web
52
+ * **decompose_rake_tasks**: A set of rake tasks to execute after each deploy, default value is `nil`
48
53
 
49
- for a typical rails application the previous options should be as follows, given that the application container service name is `web`:
54
+ For a typical rails application the previous options should be as follows, given that the application container service name is `web`:
50
55
 
51
56
  ```ruby
52
57
  set :decompose_restart, [:web]
53
58
  set :decompose_web_service, :web
54
- set :docker_rake_tasks, ['db:migrate', 'assets:precompile']
59
+ set :decompose_rake_tasks, ['db:migrate', 'assets:precompile']
60
+ ```
61
+
62
+ ## Defined Tasks
63
+
64
+ ```
65
+ decompose:build # build docker-compose services
66
+ decompose:clean # delete docker images that are not related to current build
67
+ decompose:down # shutdown all project services with docker-compose
68
+ decompose:rake_tasks # execute a set of rake tasts inside the web container
69
+ decompose:restart # restart services of docker-compose and if not services listed restart all services
70
+ decompose:run # run an interactive command inside the web container
71
+ decompose:up # boot up all docker-compose services
55
72
  ```
56
73
 
57
- ## after the first deployment of a rails application
74
+ ## After the first deployment of a rails application
58
75
 
59
- you would need to setup your database by invoking the `db:setup` task to create and seed your database, you can do that using 2 ways
76
+ You would need to setup your database by invoking the `db:setup` task to create and seed your database:
60
77
 
61
- * `cap production decompose:db_setup`
62
78
  * `cap production decompose:run rake db:setup`
63
79
 
64
80
  ## General note
65
81
 
66
- * this gem doesn't provide a `dockerfile` or `docker-compose.yml` file, you have to create these files yourself
67
- * the linked directories and files will not work and you should use docker data volumes anyway
82
+ * This gem doesn't provide a `dockerfile` nor `docker-compose.yml` file, you have to create these files yourself
83
+ * The linked directories and files will not work and you should use docker data volumes anyway
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Decompose
3
- VERSION = '0.1'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -48,7 +48,7 @@ namespace :decompose do
48
48
  on roles(:app) do
49
49
  within release_path do
50
50
  images_to_delete = capture('docker images -f "dangling=true" -q')
51
- execute 'docker rmi $(docker images -f "dangling=true" -q)' unless images_to_delete.empty?
51
+ execute 'docker rmi -f $(docker images -f "dangling=true" -q)' unless images_to_delete.empty?
52
52
  end
53
53
  end
54
54
  end
@@ -62,15 +62,6 @@ namespace :decompose do
62
62
  end
63
63
  end
64
64
 
65
- desc 'execute rake db:setup inside the web container'
66
- task :db_setup do
67
- on roles(:app) do
68
- within release_path do
69
- docker_rake('db:setup')
70
- end
71
- end
72
- end
73
-
74
65
  desc 'run an interactive command inside the web container'
75
66
  task :run do
76
67
  on roles(:app) do |host|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-decompose
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emad Elsaid
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-28 00:00:00.000000000 Z
11
+ date: 2016-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano