capistrano-deploy_into_docker 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +94 -0
- data/lib/capistrano-deploy_into_docker.rb +1 -0
- data/lib/capistrano/deploy_into_docker.rb +3 -0
- data/lib/capistrano/deploy_into_docker/hooks.rb +1 -0
- data/lib/capistrano/deploy_into_docker/tasks.rb +1 -0
- data/lib/capistrano/deploy_into_docker/version.rb +5 -0
- data/lib/capistrano/tasks/deploy_into_docker.cap +11 -0
- data/lib/capistrano/tasks/hooks.cap +1 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e35e47f0a071f729fd03ffdec90da210393cee4f
|
4
|
+
data.tar.gz: e73c24af40b08c52179247e9db0662abc5a9e773
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 217e5d4680875e07f822d9b004834516119c930a3c426e5b0f6efe7760a6a31dc42feec7306a2b432b3b01263004f40e84169c651a12d91272ed22794e2e987e
|
7
|
+
data.tar.gz: d71b62f968aaffa454ea08b077d9bca600f7f1896781c5e273ad3e0140b84bc3a9f704f42f92aa260ea19e1b3a41b40eb39b8fa79205620f4de4d72c2607b683
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2016 Tatsuki Sugiura
|
2
|
+
|
3
|
+
permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# capistrano-deploy\_into\_docker
|
2
|
+
|
3
|
+
Mini support task file to deploy app into docker.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add in your Gemfile
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'capistrano-deploy_into_docker'
|
11
|
+
```
|
12
|
+
|
13
|
+
## HowTo: deploy your rails application into docker
|
14
|
+
|
15
|
+
### add sshkit supports docker backend
|
16
|
+
|
17
|
+
Currently docker backend is not merged yet into upsatrem.
|
18
|
+
You need to fetch gem from my github repository.
|
19
|
+
|
20
|
+
Add this line to Gemfile:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
gem 'sshkit', github: 'sugi/sshkit', branch: 'docker-backend', group: :development
|
24
|
+
```
|
25
|
+
|
26
|
+
When upstream merges docker backend, you do NOT need this.
|
27
|
+
|
28
|
+
### require task on Capfile
|
29
|
+
|
30
|
+
Add following like to your Capfile;
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require 'capistrano/deploy_into_docker'
|
34
|
+
```
|
35
|
+
|
36
|
+
This just add deploy_into_docker:commit task.
|
37
|
+
|
38
|
+
### deploy setting
|
39
|
+
|
40
|
+
Here is an example for config/deploy/docker.rb;
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
set :stage, :production
|
44
|
+
set :branch, 'production'
|
45
|
+
set :deploy_to, '/var/local/app'
|
46
|
+
set :git_shallow_clone, 1
|
47
|
+
fetch(:default_env).merge!(rails_env: :production, SECRET_KEY_BASE: 'dummy', DEVISE_SECRET_KEY: 'dummy')
|
48
|
+
|
49
|
+
fetch(:linked_dirs, []).clear
|
50
|
+
fetch(:linked_files, []).clear
|
51
|
+
|
52
|
+
server docker: {
|
53
|
+
image: 'sugi/rails-base',
|
54
|
+
commit: 'myapp-web',
|
55
|
+
}, user: 'rails:rails', roles: %w{web app}
|
56
|
+
```
|
57
|
+
|
58
|
+
## Server definition as Docker host
|
59
|
+
|
60
|
+
You need to set docker environment as host infomation hash.
|
61
|
+
The hash requires **:image** (or :container) key to run.
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
server docker: {image: 'sugi/rails-base:latest'}
|
65
|
+
```
|
66
|
+
|
67
|
+
If you set **:commit** key, run "docker commit" after deploy automatically.
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
server docker: {
|
71
|
+
image: 'sugi/rails-base:latest',
|
72
|
+
commit: 'new-image-name:tag',
|
73
|
+
}, user: 'nobody:nogroup', roles: %w{web app}
|
74
|
+
```
|
75
|
+
|
76
|
+
In addtion, you can add any options for "docker run". for example;
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
server docker: {
|
80
|
+
image: 'sugi/rails-base:latest',
|
81
|
+
commit: 'new-image-name:tag',
|
82
|
+
volume: ['/storage/tmp:/tmp', '/storage/home:/home'],
|
83
|
+
network: 'my-net',
|
84
|
+
dns: '8.8.8.8',
|
85
|
+
dns_search: 'example.com',
|
86
|
+
cap_add: ['SYS_NICE', 'SYS_RESOURCE'],
|
87
|
+
}, user: 'nobody:nogroup', roles: %w{web app}
|
88
|
+
```
|
89
|
+
|
90
|
+
## License
|
91
|
+
|
92
|
+
Author: Tatsuki Sugiura
|
93
|
+
|
94
|
+
Files are distributed under [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'capistrano/deploy_into_docker/version'
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../../tasks/hooks.cap', __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../../tasks/deploy_into_docker.cap', __FILE__)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
namespace :deploy_into_docker do
|
2
|
+
set :docker_commit_roles, :all
|
3
|
+
set :docker_commit_servers, -> { release_roles(fetch(:docker_commit_roles)) }
|
4
|
+
|
5
|
+
desc 'commmit docker containers'
|
6
|
+
task :commit do
|
7
|
+
on fetch(:docker_commit_servers) do
|
8
|
+
docker_commit
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
after 'deploy:finished', 'deploy_into_docker:commit'
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-deploy_into_docker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tatsuki Sugiura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Capistrano tasks to deploy into docker.
|
42
|
+
email:
|
43
|
+
- sugi@nemui.org
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- lib/capistrano-deploy_into_docker.rb
|
51
|
+
- lib/capistrano/deploy_into_docker.rb
|
52
|
+
- lib/capistrano/deploy_into_docker/hooks.rb
|
53
|
+
- lib/capistrano/deploy_into_docker/tasks.rb
|
54
|
+
- lib/capistrano/deploy_into_docker/version.rb
|
55
|
+
- lib/capistrano/tasks/deploy_into_docker.cap
|
56
|
+
- lib/capistrano/tasks/hooks.cap
|
57
|
+
homepage: http://github.com/sugi/capistrano-deploy_into_docker/
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.5.1
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Capistrano tasks to deploy into docker.
|
81
|
+
test_files: []
|