swarm_cluster_cli_ope 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +4 -4
- data/README.md +2 -0
- data/lib/swarm_cluster_cli_ope/kubernetes/pod.rb +3 -2
- data/lib/swarm_cluster_cli_ope/kubernetes/sync_configs/rsync.rb +16 -14
- data/lib/swarm_cluster_cli_ope/stack_sync_concern.rb +13 -1
- data/lib/swarm_cluster_cli_ope/version.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: 073c69aa2b2317c5c8148497cbe718c6a48f32e574f94fd98c686d8bf9645235
|
4
|
+
data.tar.gz: f37f6a1e5c9206262d0b38eaaff4583f4db31991e7715203424077b7a583c418
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84863ff0ac40ba91ab79b191558a501aed8d709b63109310791d3475909ac4571f1bb45afbb2b0a3ede1875de2d67699e672d4d9d2f6282b7d6a0acdb39cb45c
|
7
|
+
data.tar.gz: 50af6cdd12aae5210bdb98bf96face8b61f532c89adac2b1581e9b35e356e6ada191f2614f6a26ef4a5bcc6c0842ab1c2f43bae5c5cc7028f795cbbde8ce8059
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
swarm_cluster_cli_ope (0.
|
4
|
+
swarm_cluster_cli_ope (0.7)
|
5
5
|
activesupport
|
6
6
|
open4
|
7
7
|
thor (~> 1.0)
|
@@ -10,14 +10,14 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (6.1.
|
13
|
+
activesupport (6.1.4.1)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
17
17
|
tzinfo (~> 2.0)
|
18
18
|
zeitwerk (~> 2.3)
|
19
|
-
concurrent-ruby (1.1.
|
20
|
-
i18n (1.8.
|
19
|
+
concurrent-ruby (1.1.9)
|
20
|
+
i18n (1.8.10)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
22
|
minitest (5.14.4)
|
23
23
|
open4 (1.3.4)
|
data/README.md
CHANGED
@@ -231,6 +231,8 @@ docker-compose -f test_folder/test_k8s/docker-compose-local.yml up -d
|
|
231
231
|
```
|
232
232
|
|
233
233
|
|
234
|
+
## Release
|
235
|
+
|
234
236
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version
|
235
237
|
number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git
|
236
238
|
commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
@@ -31,8 +31,9 @@ module SwarmClusterCliOpe
|
|
31
31
|
|
32
32
|
# @param [String,Array<String>] cmd -> comando da passare a kubectl exec -- CMD
|
33
33
|
# @return [SwarmClusterCliOpe::ShellCommandResponse]
|
34
|
-
|
35
|
-
|
34
|
+
# @param [FalseClass] allow_failure -> parametro per lasciar fallire o meno il comando senza bloccarsi e poi gestirlo
|
35
|
+
def exec(cmd, allow_failure: false)
|
36
|
+
base_cmd(["exec", name, "--", cmd].flatten).execute(allow_failure: allow_failure)
|
36
37
|
end
|
37
38
|
|
38
39
|
##
|
@@ -45,22 +45,24 @@ module SwarmClusterCliOpe
|
|
45
45
|
|
46
46
|
# controllo presenza comandi necessari
|
47
47
|
command_installed = false
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
install_rsync = false
|
49
|
+
install_psmisc = false
|
50
|
+
if container.exec(['sh -c "command -v apt"'], allow_failure: true).success?
|
51
|
+
puts "Container Ubuntu"
|
52
|
+
install_rsync = container.exec(['sh -c "command -v rsync || apt update && apt install -yq rsync "'], allow_failure: true).success?
|
53
|
+
install_psmisc = container.exec(['sh -c "command -v killall || apt update && apt install -yq psmisc"'], allow_failure: true).success?
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
if container.exec(['sh -c "command -v apk"'], allow_failure: true).success?
|
57
|
+
puts "Container Alpine"
|
58
|
+
install_rsync = container.exec(['sh -c "command -v rsync || apk add rsync"'], allow_failure: true).success?
|
59
|
+
install_psmisc = true
|
60
|
+
end
|
61
|
+
|
62
|
+
if install_rsync and install_psmisc
|
63
|
+
command_installed = true
|
64
|
+
else
|
65
|
+
puts "Problemi nell'installazione di rsync nel pod"
|
64
66
|
end
|
65
67
|
|
66
68
|
if command_installed
|
@@ -66,7 +66,19 @@ module SwarmClusterCliOpe
|
|
66
66
|
- pg_user: "postgres" -> valore in chiaro, in sostituzione della variabile ambiente, DEFAULT: postgres
|
67
67
|
- database_name_env: "POSTGRES_DB" -> variabile ambiente interna al servizio contenente NOME DB, DEFAULT: POSTGRES_DB
|
68
68
|
- database_name: "nome_db" -> valore in chiaro, in sostituzione della variabile ambiente
|
69
|
-
|
69
|
+
mongo:
|
70
|
+
-- local: -> hash di configurazioni per il DB locale
|
71
|
+
- service: "db" -> nome del servizio nel compose locale, DEFAULT: quello definito sopra
|
72
|
+
- password: "" -> password per DB
|
73
|
+
- username: "" -> username per DB
|
74
|
+
- database_name: "nome_db" -> nome del DB
|
75
|
+
- exclude_from_sync: "coll1,coll2" -> elenco di collections di cui non eseguire il dump quando facciamo PUSH, DEFAULT: ''
|
76
|
+
-- remote: -> hash di configurazioni per il DB remoto
|
77
|
+
- service: "db" -> nome del servizio nel compose locale, DEFAULT: quello definito sopra
|
78
|
+
- password: "" -> password per DB
|
79
|
+
- username: "" -> username per DB
|
80
|
+
- database_name: "nome_db" -> nome del DB
|
81
|
+
- exclude_from_sync: "coll1,coll2" -> elenco di collections di cui non eseguire il dump quando facciamo PULL, DEFAULT: ''
|
70
82
|
|
71
83
|
EXAMPLE:
|
72
84
|
Esempio di sincronizzazione di un file sqlite3 e una cartella
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swarm_cluster_cli_ope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marino Bonetti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|