swarm_cluster_cli_ope 0.7.2 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +9 -9
- data/README.md +3 -2
- data/lib/swarm_cluster_cli_ope/stack_sync_concern.rb +1 -0
- data/lib/swarm_cluster_cli_ope/sync_configs/mysql.rb +26 -3
- data/lib/swarm_cluster_cli_ope/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f00895cd03d34e2cf7d02fa91afa20a5be260d9f953d0e41b51cec2645775d0e
|
4
|
+
data.tar.gz: '0778a28b40f1babd5a00ac9fd3c1d600e63b8a287294884736c9b5b713e9d3f8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 438bd6491e38336904741c9655c6046e280c4cfb96c63d44b50ee8d299255e589517134d1ff1611fadcdee3854680a09916c612643f07e1e29a894efb0d0b61c
|
7
|
+
data.tar.gz: 5dcad79599174d9b547a2338700600acb321762ffbe2802210aa9a9ccf252e793f1b636da4dd75c34a474bfb0de724843de3012b16849454831fe1006652c7ec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.7.4
|
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.8)
|
5
5
|
activesupport (< 7)
|
6
6
|
open4
|
7
7
|
thor (~> 1.0)
|
@@ -10,22 +10,22 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (6.1.
|
13
|
+
activesupport (6.1.7.3)
|
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.
|
20
|
-
i18n (1.
|
19
|
+
concurrent-ruby (1.2.2)
|
20
|
+
i18n (1.14.1)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
|
-
minitest (5.
|
22
|
+
minitest (5.18.0)
|
23
23
|
open4 (1.3.4)
|
24
24
|
rake (12.3.3)
|
25
|
-
thor (1.2.
|
26
|
-
tzinfo (2.0.
|
25
|
+
thor (1.2.2)
|
26
|
+
tzinfo (2.0.6)
|
27
27
|
concurrent-ruby (~> 1.0)
|
28
|
-
zeitwerk (2.6.
|
28
|
+
zeitwerk (2.6.8)
|
29
29
|
|
30
30
|
PLATFORMS
|
31
31
|
ruby
|
@@ -35,4 +35,4 @@ DEPENDENCIES
|
|
35
35
|
swarm_cluster_cli_ope!
|
36
36
|
|
37
37
|
BUNDLED WITH
|
38
|
-
1.
|
38
|
+
2.1.4
|
data/README.md
CHANGED
@@ -144,6 +144,7 @@ Possibili CFGS per tipologia:
|
|
144
144
|
- mysql_user: "root" -> valore in chiaro, in sostituzione della variabile ambiente, DEFAULT: root
|
145
145
|
- database_name_env: "MYSQL_DATABASE" -> variabile ambiente interna al servizio contenente NOME DB, DEFAULT: MYSQL_DATABASE
|
146
146
|
- database_name: "MYSQL_DATABASE" -> valore in chiaro, in sostituzione della variabile ambiente
|
147
|
+
- excluded_tables_data: [] -> elenco di tabelle di cui non scaricare i dati(solo lo schema), DEFAULT: []
|
147
148
|
- pg:
|
148
149
|
- local: -> hash di configurazioni per il DB locale
|
149
150
|
- service: "db" -> nome del servizio nel compose locale, DEFAULT: quello definito sopra
|
@@ -217,7 +218,7 @@ docker stack deploy -c test_folder/test_2/docker_compose.yml test2
|
|
217
218
|
Per simulare una sincronizzazione fra locale e remoto di un mysql, lanciamo lo stesso stack anche come compose, in modo
|
218
219
|
da trovarci sulla stessa macchina con tutte e due le situazioni
|
219
220
|
```shell script
|
220
|
-
docker
|
221
|
+
docker compose -f test_folder/test_1/docker-compose-local.yml up -d
|
221
222
|
```
|
222
223
|
|
223
224
|
|
@@ -227,7 +228,7 @@ lanciare quindi l'ambiente di test:
|
|
227
228
|
|
228
229
|
```shell script
|
229
230
|
kubectl apply -f test_folder/test_k8s/test.yaml
|
230
|
-
docker
|
231
|
+
docker compose -f test_folder/test_k8s/docker-compose-local.yml up -d
|
231
232
|
```
|
232
233
|
|
233
234
|
|
@@ -49,6 +49,7 @@ module SwarmClusterCliOpe
|
|
49
49
|
- mysql_user: "root" -> valore in chiaro, in sostituzione della variabile ambiente, DEFAULT: root
|
50
50
|
- database_name_env: "MYSQL_DATABASE" -> variabile ambiente interna al servizio contenente NOME DB, DEFAULT: MYSQL_DATABASE
|
51
51
|
- database_name: "MYSQL_DATABASE" -> valore in chiaro, in sostituzione della variabile ambiente
|
52
|
+
- excluded_tables_data: [] -> elenco di tabelle di cui non scaricare i dati(solo lo schema), DEFAULT: []
|
52
53
|
pg:
|
53
54
|
--local: -> hash di configurazioni per il DB locale
|
54
55
|
- service: "db" -> nome del servizio nel compose locale, DEFAULT: quello definito sopra
|
@@ -7,7 +7,23 @@ module SwarmClusterCliOpe
|
|
7
7
|
resume('pull')
|
8
8
|
if yes?("Confermare il comando?[y,yes]")
|
9
9
|
tmp_file = "/tmp/#{Time.now.to_i}.sql.gz"
|
10
|
-
|
10
|
+
|
11
|
+
#--ignore-table=bkw_ecospazio.gps_events
|
12
|
+
remote_authentication = "-u #{remote.username} --password=#{remote.password}"
|
13
|
+
dump_command = "mysqldump #{remote_authentication}"
|
14
|
+
remote.excluded_tables_data.each do |t|
|
15
|
+
dump_command << " --ignore-table=#{remote.database_name}.#{t}"
|
16
|
+
end
|
17
|
+
dump_command << " #{remote.database_name}"
|
18
|
+
dump_command << " > /tmp/export.sql"
|
19
|
+
# eseguiamo il backup dello schema per le tabelle elencate
|
20
|
+
remote.excluded_tables_data.each do |t|
|
21
|
+
dump_command << " &&"
|
22
|
+
dump_command << " mysqldump #{remote_authentication}"
|
23
|
+
dump_command << " --no-data #{remote.database_name} #{t} >> /tmp/export.sql"
|
24
|
+
end
|
25
|
+
|
26
|
+
container.exec("bash -c '#{dump_command} && cat /tmp/export.sql | gzip -c -f' > #{tmp_file}")
|
11
27
|
local_container.copy_in(tmp_file, tmp_file)
|
12
28
|
local_authentication = "-u #{local.username} --password=#{local.password}"
|
13
29
|
|
@@ -24,7 +40,7 @@ module SwarmClusterCliOpe
|
|
24
40
|
|
25
41
|
command << "'"
|
26
42
|
|
27
|
-
local_container.exec(command.join" ")
|
43
|
+
local_container.exec(command.join " ")
|
28
44
|
end
|
29
45
|
true
|
30
46
|
end
|
@@ -41,6 +57,12 @@ module SwarmClusterCliOpe
|
|
41
57
|
true
|
42
58
|
end
|
43
59
|
|
60
|
+
def resume(direction)
|
61
|
+
super
|
62
|
+
|
63
|
+
puts "excluded_tables: #{remote.excluded_tables_data.join(",")}"
|
64
|
+
end
|
65
|
+
|
44
66
|
##
|
45
67
|
# Classe interna che rappresenta le configurazioni del DB
|
46
68
|
class EnvConfigs < BaseDatabase::EnvConfigs
|
@@ -51,8 +73,9 @@ module SwarmClusterCliOpe
|
|
51
73
|
|
52
74
|
define_cfgs :database_version, default_env: "MYSQL_MAJOR", configuration_name: :mysql_version
|
53
75
|
|
54
|
-
|
76
|
+
define_cfgs :excluded_tables_data, default_value: [], configuration_name: :excluded_tables_data
|
55
77
|
|
78
|
+
end
|
56
79
|
|
57
80
|
end
|
58
81
|
end
|
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.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marino Bonetti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
161
|
+
rubygems_version: 3.1.6
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: WIP Gemma per la gestione del cluster swarm
|