{"id":31646058,"url":"https://github.com/codefresh-io/index-alignment","last_synced_at":"2026-03-10T20:02:44.123Z","repository":{"id":315459937,"uuid":"926114856","full_name":"codefresh-io/index-alignment","owner":"codefresh-io","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-11T09:06:44.000Z","size":179,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-13T08:05:54.895Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codefresh-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-02T15:37:54.000Z","updated_at":"2025-12-19T13:00:55.000Z","dependencies_parsed_at":"2025-12-19T02:04:36.573Z","dependency_job_id":null,"html_url":"https://github.com/codefresh-io/index-alignment","commit_stats":null,"previous_names":["codefresh-io/index-alignment"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/codefresh-io/index-alignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefresh-io%2Findex-alignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefresh-io%2Findex-alignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefresh-io%2Findex-alignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefresh-io%2Findex-alignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codefresh-io","download_url":"https://codeload.github.com/codefresh-io/index-alignment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefresh-io%2Findex-alignment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30351761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-07T05:19:37.888Z","updated_at":"2026-03-10T20:02:44.097Z","avatar_url":"https://github.com/codefresh-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codefresh index alignment\n\n## Usage\n\nPlease check [Releases](https://github.com/codefresh-io/index-alignment/releases) for the latest available version.\n\n```shell\ndocker run quay.io/codefresh/index-alignment:\u003cversion\u003e --help\n```\n```\nOptions:\n  -h, --help         display help for command\n\nCommands:\n  dump [options]     [Internal] Dump all indexes from a MongoDB instance\n  stats [options]    Get stats for all collections from a MongoDB instance\n  compare [options]  Compare indexes from a target MongoDB instance with a recommended dump\n  sync [options]     Sync indexes from a recommended dump with a target MongoDB instance. The command\n                     will fail if it is required to create indexes on heavily populated collections and\n                     the `--force` flag has not been specified\n  help [command]     display help for command\n```\n\n### TLS\n\nTo 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.\n\n```shell\ndocker run \\\n  --volume \u003c/host/path/to/cert.pem\u003e:/tmp/cert.pem \\\n  --volume \u003c/host/path/to/ca.pem\u003e:/tmp/ca.pem \\\n  quay.io/codefresh/index-alignment:\u003cversion\u003e \\\n  stats \\\n  --tls \\\n  --tlsCertificateKeyFile=\"/tmp/cert.pem\" \\\n  --tlsCAFile=\"/tmp/ca.pem\" \\\n  --uri=\u003cmongo-uri\u003e\n```\n\n### Commands\n\n## `dump`\n\nDump all indexes from a MongoDB instance.\n\n```\nOptions:\n  -p, --path \u003cpath\u003e                           Path to store index dump\n  -u, --uri \u003curi\u003e                             MongoDB URI\n  -v, --version \u003cversion\u003e                     On-prem version: 2.8 | 2.9\n  --tls                                       Use TLS for the connection. If you are using a self-signed certificate, you may also\n                                              need to specify \"--tlsCAFile\" and/or \"--tlsCertificateKeyFile\" (default: false)\n  --tlsInsecure                               Allow insecure TLS connections (do not validate CA) (default: false)\n  --tlsCAFile \u003cpath\u003e                          Specifies the location of a local .pem file that contains the root certificate chain\n                                              from the Certificate Authority. This file is used to validate the certificate\n                                              presented by the mongod/mongos instance\n  --tlsCertificateKeyFile \u003cpath\u003e              Specifies the location of a local .pem file that contains either the client's TLS/SSL\n                                              certificate and key\n  --tlsCertificateKeyFilePassword \u003cpassword\u003e  Specifies the password to de-crypt the tlsCertificateKeyFile\n  -h, --help                                  display help for command\n```\n\n## `compare`\n\nCompare indexes from a target MongoDB instance with a recommended dump.\n\nAll logs are written to the STDERR stream, so they can be easily separated from the actual output, which is written to STDOUT.\n\nWe recommend redirecting the output of `compare` command to JSON file.\n\n\u003e [!IMPORTANT]\n\u003e The credentials under which the command is run must have read access to all databases controlled by Codefresh.\n\n```\nOptions:\n  -p, --product \u003cproduct\u003e                       Codefresh product: classic | gitops\n  -u, --uri \u003curi\u003e                               MongoDB URI\n  -v, --version \u003cversion\u003e                       On-prem version: 2.8 | 2.9\n  --tls                                         Use TLS for the connection. If you are using a self-signed certificate,\n                                                you may also need to specify \"--tlsCAFile\" and/or\n                                                \"--tlsCertificateKeyFile\" (default: false)\n  --tlsInsecure                                 Allow insecure TLS connections (do not validate CA) (default: false)\n  --tlsCAFile \u003cpath\u003e                            Specifies the location of a local .pem file that contains the root\n                                                certificate chain from the Certificate Authority. This file is used to\n                                                validate the certificate presented by the mongod/mongos instance\n  --tlsCertificateKeyFile \u003cpath\u003e                Specifies the location of a local .pem file that contains either the\n                                                client's TLS/SSL certificate and key\n  --tlsCertificateKeyFilePassword \u003cpassword\u003e    Specifies the password to de-crypt the tlsCertificateKeyFile\n  -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\"])\n  -h, --help                                    display help for command\n```\n\nExample:\n\n```shell\ndocker run quay.io/codefresh/index-alignment:\u003cversion\u003e compare --product \"classic\" --uri \"\u003cdb-uri\u003e\" \u003e classic-diff.json\n\ndocker run quay.io/codefresh/index-alignment:\u003cversion\u003e compare --product \"gitops\" --uri \"\u003cdb-uri\u003e\" \u003e gitops-diff.json\n```\n\n## `stats`\n\nGet stats for all collections from a MongoDB instance. Following commands will be executed:\n\n* `dbStats` command ([doc](https://www.mongodb.com/docs/v5.0/reference/command/dbStats/));\n\n* `$collStats` aggregation ([doc](https://www.mongodb.com/docs/v5.0/reference/operator/aggregation/collStats/));\n\n* `$indexStats` aggregation ([doc](https://www.mongodb.com/docs/v5.0/reference/operator/aggregation/indexStats/));\n\n* `$planCacheStats` aggregation ([doc](https://www.mongodb.com/docs/v5.0/reference/operator/aggregation/plancachestats/));\n\n* queries `_id` of the oldest doc in each collection.\n\n\u003e [!IMPORTANT]\n\u003e The credentials under which the command is run must have permissions to execute the commands specified above.\n\nAll logs are written to the STDERR stream, so they can be easily separated from the actual output, which is written to STDOUT.\n\nWe recommend redirecting the output of `stats` command to JSON file.\n\n```\nOptions:\n  -u, --uri \u003curi\u003e                               MongoDB URI\n  --tls                                         Use TLS for the connection. If you are using a self-signed certificate,\n                                                you may also need to specify \"--tlsCAFile\" and/or\n                                                \"--tlsCertificateKeyFile\" (default: false)\n  --tlsInsecure                                 Allow insecure TLS connections (do not validate CA) (default: false)\n  --tlsCAFile \u003cpath\u003e                            Specifies the location of a local .pem file that contains the root\n                                                certificate chain from the Certificate Authority. This file is used to\n                                                validate the certificate presented by the mongod/mongos instance\n  --tlsCertificateKeyFile \u003cpath\u003e                Specifies the location of a local .pem file that contains either the\n                                                client's TLS/SSL certificate and key\n  --tlsCertificateKeyFilePassword \u003cpassword\u003e    Specifies the password to de-crypt the tlsCertificateKeyFile\n  -h, --help                                    display help for command\n```\n\nExample:\n\n```shell\ndocker run quay.io/codefresh/index-alignment:\u003cversion\u003e stats --uri \"\u003cdb-uri\u003e\" \u003e db-stats.json\n```\n\n## `sync`\n\n\u003e [!CAUTION]\n\u003e This command changes indexes in the target DB, which may have performance impact.\n\u003e\n\u003e We strongly advice to NOT use this command against production DB because of possible performance impact. Instead, use `compare` command to get the diff, then consider eliminating index diff manually during maintainance window.\n\n\nSync 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\n\n```\nOptions:\n  -p, --product \u003cproduct\u003e                       Codefresh product: classic | gitops\n  -u, --uri \u003curi\u003e                               MongoDB URI\n  -v, --version \u003cversion\u003e                       On-prem version: 2.8 | 2.9\n  --tls                                         Use TLS for the connection. If you are using a self-signed certificate,\n                                                you may also need to specify \"--tlsCAFile\" and/or\n                                                \"--tlsCertificateKeyFile\" (default: false)\n  --tlsInsecure                                 Allow insecure TLS connections (do not validate CA) (default: false)\n  --tlsCAFile \u003cpath\u003e                            Specifies the location of a local .pem file that contains the root\n                                                certificate chain from the Certificate Authority. This file is used to\n                                                validate the certificate presented by the mongod/mongos instance\n  --tlsCertificateKeyFile \u003cpath\u003e                Specifies the location of a local .pem file that contains either the\n                                                client's TLS/SSL certificate and key\n  --tlsCertificateKeyFilePassword \u003cpassword\u003e    Specifies the password to de-crypt the tlsCertificateKeyFile\n  -f --force                                    Create indexes even on heavily populated collections, which may take a while\n  -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\"])\n  -h, --help                                    display help for command\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefresh-io%2Findex-alignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodefresh-io%2Findex-alignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefresh-io%2Findex-alignment/lists"}