You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-2Lines changed: 45 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
## Usage
4
4
5
+
Please check [Releases](https://github.com/codefresh-io/index-alignment/releases) for the relevant version. Version suffix match the corresponding on-premise version, ie this tool `v1.0.2-2.8` is for Codefresh On-prem `v2.8`.
6
+
5
7
```shell
6
8
docker run quay.io/codefresh/index-alignment:<version> --help
7
9
```
@@ -19,7 +21,21 @@ Commands:
19
21
help [command] display help for command
20
22
```
21
23
24
+
### TLS
25
+
26
+
To use, TLS certificates must be mounted into the container. Please read the help for the corresponding command to learn more about the available TLS flags.
22
27
28
+
```shell
29
+
docker run \
30
+
--volume </host/path/to/cert.pem>:/tmp/cert.pem \
31
+
--volume </host/path/to/ca.pem>:/tmp/ca.pem \
32
+
quay.io/codefresh/index-alignment:<version> \
33
+
stats \
34
+
--tls \
35
+
--tlsCertificateKeyFile="/tmp/cert.pem" \
36
+
--tlsCAFile="/tmp/ca.pem" \
37
+
--uri=<mongo-uri>
38
+
```
23
39
24
40
### Commands
25
41
@@ -38,6 +54,15 @@ We recommend redirecting the output of `compare` command to JSON file.
--tls Use TLS for the connection. If you are using a self-signed certificate,
58
+
you may also need to specify "--tlsCAFile" and/or
59
+
"--tlsCertificateKeyFile" (default: false)
60
+
--tlsInsecure Allow insecure TLS connections (do not validate CA) (default: false)
61
+
--tlsCAFile <path> Specifies the location of a local .pem file that contains the root
62
+
certificate chain from the Certificate Authority. This file is used to
63
+
validate the certificate presented by the mongod/mongos instance
64
+
--tlsCertificateKeyFile <path> Specifies the location of a local .pem file that contains either the
65
+
client's TLS/SSL certificate and key
41
66
-m --db-map [dump-db-name=target-db-name...] Map the databases in the dump with the target databases. We have our own naming convention for the production databases, but it is up to the customers to name their databases (default: ["google_production=codefresh","chart-manager=charts-manager","kubernetes-monitor=k8s-monitor"])
42
67
-h, --help display help for command
43
68
```
@@ -73,8 +98,17 @@ We recommend redirecting the output of `stats` command to JSON file.
73
98
74
99
```
75
100
Options:
76
-
-u, --uri <uri> MongoDB URI
77
-
-h, --help display help for command
101
+
-u, --uri <uri> MongoDB URI
102
+
--tls Use TLS for the connection. If you are using a self-signed certificate,
103
+
you may also need to specify "--tlsCAFile" and/or
104
+
"--tlsCertificateKeyFile" (default: false)
105
+
--tlsInsecure Allow insecure TLS connections (do not validate CA) (default: false)
106
+
--tlsCAFile <path> Specifies the location of a local .pem file that contains the root
107
+
certificate chain from the Certificate Authority. This file is used to
108
+
validate the certificate presented by the mongod/mongos instance
109
+
--tlsCertificateKeyFile <path> Specifies the location of a local .pem file that contains either the
110
+
client's TLS/SSL certificate and key
111
+
-h, --help display help for command
78
112
```
79
113
80
114
Example:
@@ -97,6 +131,15 @@ Sync indexes from a recommended dump with a target MongoDB instance. The command
--tls Use TLS for the connection. If you are using a self-signed certificate,
135
+
you may also need to specify "--tlsCAFile" and/or
136
+
"--tlsCertificateKeyFile" (default: false)
137
+
--tlsInsecure Allow insecure TLS connections (do not validate CA) (default: false)
138
+
--tlsCAFile <path> Specifies the location of a local .pem file that contains the root
139
+
certificate chain from the Certificate Authority. This file is used to
140
+
validate the certificate presented by the mongod/mongos instance
141
+
--tlsCertificateKeyFile <path> Specifies the location of a local .pem file that contains either the
142
+
client's TLS/SSL certificate and key
100
143
-f --force Create indexes even on heavily populated collections, which may take a while
101
144
-m --db-map [dump-db-name=target-db-name...] Map the databases in the dump with the target databases. We have our own naming convention for the production databases, but it is up to the customers to name their databases (default: ["google_production=codefresh","chart-manager=charts-manager","kubernetes-monitor=k8s-monitor"])
logger.stderr(`Dumping all indexes to "${dumpDirPath}". Hidden indexes will be ignored. Only databases and collections with authorized access will be dumped.`);
Copy file name to clipboardExpand all lines: src/index.ts
+73-1Lines changed: 73 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -10,19 +10,73 @@ program
10
10
.description('[Internal] Dump all indexes from a MongoDB instance')
11
11
.requiredOption('-p, --path <path>','Path to index dump')
12
12
.requiredOption('-u, --uri <uri>','MongoDB URI')
13
+
.option(
14
+
'--tls',
15
+
`Use TLS for the connection. If you are using a self-signed certificate, you may also need to specify "--tlsCAFile" and/or "--tlsCertificateKeyFile"`,
16
+
false,
17
+
)
18
+
.option(
19
+
'--tlsInsecure',
20
+
'Allow insecure TLS connections (do not validate CA)',
21
+
false,
22
+
)
23
+
.option(
24
+
'--tlsCAFile <path>',
25
+
'Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority. This file is used to validate the certificate presented by the mongod/mongos instance',
26
+
)
27
+
.option(
28
+
'--tlsCertificateKeyFile <path>',
29
+
`Specifies the location of a local .pem file that contains either the client's TLS/SSL certificate and key`,
30
+
)
13
31
.action(dumpAllIndexes);
14
32
15
33
program
16
34
.command('stats')
17
35
.description('Get stats for all collections from a MongoDB instance')
18
36
.requiredOption('-u, --uri <uri>','MongoDB URI')
37
+
.option(
38
+
'--tls',
39
+
`Use TLS for the connection. If you are using a self-signed certificate, you may also need to specify "--tlsCAFile" and/or "--tlsCertificateKeyFile"`,
40
+
false,
41
+
)
42
+
.option(
43
+
'--tlsInsecure',
44
+
'Allow insecure TLS connections (do not validate CA)',
45
+
false,
46
+
)
47
+
.option(
48
+
'--tlsCAFile <path>',
49
+
'Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority. This file is used to validate the certificate presented by the mongod/mongos instance',
50
+
)
51
+
.option(
52
+
'--tlsCertificateKeyFile <path>',
53
+
`Specifies the location of a local .pem file that contains either the client's TLS/SSL certificate and key`,
54
+
)
19
55
.action(stats);
20
56
21
57
program
22
58
.command('compare')
23
59
.description('Compare indexes from a target MongoDB instance with a recommended dump')
`Use TLS for the connection. If you are using a self-signed certificate, you may also need to specify "--tlsCAFile" and/or "--tlsCertificateKeyFile"`,
65
+
false,
66
+
)
67
+
.option(
68
+
'--tlsInsecure',
69
+
'Allow insecure TLS connections (do not validate CA)',
70
+
false,
71
+
)
72
+
.option(
73
+
'--tlsCAFile <path>',
74
+
'Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority. This file is used to validate the certificate presented by the mongod/mongos instance',
75
+
)
76
+
.option(
77
+
'--tlsCertificateKeyFile <path>',
78
+
`Specifies the location of a local .pem file that contains either the client's TLS/SSL certificate and key`,
79
+
)
26
80
.option(
27
81
'-m --db-map [dump-db-name=target-db-name...]',
28
82
'Map the databases in the dump with the target databases. We have our own naming convention for the production databases, but it is up to the customers to name their databases',
@@ -32,9 +86,27 @@ program
32
86
33
87
program
34
88
.command('sync')
35
-
.description('Sync indexes from a recommended dump with a target MongoDB instance. The command will fail if it is required to create indexes on heavily populated collections and the `--force` flag has not been specified')
89
+
.description('[ ⚠️ Warning! Do not run this command against production. ] Sync indexes from a recommended dump with a target MongoDB instance. The command will fail if it is required to create indexes on heavily populated collections and the `--force` flag has not been specified')
`Use TLS for the connection. If you are using a self-signed certificate, you may also need to specify "--tlsCAFile" and/or "--tlsCertificateKeyFile"`,
95
+
false,
96
+
)
97
+
.option(
98
+
'--tlsInsecure',
99
+
'Allow insecure TLS connections (do not validate CA)',
100
+
false,
101
+
)
102
+
.option(
103
+
'--tlsCAFile <path>',
104
+
'Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority. This file is used to validate the certificate presented by the mongod/mongos instance',
105
+
)
106
+
.option(
107
+
'--tlsCertificateKeyFile <path>',
108
+
`Specifies the location of a local .pem file that contains either the client's TLS/SSL certificate and key`,
109
+
)
38
110
.option('-f --force','Create indexes even on heavily populated collections, which may take a while')
0 commit comments