docker_houston 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 6539efaf951659ad0d35a39b582b747495856de3
4
- data.tar.gz: bbfb4cae46807ccfd50d7fe453fb8722858d8c71
3
+ metadata.gz: 93c1ec3e45059f8a462b9e5844a7509bfa8a3179
4
+ data.tar.gz: 4638e8cc88ae6afd0e1867f9a7dc760e16692056
5
5
  SHA512:
6
- metadata.gz: d75df9b1a429328a6ed90969147533dd1982c540a69d78000c57de8325106feda787d2146c62814c74b041424c36b18288203ba23f1c80ee6e6399cf62fcb70c
7
- data.tar.gz: 0239524cf87f464699e7166682e8d6fe79dd3f8b627c935f35b0b38162da6adaf7a711018f450eec3b7c97015703a81327cf5aa5a52d102cee6798d025d34cca
6
+ metadata.gz: 766610f8a772345a4ff4b69c96bd5c7f1216d910aeb1dac6ffecc4c41d2f13720fa7269c9b713901f026ca2d7297317d9eb90782c496254725c3d3425bd19433
7
+ data.tar.gz: 9856ce1bc1ddc1cbc2cb3f8c91d847a0da8029ae4362858b56248bf6f892b65e8a0666d478a79db73350c3475ebb889d5f1204b55da6c26521e7ddbcd878fb20
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # DockerHouston
2
2
 
3
- DockerHouston is a utiilty for deploying rails app into a docker environments.
3
+ [![Gem Version](https://badge.fury.io/rb/docker_houston.svg)](https://badge.fury.io/rb/docker_houston)
4
4
 
5
- It builds on the top of Capistrano for differnt deployment to a docker host.
5
+ DockerHouston is a utility for deploying rails app into a docker environments.
6
6
 
7
- docker_houston comes with a generator to copy and templates all necessary config files and to the target rails project.
7
+ It builds on the top of Capistrano for different deployment to a docker host.
8
8
 
9
+ DockerHouston comes with a generator to copy and templates all necessary config files and to the target rails project.
9
10
 
10
11
  ###Prerequisite
11
12
  Make sure you have access to the ``docker_host`` with the user as ``deploy``.
@@ -16,6 +17,7 @@ Add this line to your application's Gemfile:
16
17
 
17
18
  ```ruby
18
19
  gem 'docker_houston'
20
+
19
21
  ```
20
22
 
21
23
  And then execute:
@@ -33,7 +35,7 @@ Or install it yourself as:
33
35
 
34
36
  Add `unicorn` to gemfile and ensure the `therubyracer` is enabled.
35
37
 
36
- ```
38
+ ```ruby
37
39
  gem 'therubyracer', platforms: :ruby
38
40
 
39
41
  gem 'unicorn'
@@ -44,6 +46,7 @@ gem 'unicorn'
44
46
 
45
47
  ```ruby
46
48
  rails g docker_houston:install APP_NAME APP_DOMAIN DOCKER_HOST
49
+
47
50
  ```
48
51
 
49
52
  APP_NAME: the app name for your project.
@@ -79,12 +82,13 @@ cap staging docker:lift_off
79
82
  This will we do the following:
80
83
 
81
84
  ```ruby
82
- invoke 'deploy'
83
- invoke 'docker:setup_db'
84
- invoke 'docker:build_container'
85
- invoke 'docker:stop'
86
- invoke 'docker:start'
87
- invoke 'docker:notify'
85
+ invoke 'deploy'
86
+ invoke 'docker:setup_db'
87
+ invoke 'docker:build_container'
88
+ invoke 'docker:stop'
89
+ invoke 'docker:start'
90
+ invoke 'docker:notify'
91
+
88
92
  ```
89
93
  * Deploy a new version to the current folder.
90
94
  * Build the container for it.
@@ -101,13 +105,31 @@ cap staging docker:console
101
105
 
102
106
  ```
103
107
 
108
+ ### Notifying
109
+ To integrate with your IM chat, [Slack](https://slack.com) or [HipChat](https://www.hipchat.com)
110
+ Provide the following ENV variables to enable that service:
111
+
112
+ ####Slack
113
+ ```
114
+ SLACK_WEBHOOK_URL=https://hooks.slack.com/services/TXXXXX/BXXXXX/XXXXXXXXXX
115
+ SLACK_CHANNEL=general
116
+
117
+ ```
118
+
119
+ ####HipChat
120
+ ```
121
+ HIPCHAT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
122
+ HIPCHAT_ROOM=Water Cooler
123
+
124
+ ```
125
+
126
+ The deploy message reads: "New version of #{fetch(:app_name)} has been deployed at #{fetch(:app_domain)}."
104
127
 
105
128
  ## Contributing
106
129
 
107
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/docker_houston. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
130
+ Bug reports and pull requests are welcome on GitHub at https://github.com/touchtechltd/docker_houston. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
108
131
 
109
132
 
110
133
  ## License
111
134
 
112
135
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
113
-
@@ -6,7 +6,7 @@ require 'docker_houston/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "docker_houston"
8
8
  spec.version = DockerHouston::VERSION
9
- spec.authors = ["alex-zige"]
9
+ spec.authors = ["alex-zige", "jesserockz"]
10
10
  spec.email = ["alex.zige@gmail.com"]
11
11
 
12
12
  spec.summary = "Misson Control for docker builds."
data/lib/.DS_Store ADDED
Binary file
@@ -2,5 +2,7 @@ require "docker_houston/version"
2
2
  require 'capistrano/all'
3
3
  require 'docker_houston/railtie'
4
4
  require 'docker_houston/capistrano.rb'
5
+ require 'docker_houston/slack/message.rb'
6
+ require 'docker_houston/hipchat/message.rb'
5
7
  module DockerHouston
6
8
  end
@@ -67,16 +67,6 @@ namespace :docker do
67
67
  end
68
68
  end
69
69
 
70
- desc "precompile assets"
71
- task :precompile_assets do
72
- on roles :app do
73
- within fetch(:release_dir) do
74
- execute :echo, "precompiling assets..."
75
- execute "docker-compose -p #{fetch(:app_with_stage)} run web bundle exec rake assets:precompile"
76
- end
77
- end
78
- end
79
-
80
70
  desc "start web service"
81
71
  task :start do
82
72
  on roles :app do
@@ -113,11 +103,13 @@ namespace :docker do
113
103
 
114
104
  desc "Tail logs from remote dockerised app"
115
105
  task :logs do
116
- execute "cd #{fetch(:log_dir)} && tail -f staging.log"
106
+ execute_on_remote "cd #{fetch(:log_dir)} && tail -f staging.log"
117
107
  end
118
108
 
119
- desc 'Notify Third party IM'
109
+ desc 'Notify deploy on third party IM'
120
110
  task :notify do
111
+ message = "New version of #{fetch(:app_name)} has been deployed at #{fetch(:app_domain)}"
112
+ exec "rake notifier:notify[\"#{message}\"]"
121
113
  end
122
114
 
123
115
  desc 'Drop reseed the database'
@@ -0,0 +1,22 @@
1
+ module DockerHouston
2
+ module Hipchat
3
+ class Message
4
+ def initialize(room, text)
5
+ @uri = URI("http://api.hipchat.com/v1/rooms/message")
6
+ @room = room
7
+ @text = text
8
+ @token = ENV['HIPCHAT_TOKEN']
9
+ end
10
+
11
+ def notify
12
+ response = Net::HTTP.post_form(@uri, {
13
+ "auth_token" => @token,
14
+ "room_id" => @room,
15
+ "message" => @text,
16
+ "from" => "Docker Houston",
17
+ "message_format" => "text"
18
+ })
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module DockerHouston
2
+ module Slack
3
+ class Message
4
+ def initialize(channel, text)
5
+ @uri = URI.parse(ENV['SLACK_WEBHOOK_URL'])
6
+ @channel = channel
7
+ @channel = '#' + @channel unless @channel.include? '#'
8
+ @text = text
9
+ end
10
+
11
+ def notify
12
+ response = Net::HTTP.post_form(@uri, {'payload' => {
13
+ "channel" => @channel,
14
+ "text" => @text,
15
+ "username" => "Docker Houston",
16
+ "icon_emoji" => ":rocket:"
17
+ }.to_json }
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module DockerHouston
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -25,7 +25,7 @@ module DockerHouston
25
25
  end
26
26
 
27
27
  def copy_database_file
28
- copy_file "database.yml.docker.erb", "config/database.yml.docker"
28
+ template "database.yml.docker.erb", "config/database.yml.docker"
29
29
  end
30
30
 
31
31
  def copy_unicorn
@@ -21,3 +21,4 @@ require 'docker_houston/capistrano'
21
21
 
22
22
  set :working_dir, "/home/deploy/dockerised_apps/<%= app_name %>"
23
23
 
24
+ set :app_domain, "<%= app_domain %>"
@@ -0,0 +1,12 @@
1
+ namespace :notifier do
2
+ task :notify, [:message] => :environment do |t, args|
3
+ if !ENV['SLACK_WEBHOOK_URL'].nil? && !ENV['SLACK_WEBHOOK_URL'].blank?
4
+ p "Sending Slack message"
5
+ DockerHouston::Slack::Message.new(ENV['SLACK_CHANNEL'], args[:message]).notify
6
+ end
7
+ if !ENV['HIPCHAT_TOKEN'].nil? && !ENV['HIPCHAT_TOKEN'].blank?
8
+ p "Sending Hipchat message"
9
+ DockerHouston::Hipchat::Message.new(ENV['HIPCHAT_ROOM'], args[:message]).notify
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_houston
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - alex-zige
8
+ - jesserockz
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
12
+ date: 2016-05-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -70,9 +71,12 @@ files:
70
71
  - bin/docker
71
72
  - bin/setup
72
73
  - docker_houston.gemspec
74
+ - lib/.DS_Store
73
75
  - lib/docker_houston.rb
74
76
  - lib/docker_houston/capistrano.rb
77
+ - lib/docker_houston/hipchat/message.rb
75
78
  - lib/docker_houston/railtie.rb
79
+ - lib/docker_houston/slack/message.rb
76
80
  - lib/docker_houston/version.rb
77
81
  - lib/generators/.DS_Store
78
82
  - lib/generators/docker_houston/install_generator.rb
@@ -84,6 +88,7 @@ files:
84
88
  - lib/generators/templates/secrets.yml
85
89
  - lib/generators/templates/staging.rb.erb
86
90
  - lib/generators/templates/unicorn.rb
91
+ - lib/tasks/notifier.rake
87
92
  homepage: http://www.google.com
88
93
  licenses:
89
94
  - MIT