docker_toolkit 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +90 -0
- data/lib/docker_toolkit/runner.rb +4 -4
- data/lib/docker_toolkit/version.rb +1 -1
- data/lib/docker_toolkit/watcher.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d6d127fd4fbc93569238e201ee3400b5ce8949edc4d22e28fe9a4ff899c66ec
|
4
|
+
data.tar.gz: db197202c36f8a5afa0588818313288bcffbbbc2319c90be23922eacb3fb0e4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb9cfb56bbdda94b81cdd5ba73d041a3bd12b411a2416869bf8a496848c26d13f9edfdbf9005a11e14a02211fbbeac24a3400b14d9e449840755efdd72800d13
|
7
|
+
data.tar.gz: 4fad8c01377d15968f83503210a17afb5ee39c34ab3b3ea684a9053cbcdf154e6463f37d647e7a23be38ba2c17591104e56d9762470304ac3ba733c1acb4928a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,3 +2,93 @@
|
|
2
2
|
Helper tools for work with docker and consul
|
3
3
|
|
4
4
|
[![Build Status](https://travis-ci.com/RnD-Soft/docker_toolkit.svg?branch=master)](https://travis-ci.com/RnD-Soft/docker_toolkit) [![Gem Version](https://badge.fury.io/rb/docker_toolkit.svg)](https://badge.fury.io/rb/docker_toolkit)
|
5
|
+
|
6
|
+
## Scripts
|
7
|
+
|
8
|
+
Some useful scripts to run inside or outside container
|
9
|
+
|
10
|
+
### waiter.rb
|
11
|
+
|
12
|
+
waiter.rb allows to wait many conditions:
|
13
|
+
|
14
|
+
* tcp port opening
|
15
|
+
* PostgreSQL database creation
|
16
|
+
* PostgreSQL table creation
|
17
|
+
* file creation
|
18
|
+
* healthy Consul service
|
19
|
+
|
20
|
+
```
|
21
|
+
Usage: waiter.rb [options] -- exec
|
22
|
+
--tcp host:port Wait for tcp accepts on host:port
|
23
|
+
--db dbname Wait for PG database exists. Using --tcp to conenct PG
|
24
|
+
--tb tablename Wait for PG table exists. Using --tcp to conenct PG
|
25
|
+
-f, --file filename Wait for file exists.
|
26
|
+
--consul-addr addr=http://localhost:8500
|
27
|
+
HTTP addres to connect to consul
|
28
|
+
--consul Wait for local consul agent to be ready
|
29
|
+
--consul-service service Wait for service appear in consul
|
30
|
+
--user user username
|
31
|
+
--pass pass password
|
32
|
+
-t, --timeout secs=15 Total timeout
|
33
|
+
-i, --interval secs=2 Interval between attempts
|
34
|
+
-q, --quiet Do not output any status messages
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
### consul.rb
|
39
|
+
|
40
|
+
Helper to use Consul in 12Factor application. Inspired by https://github.com/hashicorp/envconsul:
|
41
|
+
|
42
|
+
* export Consul key/value as environment variables
|
43
|
+
* references in Consul key/value store
|
44
|
+
* read config file and store values in Consul
|
45
|
+
* read files and store it in Consul key/value store
|
46
|
+
|
47
|
+
```
|
48
|
+
Usage: consul.rb [options] -- exec
|
49
|
+
--consul url Set up a custom Consul URL
|
50
|
+
--token token Connect into consul with custom access token (ACL)
|
51
|
+
--init [service] Initialize Consul services from config
|
52
|
+
--config file Read service configulation from file
|
53
|
+
--upload Upload files to variables
|
54
|
+
--show [service] Show service configulation from Consul
|
55
|
+
--override override existed keys
|
56
|
+
-d, --dereference dereference consul values in form of "consul://key/subkey"
|
57
|
+
--env prefix export KV values from prefix as env varaibles
|
58
|
+
--export add export to --env output
|
59
|
+
--pristine not include the parent processes' environment when exec child process
|
60
|
+
--put path:value put value to path
|
61
|
+
--get path get value from
|
62
|
+
```
|
63
|
+
|
64
|
+
Example config.yml:
|
65
|
+
```yaml
|
66
|
+
.dbconfig: &dbconfig
|
67
|
+
DATABASE_HOST:
|
68
|
+
value: db
|
69
|
+
DATABASE_NAME:
|
70
|
+
value: dbname
|
71
|
+
|
72
|
+
srv1: &srv1
|
73
|
+
<<: [*dbconfig]
|
74
|
+
LOG_LEVEL:
|
75
|
+
value: debug
|
76
|
+
CA_CERT:
|
77
|
+
file: /tmp/ca/cacert.pem
|
78
|
+
CLIENT_CERT:
|
79
|
+
value: consul://services/ca/private/cert.pem
|
80
|
+
CLIENT_KEY:
|
81
|
+
value: consul://services/ca/private/key.pem
|
82
|
+
|
83
|
+
srv2:
|
84
|
+
<<: *srv1
|
85
|
+
CA_CERT:
|
86
|
+
value: consul://services/env/srv1/ca_cert
|
87
|
+
```
|
88
|
+
|
89
|
+
### merger.rb
|
90
|
+
|
91
|
+
Merge docker-compose file of any version. Allow inheritance and extending services.
|
92
|
+
```bash
|
93
|
+
COMPOSE_FILE=file1.yml:file2.yml merger.rb > /tmp/result.yml
|
94
|
+
```
|
@@ -37,8 +37,8 @@ module DockerToolkit
|
|
37
37
|
env[key]
|
38
38
|
end
|
39
39
|
|
40
|
-
def envsubst
|
41
|
-
paths = paths.flatten.map{|c| c.to_s.strip}.reject(&:empty?)
|
40
|
+
def envsubst(*paths)
|
41
|
+
paths = paths.flatten.map{|c| c.to_s.strip }.reject(&:empty?)
|
42
42
|
paths.each do |path|
|
43
43
|
Dir.glob("#{path}/**/*.in") do |templ|
|
44
44
|
output = templ.sub(/\.in$/, '')
|
@@ -48,9 +48,9 @@ module DockerToolkit
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def envsubst_file
|
51
|
+
def envsubst_file(templ, output = nil)
|
52
52
|
output ||= templ.sub(/\.in$/, '')
|
53
|
-
die(
|
53
|
+
die('filename must ends with .in or output must be provided') if output.strip == templ.strip
|
54
54
|
cmd = "cat '#{templ}' | envsubst > '#{output}'"
|
55
55
|
system(cmd) || die("envsubst failed: #{cmd}")
|
56
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Godko Ivan
|
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
version: '0'
|
162
162
|
requirements: []
|
163
163
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.7.
|
164
|
+
rubygems_version: 2.7.7
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
167
|
summary: Helper scripts for work with docker and consul
|