percheron 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/percheron/actions/purge.rb +6 -6
- data/lib/percheron/actions/shell.rb +5 -2
- data/lib/percheron/commands/logs.rb +0 -1
- data/lib/percheron/commands/purge.rb +2 -1
- data/lib/percheron/commands/shell.rb +0 -1
- data/lib/percheron/stack.rb +2 -2
- data/lib/percheron/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1ba6e0501b9cf6ab5cb77737fec3fb01de42339
|
4
|
+
data.tar.gz: 603bd092e32325a8f7048836cc6bf591a34968da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7c5dc74228d637d145daf3e7179392b3919d9e575573285a0d57ef5c1540589fe2c657d4a30d6568a3e2be482a42d20b9399ea56e8fa6a15cf9dd73d36d792c
|
7
|
+
data.tar.gz: 998bc9494e00c05e73ff9667ecd51502315208aee1f9900a40854832b072a68a8f93e3b70c0629fde4336c7fb7207d112bf2dade4eaa75019ddbf0bf2933446f
|
data/README.md
CHANGED
@@ -53,9 +53,16 @@ $ gem install percheron
|
|
53
53
|
|
54
54
|
TODO
|
55
55
|
|
56
|
+
## Debugging
|
57
|
+
|
58
|
+
To debug Percheron, set the `DEBUG=true` environment variable.
|
59
|
+
|
60
|
+
To debug Percheron and Docker, set the `DOCKER_DEBUG=true` environment variable.
|
61
|
+
|
56
62
|
## Examples
|
57
63
|
|
58
64
|
* [Rails](https://github.com/ashmckenzie/percheron-rails#quickstart) - Rails 4.2, PostgreSQL, redis, HAProxy and postfix
|
65
|
+
* [Redis](https://github.com/ashmckenzie/percheron-redis#quickstart) - Redis cluster + sentinel, master, two slaves and tools
|
59
66
|
* [Torrent](https://github.com/ashmckenzie/percheron-torrent#quickstart) - Tracker (chihaya), seeder (aria2) and three peers (aria2)
|
60
67
|
* [SaltStack](https://github.com/ashmckenzie/percheron-saltstack#quickstart) - SaltStack v2015.2.0rc2 with master and minion
|
61
68
|
|
@@ -4,9 +4,9 @@ module Percheron
|
|
4
4
|
|
5
5
|
include Base
|
6
6
|
|
7
|
-
def initialize(container,
|
7
|
+
def initialize(container, force: false)
|
8
8
|
@container = container
|
9
|
-
@
|
9
|
+
@force = force
|
10
10
|
end
|
11
11
|
|
12
12
|
def execute!
|
@@ -19,20 +19,20 @@ module Percheron
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
attr_reader :container, :
|
22
|
+
attr_reader :container, :force
|
23
23
|
|
24
24
|
def stop!
|
25
25
|
Stop.new(container).execute!
|
26
26
|
end
|
27
27
|
|
28
28
|
def delete_image?
|
29
|
-
|
29
|
+
container.image_exists? && container.buildable?
|
30
30
|
end
|
31
31
|
|
32
32
|
def delete_container!
|
33
33
|
return nil unless container.exists?
|
34
34
|
$logger.info "Deleting '#{container.name}' container"
|
35
|
-
container.docker_container.remove
|
35
|
+
container.docker_container.remove(force: force)
|
36
36
|
rescue Docker::Error::ConflictError => e
|
37
37
|
$logger.error "Unable to delete '%s' container - %s" % [ container.name, e.inspect ]
|
38
38
|
end
|
@@ -40,7 +40,7 @@ module Percheron
|
|
40
40
|
def delete_image!
|
41
41
|
return nil unless delete_image?
|
42
42
|
$logger.info "Deleting '#{container.image_name}' image"
|
43
|
-
container.image.remove
|
43
|
+
container.image.remove(force: force)
|
44
44
|
rescue Docker::Error::ConflictError => e
|
45
45
|
$logger.error "Unable to delete '%s' image - %s" % [ container.image_name, e.inspect ]
|
46
46
|
end
|
@@ -12,15 +12,18 @@ module Percheron
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def execute!
|
15
|
-
Validators::DockerClient.new.validate_docker_client_available!
|
16
15
|
$logger.debug "Executing #{shell} on '#{container.name}' container"
|
17
|
-
exec!
|
16
|
+
exec! if valid?
|
18
17
|
end
|
19
18
|
|
20
19
|
private
|
21
20
|
|
22
21
|
attr_reader :container, :shell
|
23
22
|
|
23
|
+
def valid?
|
24
|
+
Validators::DockerClient.new.valid?
|
25
|
+
end
|
26
|
+
|
24
27
|
def exec!
|
25
28
|
system('%s exec -ti %s %s' % [ DOCKER_CLIENT, container.full_name, shell ])
|
26
29
|
end
|
@@ -3,10 +3,11 @@ module Percheron
|
|
3
3
|
class Purge < Abstract
|
4
4
|
|
5
5
|
default_parameters!
|
6
|
+
option([ '-f', '--force' ], :flag, 'Force container/image removal', default: false)
|
6
7
|
|
7
8
|
def execute
|
8
9
|
super
|
9
|
-
stack.purge!(container_names: container_names)
|
10
|
+
stack.purge!(container_names: container_names, force: force?)
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
data/lib/percheron/stack.rb
CHANGED
@@ -74,8 +74,8 @@ module Percheron
|
|
74
74
|
execute!(Actions::Recreate, filter_container_names(container_names), start: start)
|
75
75
|
end
|
76
76
|
|
77
|
-
def purge!(container_names: [])
|
78
|
-
execute!(Actions::Purge, filter_container_names(container_names).reverse)
|
77
|
+
def purge!(container_names: [], force: false)
|
78
|
+
execute!(Actions::Purge, filter_container_names(container_names).reverse, force: force)
|
79
79
|
end
|
80
80
|
|
81
81
|
def execute!(klass, container_names, args=nil)
|
data/lib/percheron/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percheron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ash McKenzie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|