{"id":20038668,"url":"https://github.com/defra/cdp-self-service-ops","last_synced_at":"2026-05-13T09:31:50.102Z","repository":{"id":226240517,"uuid":"639900038","full_name":"DEFRA/cdp-self-service-ops","owner":"DEFRA","description":"Core delivery platform Self Service Ops Node.js Backend.  This Api provides automation for service creation, deployment and future mutations sent from the Core Development Portal.","archived":false,"fork":false,"pushed_at":"2025-02-27T13:45:03.000Z","size":1854,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-27T16:18:19.122Z","etag":null,"topics":["backend","cdp","node","service"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DEFRA.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}},"created_at":"2023-05-12T13:33:54.000Z","updated_at":"2025-02-27T13:43:32.000Z","dependencies_parsed_at":"2024-03-06T16:23:49.678Z","dependency_job_id":"934a857d-4857-4239-afd2-420ef602389a","html_url":"https://github.com/DEFRA/cdp-self-service-ops","commit_stats":null,"previous_names":["defra/cdp-self-service-ops"],"tags_count":350,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fcdp-self-service-ops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fcdp-self-service-ops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fcdp-self-service-ops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fcdp-self-service-ops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEFRA","download_url":"https://codeload.github.com/DEFRA/cdp-self-service-ops/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241469151,"owners_count":19967997,"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":["backend","cdp","node","service"],"created_at":"2024-11-13T10:31:46.599Z","updated_at":"2026-05-13T09:31:50.097Z","avatar_url":"https://github.com/DEFRA.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CDP Self Service Ops\n\nCore delivery platform Self-Service Ops Node.js Backend.\n\n[![Publish](https://github.com/DEFRA/cdp-self-service-ops/actions/workflows/publish.yml/badge.svg)](https://github.com/DEFRA/cdp-self-service-ops/actions/workflows/publish.yml)\n\n[![Integration Tests](https://github.com/DEFRA/cdp-self-service-ops/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/DEFRA/cdp-self-service-ops/actions/workflows/integration-tests.yml)\n\n- [Requirements](#requirements)\n  - [Authentication](#authentication)\n  - [Node.js](#nodejs)\n- [Local development](#local-development)\n  - [Setup](#setup)\n  - [Development](#development)\n    - [Updating dependencies](#updating-dependencies)\n  - [Production](#production)\n  - [Npm scripts](#npm-scripts)\n- [API endpoints](#api-endpoints)\n- [Calling API endpoints](#calling-api-endpoints)\n  - [Curl](#curl)\n- [Testing](#testing)\n  - [Run individual test](#run-individual-test)\n- [Versioning](#versioning)\n  - [Auto minor versioning](#auto-minor-versioning)\n  - [Major or Patch versioning](#major-or-patch-versioning)\n- [Docker](#docker)\n  º- [Licence](#licence)\n  - [About the licence](#about-the-licence)\n\n## Requirements\n\n### Authentication\n\nFor local development you need to provide a GitHub Private Key in the env `GITHUB_API_AUTH_APP_PRIVATE_KEY` that\nallows the creation of pull requests against the various Org infrastructure repositories. For further details see the\n[Wiki](https://dev.azure.com/defragovuk/DEFRA-CDP/_wiki/wikis/DEFRA-CORE-DELIVERY-PLATFORM/14473/GitHub-API-Authentication-App)\n\n### Node.js\n\nPlease install [Node.js](http://nodejs.org/) `\u003e= v20.3.0` and [npm](https://nodejs.org/) `\u003e= v9`. You will find it\neasier to use the Node Version Manager [nvm](https://github.com/creationix/nvm)\n\nTo use the correct version of Node.js for this application, via nvm:\n\n```bash\n$ cd cdp-self-service-ops\n$ nvm use\n```\n\n## Local development\n\n### Setup\n\nInstall application dependencies:\n\n```bash\n$ npm install\n```\n\n### Development\n\nTo run the application in `development` mode run:\n\n```bash\n$ npm run dev\n```\n\n#### To run locally with docker images\n\nTo run the application alongside `cdp-local-environment` docker images,\nyou need to include env vars from `cdp-local-environment` files e.g:\n\n```\nAWS_ACCESS_KEY_ID=test\nAWS_REGION=eu-west-2\nAWS_SECRET_ACCESS_KEY=test\nAWS_SECRET_KEY=test\nGITHUB_BASE_URL=http://localhost:3939\nSQS_GITHUB_QUEUE=http://localhost:4566/000000000000/github-events\nUSER_SERVICE_BACKEND_URL=http:/localhost:3001\nPORTAL_BACKEND_URL=http://localhost:5094\nOIDC_WELL_KNOWN_CONFIGURATION_URL=http://cdp.127.0.0.1.sslip.io:3939/6f504113-6b64-43f2-ade9-242e05780007/v2.0/.well-known/openid-configuration\n```\n\n#### Updating dependencies\n\nTo update dependencies, globally install https://www.npmjs.com/package/npm-check-updates. Then run the below script,\nrun tests, test the application and commit the altered `package.json` and `package-lock.json` files. For more\noptions around updates check the package docs.\n\n```bash\nncu -i\n```\n\n### Production\n\nTo mimic the application running in `production` mode locally run:\n\n```bash\n$ npm start\n```\n\n### Npm scripts\n\nAll available Npm scripts can be seen in [package.json](./package.json)\nTo view them in your command line run:\n\n```bash\n$ npm run\n```\n\n## Troubleshooting queued events\n\n| Endpoint                                         | Description                                              |\n| :----------------------------------------------- | :------------------------------------------------------- |\n| `GET: /queued-events`                            | query queued events                                      |\n| `PATCH: /queued-events/eventType/repositoryName` | Reset an event and trigger create service infra listener |\n\n### GET /queued-events\n\n| Optional query parameters | Description                                                                            |\n| :------------------------ | :------------------------------------------------------------------------------------- |\n| `eventType`               | Restrict the eventType in response. Currently only `service.infra.create` is supported |\n| `repositoryName`          | Restrict response to a specific repository                                             |\n| `includeProcessed`        | Return results that are processed in response (these are not returned by default)      |\n\n#### Curl\n\n`service.infra.create` events:\n\n```bash\ncurl --location 'localhost:3009/queued-events?eventType=service.infra.create'\n```\n\nSpecific repository:\n\n```bash\ncurl --location 'localhost:3009/queued-events?repositoryName=my-service\u0026eventType=service.infra.create'\n```\n\nInclude processed events:\n\n```bash\ncurl --location 'localhost:3009/queued-events?eventType=service.infra.create\u0026includeProcessed=true'\n```\n\n### PATCH /queued-events/eventType/repositoryName\n\n#### Curl\n\n```bash\ncurl --location --request PATCH 'localhost:3009/queued-events/service.infra.create/my-service'\n```\n\n## API endpoints\n\n| Endpoint                                              | Description                             |\n| :---------------------------------------------------- | :-------------------------------------- |\n| `GET: /health`                                        | Health                                  |\n| `POST: /create-service`                               | Create a service                        |\n| `POST: /deploy-service`                               | Deploy a service                        |\n| `GET: /deploy-service/options`                        | Deploy a service memory and cpu options |\n| `GET: /deploy-service/info/{environment}/{imageName}` | Deploy a service exisiting service info |\n\n## Calling API endpoints\n\n### Curl\n\nDeploy a service:\n\n```bash\ncurl -H \"Content-type: application/json\" -d '{\"imageName\": \"foo-frontend\", \"version\": \"v0.1.0\", \"environment\": \"snd\",\n \"cpu\": 1024, \"memory\": 2048, \"instanceCount\": 1}' 'http://localhost:3009/cdp-self-service-ops/deploy-service'\n```\n\nCreate a service:\n\n```bash\ncurl -H \"Content-type: application/json\" -d '{\"repositoryName\": \"foo-backend\", \"serviceType\": \"cdp-node-backend-template\", \"owningTeam\": \"fisheries\"}' 'http://localhost:3009/cdp-self-service-ops/create-service'\n```\n\nRetrieve current deployment config for a service in an environment:\n\n```bash\ncurl 'http://localhost:3009/cdp-self-service-ops/deploy-service/info/snd/service-name'\n```\n\nRetrieve the allowed cpu and memory configurations\n\n```bash\ncurl 'http://localhost:3009/cdp-self-service-ops/deploy-service/options'\n```\n\n## Testing\n\n### Run individual test\n\nTo run one test in your cli:\n\n```bash\n$ npm test -t \u003ctest-path-and-filename\u003e\n```\n\n## Versioning\n\n### Auto minor versioning\n\nThe [deploy GitHub Actions workflow](./.github/workflows/publish.yml) auto versions a Pull Requests code with a `minor`\nversion once it has been merged into the `main` branch.\nAll you have to do is commit your code and raise a Pull Request and the pipeline will auto version your code for you.\n\n### Major or Patch versioning\n\nIf you wish to `patch` or `major` version your codebase use:\n\n```bash\n$ npm version \u003cpatch|major\u003e\n```\n\nThen:\n\n- Push this code with the auto generated commit to your GitHub Repository\n- Raise a Pull Request\n- Merge your code into the `main` branch\n- The [GitHub Actions workflow](./.github/workflows/publish.yml) will tag and push your `major` or `patch`\n  version tags to your GitHub Repository and release your `major` or `patch` versioned code\n\n## Docker\n\nBuild:\n\n```bash\ndocker build --no-cache --tag cdp-self-service-ops .\n```\n\nRun:\n\n```bash\n$ docker run -p 3009:3009 cdp-self-service-ops\n```\n\n## Licence\n\nTHIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:\n\n\u003chttp://www.nationalarchives.gov.uk/doc/open-government-licence/version/3\u003e\n\nThe following attribution statement MUST be cited in your products and applications when using this information.\n\n\u003e Contains public sector information licensed under the Open Government license v3\n\n### About the licence\n\nThe Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable\ninformation providers in the public sector to license the use and re-use of their information under a common open\nlicence.\n\nIt is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fcdp-self-service-ops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefra%2Fcdp-self-service-ops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fcdp-self-service-ops/lists"}