capistrano-nomad 0.6.1 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd8143ad35ea4f16a890256e65a5a73fab979acd0e63fa5471e8c75248c5fad8
4
- data.tar.gz: cdf8f7552d3512ea4968208690ec537040915e42a59b51aef4bd8c85c81e95a1
3
+ metadata.gz: 1f13cb3a6f203bc88f1bad802dea89660937818fe4568824fb0f2aa9ed789fab
4
+ data.tar.gz: '09f27219c86a2fe67e2d47a660cabdef3844517954feba31141d4c38fb20d6a5'
5
5
  SHA512:
6
- metadata.gz: 52b3e33004964a0ea317bcd55478d02aa2088ded9c7df715be7119028588b9c3f848e63fd4fa8a85f3345c9e5203579428a71b79c3debfe16e5028b37183d477
7
- data.tar.gz: f972389f3c4411a75162961f0545605ab87c92d6a81d4192db78e457bd320c8a87bccdcf3a61bb9f9e556c6f64d4b99cb3347752113951612edeb89b3fb9d2e4
6
+ metadata.gz: 3cd44e5fb4c6cbd3db75cc22f67ef116d0ece07965c1e20387cebee287bf28de7b09ee9d8cd5d9b0cff29a1bb0ae0a5d16d0deb451cdeb731ddcdd32fbfa0a57
7
+ data.tar.gz: 9759e600f1bc654c9093b5e72606de756bf220271a11ee6a0b8fc770b78f78e638f4557ba6054e57326f4cd5ef4ee05de6183a66f1e0351fc9129bd5bbcf4177
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-nomad (0.6.1)
4
+ capistrano-nomad (0.6.3)
5
5
  activesupport (<= 7.0.8)
6
6
  byebug
7
7
  capistrano (~> 3.0)
data/README.md CHANGED
@@ -60,10 +60,11 @@ nomad_docker_image_type :redis,
60
60
  nomad_job :frontend
61
61
  nomad_job :backend, docker_image_types: [:backend], var_files: [:rails]
62
62
  nomad_job :redis, docker_image_types: [:redis]
63
+ nomad_job :"traefik-default", template: :traefik, erb_vars: { role: :default }
64
+ nomad_job :"traefik-secondary", template: :traefik, erb_vars: { role: :secondary }
63
65
 
64
66
  nomad_namespace :analytics do
65
67
  nomad_job :grafana
66
- nomad_job :"node-exporter"
67
68
  end
68
69
  ```
69
70
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "capistrano-nomad"
5
- spec.version = "0.6.1"
5
+ spec.version = "0.6.3"
6
6
  spec.authors = ["James Hu"]
7
7
 
8
8
  spec.summary = "Capistrano plugin for deploying and managing Nomad jobs"
@@ -58,16 +58,6 @@ def nomad_job(name, attributes = {})
58
58
  capistrano_nomad_rerun_jobs([name], namespace: namespace)
59
59
  end
60
60
 
61
- desc "Purge #{description_name} job"
62
- task :purge do
63
- capistrano_nomad_purge_jobs([name], namespace: namespace, is_detached: false)
64
- end
65
-
66
- desc "Display status of #{description_name} job"
67
- task :status do
68
- capistrano_nomad_display_job_status(name, namespace: namespace)
69
- end
70
-
71
61
  desc "Upload and plan #{description_name} job"
72
62
  task :upload_plan do
73
63
  capistrano_nomad_upload_plan_jobs([name], namespace: namespace)
@@ -90,24 +80,22 @@ def nomad_job(name, attributes = {})
90
80
 
91
81
  desc "Restart #{description_name} job"
92
82
  task :restart do
93
- on(roles(:manager)) do
94
- # We can't restart the job directly so we'll need to fetch all its running allocs and restart each of one
95
- # individually instead
96
- running_alloc_ids_output = capistrano_nomad_capture_nomad_command(
97
- :job,
98
- :allocs,
99
- {
100
- namespace: namespace,
101
- t: "'{{range .}}{{if eq .ClientStatus \"running\"}}{{ println .ID}}{{end}}{{end}}'",
102
- },
103
- name,
104
- )
105
- running_alloc_ids = running_alloc_ids_output.strip.split("\n")
106
-
107
- running_alloc_ids.each do |alloc_id|
108
- capistrano_nomad_execute_nomad_command(:alloc, :restart, alloc_id)
109
- end
110
- end
83
+ capistrano_nomad_restart_jobs([name], namespace: namespace)
84
+ end
85
+
86
+ desc "Stop #{description_name} job"
87
+ task :stop do
88
+ capistrano_nomad_stop_jobs([name], namespace: namespace)
89
+ end
90
+
91
+ desc "Purge #{description_name} job"
92
+ task :purge do
93
+ capistrano_nomad_purge_jobs([name], namespace: namespace, is_detached: false)
94
+ end
95
+
96
+ desc "Display status of #{description_name} job"
97
+ task :status do
98
+ capistrano_nomad_display_job_status(name, namespace: namespace)
111
99
  end
112
100
 
113
101
  desc "Open console to #{description_name} job. Specify task by passing TASK environment variable"
@@ -321,6 +321,18 @@ def capistrano_nomad_deploy_jobs(names, *args)
321
321
  capistrano_nomad_upload_run_jobs(names, *args)
322
322
  end
323
323
 
324
+ def capistrano_nomad_stop_jobs(names, namespace: nil)
325
+ names.each do |name|
326
+ capistrano_nomad_execute_nomad_command(:job, :stop, { namespace: namespace }, name)
327
+ end
328
+ end
329
+
330
+ def capistrano_nomad_restart_jobs(names, namespace: nil)
331
+ names.each do |name|
332
+ capistrano_nomad_execute_nomad_command(:job, :restart, { namespace: namespace }, name)
333
+ end
334
+ end
335
+
324
336
  def capistrano_nomad_purge_jobs(names, namespace: nil, is_detached: true)
325
337
  names.each do |name|
326
338
  capistrano_nomad_execute_nomad_command(:stop, { namespace: namespace, purge: true, detach: is_detached }, name)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-nomad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-30 00:00:00.000000000 Z
11
+ date: 2023-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport