{"id":25519671,"url":"https://github.com/aligent/nx-serverless-deploy-pipe","last_synced_at":"2025-06-30T01:32:28.578Z","repository":{"id":195339272,"uuid":"691807002","full_name":"aligent/nx-serverless-deploy-pipe","owner":"aligent","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-14T01:35:27.000Z","size":99,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-06-22T05:11:56.928Z","etag":null,"topics":["pipe","serverless"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aligent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-14T23:55:38.000Z","updated_at":"2025-04-14T01:35:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f3ef24e-2732-4ace-a17a-067aa1e5874f","html_url":"https://github.com/aligent/nx-serverless-deploy-pipe","commit_stats":null,"previous_names":["aligent/nx-serverless-deploy-pipe"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aligent/nx-serverless-deploy-pipe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Fnx-serverless-deploy-pipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Fnx-serverless-deploy-pipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Fnx-serverless-deploy-pipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Fnx-serverless-deploy-pipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aligent","download_url":"https://codeload.github.com/aligent/nx-serverless-deploy-pipe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Fnx-serverless-deploy-pipe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262693226,"owners_count":23349697,"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":["pipe","serverless"],"created_at":"2025-02-19T17:29:20.037Z","updated_at":"2025-06-30T01:32:28.520Z","avatar_url":"https://github.com/aligent.png","language":"TypeScript","readme":"# Aligent Serverless Deploy Pipe\n\nThis pipe is used to deploy:\n\n- Multiple Serverless Framework applications in an Nx monorepo.\n- Single Serverless Framework application in a polyrepo.\n\n## YAML Definition\n\nAdd the following your `bitbucket-pipelines.yml` file:\n\n\u003e Please note: there is currently an issue when used with Bitbucket's node cache type. This cannot be used in the step until resolved.\n\n```yaml\n- step:\n    name: 'deploy service'\n    script:\n      - pipe: docker://aligent/nx-serverless-deploy-pipe:latest\n        variables:\n          AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}\n          AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}\n```\n\n## Variables\n\n| Variable              | Usage                                                                                                                                          |\n| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| AWS_ACCESS_KEY_ID     | (Required) Injects AWS Access key                                                                                                              |\n| AWS_SECRET_ACCESS_KEY | (Required) Injects AWS Secret key                                                                                                              |\n| CFN_ROLE              | [CloudFormation service role](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-servicerole.html) to use for deployment |\n| STAGE                 | Define the stage to deploy. Must be exact three characters. (Default: `stg`)                                                                   |\n| DEBUG                 | Turn on extra debug information. (Accepted values: `true`/`false`)                                                                             |\n| UPLOAD_BADGE          | Whether or not to upload a deployment badge to the repositories downloads section. (Accepted values: `true`/`false`)                           |\n| APP_USERNAME          | The user to upload the badge as. Required if UPLOAD_BADGE is set to `true`.                                                                    |\n| APP_PASSWORD          | The app password of the user uploading the badge. Required if UPLOAD_BADGE is set to `true`.                                                   |\n| TIMEZONE              | Which time zone the time in the badge should use (Default: `Australia/Adelaide`)                                                               |\n| PROFILE               | The profile name that is used for deployment (Default: `bitbucket-deployer`)                                                                   |\n| CMD                   | The command that this pipe will run (Eg: `deploy`, `remove`. Default: `deploy`)                                                                |\n| SERVICES_PATH         | The relative path from root folder to the folder where applications are defined (Default: `services`)                                          |\n\n- Default pipelines variables that are available for builds: https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/\n- Please check: https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/ for how to generate an app password.\n\n## Monorepo structure\n\nThe pipe expects:\n\n1. A single `nx.json` file at the root folder.\n2. Each application to be under a folder as defined via `SERVICES_PATH` variable above (default as `services`), and to have a `serverless.yml` and a `project.json` files in its own folder.\n\n```\n.\n├── nx.json\n├── services/\n│   ├── application-one/\n│   │   ├── serverless.yml\n│   │   ├── project.json\n│   │   └── ...other files\n│   └── application-two/\n│       ├── serverless.yml\n│       ├── project.json\n│       └── ...other files\n└── ...other files\n```\n\nThe `project.json` file defining an Nx target called `deploy`, which implements serverless deployment command:\n\n```json\n{\n  \"targets\": {\n    \"deploy\": {\n      \"executor\": \"nx:run-commands\",\n      \"options\": {\n        \"cwd\": \"services/application-one\",\n        \"color\": true,\n        \"command\": \"sls deploy\"\n      }\n    }\n    //    ... other targets\n  }\n  // ... other nx configuration\n}\n```\n\n## Polyrepo structure\n\nThe pipe expects:\n\n1. No `nx.json` file at the root folder.\n2. A `serverless.yml` file at the root folder.\n\n```\n.\n├── serverless.yml\n├── src/\n│   └── ...other files\n└── ...other files\n```\n\n## Development\n\n1. build the image locally:\n\n```bash\n# Transpile our source code to Javascript\nnpm run build\n# [Optional] Run this if we want to remove devDependencies from node_modules before building docker image\n# If we run this, we will need to re-run `npm ci` later on if we fix bug \u0026 want to build another image.\nnpm prune --production\n# Build docker image\ndocker build --build-arg=\"NODE_TAG=20\" -t aligent/nx-pipe:20-alpine .\n```\n\n2. Run the container locally and mount current local directory to the /app/work folder:\n\n```bash\ndocker run -it --memory=4g --memory-swap=4g --memory-swappiness=0 --cpus=4 --entrypoint=/bin/sh \\\n  -v $(pwd):/app/work --workdir=/app/work \\\n  -e BITBUCKET_CLONE_DIR=/app/work \\\n  -e PROFILE=bitbucket-deployer \\\n  -e STAGE=stg \\\n  -e AWS_ACCESS_KEY_ID=test-access-key-id \\\n  -e AWS_SECRET_ACCESS_KEY=test-secret-access-key \\\n  -e CFN_ROLE=test-cfn-role \\\n  -e UPLOAD_BADGE=false \\\n  -e APP_USERNAME=test-app-username \\\n  -e APP_PASSWORD=test-app-password \\\n  -e DEBUG=true \\\n  aligent/nx-pipe:20-alpine\n```\n\n## See also\n\nhttps://nx.dev/ \\\nhttps://www.serverless.com/framework/docs/providers/aws/guide/deploying \\\nhttps://www.serverless.com/framework/docs/providers/aws/cli-reference/config-credentials\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faligent%2Fnx-serverless-deploy-pipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faligent%2Fnx-serverless-deploy-pipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faligent%2Fnx-serverless-deploy-pipe/lists"}