quaker 0.2.0 → 0.2.1

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: c6f507ffc151a13c530eb0d710511914c5ebced2
4
- data.tar.gz: 9fbce7e2eb41682c7252bda5ae11c54a53676a32
3
+ metadata.gz: a5506c92adcb440fad16a366dc3b67a70b62e730
4
+ data.tar.gz: 8d60501e924b944e8ab2a39de9d99b2b3c32f0e6
5
5
  SHA512:
6
- metadata.gz: 23f156e7a9a000aa30278fe92454e8e96b3700100df926784ac7310d955602a4e2fa55bc3a0b48363b1d701b47722fd983691e2fd7aae14c90409a54213c068b
7
- data.tar.gz: 98750922a7348e1a2747410821cccefc5187f994b74fbbb5daf25a0e6c70f6a1557a3d6773ac1d1a0515c03de9c338a5e26b41b58cf3934513ecfd4d36552557
6
+ metadata.gz: 3317bdd074ce3cabcb055f981f8367e9f154654919f30b5c2d64353cdce05e90c89b2935307689e2b414cc2bb57dfce18478577e8d7c504991c3e0b7905021ea
7
+ data.tar.gz: 6e3d17d92363c43103278930c07f32a6b40e439f350004455e6a839aa8f0a5b9847977f7729bc1c32ee7e103780b090042366c885f70ede6a52e7c29f6a8d6ec
data/README.md CHANGED
@@ -13,51 +13,94 @@ Extend docker-compose by adding support to:
13
13
  gem install quaker
14
14
  ```
15
15
 
16
- ## Example
16
+ ## Usage
17
17
 
18
- ### Given:
18
+ Suppose, you're developing microservices and want to launch all dependencies
19
+ while working on some service.
20
+
21
+ Quaker can help you by:
22
+
23
+ - Better organizing your docker-compose definitions by adding `include` directive
24
+ - Get rid of hard-coded build paths by automatically resolving service directories using the `git` directive
25
+ - Being able to limit the services you want to run with the `tag` directives
26
+
27
+ ### Directory layout
28
+
29
+ Suppose all your services are located in `~/projects`
30
+
31
+ You'll need the following directory structure to get running:
19
32
 
20
33
  ```
21
- # docker/services/infra.yml
22
- redis:
23
- image: redis
24
- links:
25
- - mongo
26
- mongo:
27
- image: mongo
28
- postgres:
29
- image: postgres
34
+ -projects
35
+ |-| docker
36
+ | |-| services
37
+ | |- all.yml
38
+ |- warehouse_service
39
+ |- web
40
+ |- billing_service
30
41
  ```
31
42
 
32
- ```
33
- # docker/services/all.yml
43
+ Here `backend`, `web` and `background` are cloned git repositories you're working on.
44
+
45
+ You're `all.yml` file might look like:
46
+
47
+ ```yaml
48
+ ---
34
49
  include:
35
50
  - infra.yml
36
- svc1:
37
- depends_on:
38
- - redis
39
- tags:
40
- - svc1
41
- svc2:
42
- depends_on:
51
+ warehouse:
52
+ git: git@github.com:company/warehouse.git
53
+ links:
43
54
  - mongo
44
55
  tags:
45
- - svc2
46
-
56
+ - backend
57
+ - warehouse
58
+ billing:
59
+ git: git@github.com:company/billing.git
60
+ links:
61
+ - postgres
62
+ tags:
63
+ - backend
64
+ - billing
65
+ web:
66
+ git: git@github.com:company/web.git
67
+ links:
68
+ - redis
69
+ tags:
70
+ - warehouse
71
+ - billing
72
+ - ui
47
73
  ```
48
74
 
49
- ### Generating docker-compose file
75
+ In your `infra.yml` file you'll have:
50
76
 
51
- ```
52
- quaker -t svc1
77
+ ```yml
78
+ ---
79
+ redis:
80
+ image: redis
81
+ postgres:
82
+ image: postgres
83
+ mongo:
84
+ image: mongo
53
85
  ```
54
86
 
55
- will generate a docker compose consisting only of `svc1` and `redis`.
87
+ In this case you can generate `docker-compose.yml` for only the `backend` services and their dependencies by running:
56
88
 
57
- `Note:` generated docker-compose will be written to stdout
89
+ ```sh
90
+ quaker -t backend
91
+ ```
58
92
 
59
- ### Using the generated docker-compose.yml
93
+ `Note:` - the generated `docker-compose.yml` will not include the `redis` service as it is
94
+ not a dependency of any service with the `backend` tag, but will include `mongo`
95
+ and `postgres` even if they don't explicitly have the `backend` tag.
60
96
 
97
+ Then you can feed the generated `docker-compose.yml` to docker-compose like this:
98
+
99
+ ```sh
100
+ qaker -t backend | docker-compose -f - up
61
101
  ```
62
- quaker -t svc1 | docker-compose -f - up(/down)
63
- ```
102
+
103
+ # Roadmap
104
+
105
+ - Support service templates
106
+ - Automatically feed `docker-compose` with the generated YAML file
@@ -19,12 +19,14 @@ class TagFilter
19
19
  return services_map if !tags_list || tags_list.empty?
20
20
 
21
21
  services_map.inject({}){|acc, (name, spec)|
22
- return acc unless is_tagged_service(spec, tags_list)
22
+ if is_tagged_service(spec, tags_list)
23
+ acc[name] = spec
23
24
 
24
- acc[name] = spec
25
+ dependencies(services_map, name)
26
+ .inject(acc){|acc, d| acc.update(d => services_map[d])}
27
+ end
25
28
 
26
- dependencies(services_map, name)
27
- .inject(acc){|acc, d| acc.update(d => services_map[d])}
29
+ acc
28
30
  }
29
31
  end
30
32
  end
@@ -1,3 +1,3 @@
1
1
  module Quaker
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Shapiro