capistrano-nomad 0.9.0 → 0.9.2
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/Gemfile.lock +1 -1
- data/README.md +11 -13
- data/capistrano-nomad.gemspec +1 -1
- data/lib/capistrano/nomad/helpers/dsl.rb +7 -0
- data/lib/capistrano/nomad/helpers/nomad.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '064875b4478852c18387c8084ff4b0e5c2cb4e9377a6854724f46119b416ecf5'
|
4
|
+
data.tar.gz: 15069bfd33db0a2b497a7e6a1adf816669df6ba0b508364fb8a26728e46ae329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eff94039fa9b7c506fbe139670639d326423c409813c4a10c97c15e79256f4bc5f65a181a2d8608af9bdd0aa51aeaeb999ad27e02836b2af8815b961999f8470
|
7
|
+
data.tar.gz: 255c76c93ba40a4fd35206b31d511a7a42e2954c4e4f072154effe68643e66a938fd0aacd3f029e7e5cfa37f13f82cb924606ab4bc2fc61be92234c5e3d7428d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -102,11 +102,14 @@ nomad_job :backend, docker_image_types: [:backend], var_files: [:rails]
|
|
102
102
|
nomad_job :frontend
|
103
103
|
nomad_job :postgres, docker_image_types: [:postgres]
|
104
104
|
nomad_job :redis, docker_image_types: [:redis], tags: [:redis]
|
105
|
-
nomad_job :"traefik-default", template: :
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
105
|
+
nomad_job :"traefik-default", template: :admin,
|
106
|
+
erb_vars: { role: :default },
|
107
|
+
tags: [:traefik]
|
108
|
+
nomad_job :"traefik-secondary", template: :admin,
|
109
|
+
erb_vars: { role: :secondary },
|
110
|
+
tags: [:traefik]
|
111
|
+
|
112
|
+
nomad_namespace :analytics, tags: [:admin] do
|
110
113
|
nomad_job :grafana
|
111
114
|
end
|
112
115
|
|
@@ -131,20 +134,15 @@ cap production nomad:analytics:grafana:restart
|
|
131
134
|
cap production nomad:postgres:status
|
132
135
|
```
|
133
136
|
|
134
|
-
|
137
|
+
Tasks can go by namespace or `all` namespaces, and can also be filtered by tags
|
135
138
|
|
136
139
|
```shell
|
137
140
|
cap production nomad:analytics:deploy
|
138
141
|
cap production nomad:analytics:upload_run
|
139
142
|
cap production nomad:all:deploy
|
143
|
+
cap production nomad:all:deploy TAG=admin
|
140
144
|
cap production nomad:all:upload_run
|
141
|
-
|
142
|
-
|
143
|
-
Filter by tags
|
144
|
-
|
145
|
-
```shell
|
146
|
-
cap production nomad:all:deploy tag=traefik
|
147
|
-
cap production nomad:all:upload_run tags=traefik,redis
|
145
|
+
cap production nomad:all:upload_run TAGS=admin,redis
|
148
146
|
```
|
149
147
|
|
150
148
|
Open console
|
data/capistrano-nomad.gemspec
CHANGED
@@ -36,6 +36,13 @@ def nomad_namespace(namespace, **options, &block)
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def nomad_job(name, attributes = {})
|
39
|
+
attributes[:tags] ||= []
|
40
|
+
|
41
|
+
# Tags added to namespace should be added to all jobs within
|
42
|
+
if (nomad_namespace_options = capistrano_nomad_fetch_namespace_options(@nomad_namespace))
|
43
|
+
attributes[:tags] += nomad_namespace_options[:tags] || []
|
44
|
+
end
|
45
|
+
|
39
46
|
nomad_jobs = fetch(:nomad_jobs) || Hash.new { |h, n| h[n] = {} }
|
40
47
|
nomad_jobs[@nomad_namespace][name] = attributes
|
41
48
|
|
@@ -243,7 +243,7 @@ def capistrano_nomad_upload(local_path:, remote_path:, erb_vars: {})
|
|
243
243
|
end
|
244
244
|
|
245
245
|
def capistrano_nomad_fetch_namespace_options(namespace)
|
246
|
-
fetch(:nomad_namespaces)
|
246
|
+
fetch(:nomad_namespaces)&.dig(namespace)
|
247
247
|
end
|
248
248
|
|
249
249
|
def capistrano_nomad_fetch_job_options(name, *args, namespace: nil)
|
@@ -255,9 +255,9 @@ def capistrano_nomad_fetch_job_var_files(name, *args)
|
|
255
255
|
end
|
256
256
|
|
257
257
|
def capistrano_nomad_fetch_jobs_names_by_namespace(namespace: :all)
|
258
|
-
# Can pass tags via command line (e.g.
|
258
|
+
# Can pass tags via command line (e.g. TAG=foo or TAGS=foo,bar)
|
259
259
|
tags =
|
260
|
-
[ENV["
|
260
|
+
[ENV["TAG"], ENV["TAGS"]].map do |tag_args|
|
261
261
|
next unless tag_args.presence
|
262
262
|
|
263
263
|
tag_args.split(",").map(&:presence).compact.map(&:to_sym)
|