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 +4 -4
- data/README.md +73 -30
- data/lib/quaker/tag_filter.rb +6 -4
- data/lib/quaker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5506c92adcb440fad16a366dc3b67a70b62e730
|
4
|
+
data.tar.gz: 8d60501e924b944e8ab2a39de9d99b2b3c32f0e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
##
|
16
|
+
## Usage
|
17
17
|
|
18
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
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
|
-
|
75
|
+
In your `infra.yml` file you'll have:
|
50
76
|
|
51
|
-
```
|
52
|
-
|
77
|
+
```yml
|
78
|
+
---
|
79
|
+
redis:
|
80
|
+
image: redis
|
81
|
+
postgres:
|
82
|
+
image: postgres
|
83
|
+
mongo:
|
84
|
+
image: mongo
|
53
85
|
```
|
54
86
|
|
55
|
-
|
87
|
+
In this case you can generate `docker-compose.yml` for only the `backend` services and their dependencies by running:
|
56
88
|
|
57
|
-
|
89
|
+
```sh
|
90
|
+
quaker -t backend
|
91
|
+
```
|
58
92
|
|
59
|
-
|
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
|
-
|
63
|
-
|
102
|
+
|
103
|
+
# Roadmap
|
104
|
+
|
105
|
+
- Support service templates
|
106
|
+
- Automatically feed `docker-compose` with the generated YAML file
|
data/lib/quaker/tag_filter.rb
CHANGED
@@ -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
|
-
|
22
|
+
if is_tagged_service(spec, tags_list)
|
23
|
+
acc[name] = spec
|
23
24
|
|
24
|
-
|
25
|
+
dependencies(services_map, name)
|
26
|
+
.inject(acc){|acc, d| acc.update(d => services_map[d])}
|
27
|
+
end
|
25
28
|
|
26
|
-
|
27
|
-
.inject(acc){|acc, d| acc.update(d => services_map[d])}
|
29
|
+
acc
|
28
30
|
}
|
29
31
|
end
|
30
32
|
end
|
data/lib/quaker/version.rb
CHANGED