{"id":25703431,"url":"https://github.com/dashpay/js-dp-services-ctl","last_synced_at":"2025-04-30T06:46:21.139Z","repository":{"id":47636652,"uuid":"141731150","full_name":"dashpay/js-dp-services-ctl","owner":"dashpay","description":"Control Dash Platform services using JavaScript and Docker","archived":false,"fork":false,"pushed_at":"2023-07-13T05:21:25.000Z","size":811,"stargazers_count":5,"open_issues_count":3,"forks_count":6,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-30T06:46:01.241Z","etag":null,"topics":["drive","platform"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dashpay.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-07-20T15:53:03.000Z","updated_at":"2022-10-19T07:34:56.000Z","dependencies_parsed_at":"2023-07-17T01:30:36.084Z","dependency_job_id":null,"html_url":"https://github.com/dashpay/js-dp-services-ctl","commit_stats":null,"previous_names":["dashevo/js-dp-services-ctl","dashevo/js-evo-services-ctl"],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpay%2Fjs-dp-services-ctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpay%2Fjs-dp-services-ctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpay%2Fjs-dp-services-ctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpay%2Fjs-dp-services-ctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashpay","download_url":"https://codeload.github.com/dashpay/js-dp-services-ctl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658195,"owners_count":21622819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["drive","platform"],"created_at":"2025-02-25T05:29:35.403Z","updated_at":"2025-04-30T06:46:21.119Z","avatar_url":"https://github.com/dashpay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dash Platform services ctl\n\n[![Build Status](https://travis-ci.com/dashevo/js-dp-services-ctl.svg?branch=master)](https://travis-ci.com/dashevo/js-dp-services-ctl)\n[![NPM version](https://img.shields.io/npm/v/@dashevo/dp-services-ctl.svg)](https://npmjs.org/package/@dashevo/dp-services-ctl)\n\n\u003e Control Dash Platform services using JavaScript and Docker\n\nThe tool provides a convenient JavaScript interface for configuration and interaction with Dash Platform services. Services are started in Docker containers.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Available DP services](#available-dp-services)\n    - [Services configuration](#services-configuration)\n    - [Integration with Mocha](#integration-with-mocha)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\n1. [Install Docker](https://docs.docker.com/install/)\n2. Install NPM package:\n\n    ```sh\n    npm install @dashevo/dp-services-ctl\n    ```\n\n## Usage\n\n### Available DP services\n\n#### Drive\n\n[Drive](https://github.com/dashevo/drive) service starts a bunch of related services:\n- DriveAbci\n    - [Methods](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/drive/abci/DriveAbci.js)\n    - [Options](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/drive/abci/DriveAbciOptions.js)\n- [MongoDB](#mongodb)\n- [Dash Core](#dash-core)\n\n#### DAPI\n\n[DAPI](https://github.com/dashevo/dapi) service starts all DP services:\n- DAPI Core\n    - [Methods](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/dapi/core/DapiCore.js)\n    - [Options](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/dapi/core/DapiCoreOptions.js)\n- DAPI TxFilterStream\n    - [Methods](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/dapi/txFilterStream/DapiTxFilterStream.js)\n    - [Options](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/dapi/txFilterStream/DapiTxFilterStreamOptions.js)\n- [Drive](#drive)\n- [MongoDB](#mongodb)\n- [DashCore](#dash-core)\n- [Insight](#insight)\n- [Tendermint Core](#tendermint-core)\n\n#### Dash Core\n\n- [Dash Core](https://github.com/dashpay/dash) service\n    - [Methods](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/dashCore/DashCore.js)\n    - [Options](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/dashCore/DashCoreOptions.js)\n\n#### Tendermint Core\n\n- [Tendermint Core](https://tendermint.com) service\n    - [Methods](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/tendermintCore/TendermintCore.js)\n    - [Options](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/tendermintCore/TendermintCoreOptions.js)\n\n#### Insight API\n\n- [Insight API](https://github.com/dashevo/insight-api) service\n    - [Methods](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/insightApi/InsightApi.js)\n    - [Options](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/insightApi/InsightApiOptions.js)\n\n#### MongoDB\n\n- [MongoDB](https://www.mongodb.com/) service\n    - [Methods](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/mongoDb/MongoDb.js)\n    - [Options](https://github.com/dashevo/js-dp-services-ctl/blob/master/lib/services/mongoDb/MongoDbOptions.js)\n\n### Starting a service\n\n```js\n// Export service(s)\nconst { startMongoDb } = require('@dashevo/dp-services-ctl');\n// This is optional. Default options listed in options class\nconst options = {\n  port: 27017, // mongoDB port\n};\n\n// Start service\nconst mongo = await startMongoDb(options);\n\n// Get mongo client\nconst client = await mongo.getClient();\n\n// Stop mongoDB\nawait mongo.remove();\n```\n\nUse `many` method to start several instances:\n\n```js\nconst { startMongoDb } = require('@dashevo/dp-services-ctl');\n\n// This is optional. Default options listed in options class\nconst options = {\n  port: 27017, // mongoDB port\n};\n\n// Start two services\nconst mongoNodes = await startMongoDb.many(2,options);\n\n// Get peer IDs\nconst [client1, client2] = await Promise.all(\n  mongoNodes.map(mongo =\u003e mongo.getClient()),\n);\n\n// Stop mongoDB nodes\nawait Promise.all(\n  mongoNodes.map(mongo =\u003e mongo.remove()),\n);\n```\n\n### Services configuration\n\nEach service has default options which can be overwritten in three ways:\n1. Pass options as plain JS object to `start[service]` or `create[service]` methods\n2. Pass instance of options class to `start[service]` or `create[service]` methods\n3. Pass default options as plain JS object to `setDefaultCustomOptions` method of options class\n\n### Integration with Mocha\n\nServices [Mocha](https://mochajs.org/) hooks provide automation for your mocha tests:\n- Removing obsolete related Docker containers (`before`)\n- Cleaning a service state between tests (`beforeEach`, `afterEach`)\n- Stopping service after tests (`after`)\n\n```js\n// Export service(s) with mocha hooks\nconst { mocha: { startMongoDb } } = require('@dashevo/dp-services-ctl');\n\ndescribe('Test suite', () =\u003e {\n  let mongoClient;\n\n  startMongoDb().then(mongo =\u003e () =\u003e {\n    mongoClient = mongo.getClient();\n  });\n\n  it('should do something', async () =\u003e {\n    const collection = mongoClient.db('test').collection('syncState');\n    const count = await collection.countDocuments({});\n\n    expect(count).to.equal(0);\n  });\n});\n```\n\n## Maintainers\n\n[@shumkov](https://github.com/shumkov)\n\n[@jawid-h](https://github.com/jawid-h)\n\n[@abvgedeika](https://github.com/abvgedeika)\n\n## Contributing\n\nFeel free to dive in! [Open an issue](https://github.com/dashevo/js-dp-services-ctl/issues/new) or submit PRs.\n\n## License\n\n[MIT](LICENSE) \u0026copy; Dash Core Group, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashpay%2Fjs-dp-services-ctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashpay%2Fjs-dp-services-ctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashpay%2Fjs-dp-services-ctl/lists"}