diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..610efe0 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,111 @@ +# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/ +# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually +# https://github.com/release-drafter/release-drafter/issues/551 +# https://github.com/release-drafter/release-drafter/pull/1013 +# https://github.com/release-drafter/release-drafter/issues/139 +# https://github.com/atk4/data/blob/develop/.github/release-drafter.yml + +# This release drafter follows the conventions from https://keepachangelog.com, https://common-changelog.org/ +# https://www.conventionalcommits.org + +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +template: | + ## What Changed ๐ + $CHANGES + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION +categories: + - title: ๐ Features + labels: + - feature + - title: ๐ Bug Fixes + labels: + - fix + - bug + - title: ๐งช Test + labels: + - test + - title: ๐ท CI + labels: + - ci + - title: โป๏ธ Changes + labels: + - changed + - enhancement + - refactor + - title: โ๏ธ Deprecated + labels: + - deprecated + - title: ๐ Security + labels: + - security + - title: ๐ Documentation + labels: + - docs + - documentation + - title: ๐งฉ Dependency Updates + labels: + - deps + - dependencies + - title: ๐งฐ Maintenance + label: 'chore' + - title: ๐ Other changes +## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934 + +# https://www.trywilco.com/post/wilco-ci-cd-github-heroku +# https://github.com/release-drafter/release-drafter#autolabeler +# https://github.com/fuxingloh/multi-labeler + +# Using regex for defining rules - https://regexr.com/ - https://regex101.com/ +autolabeler: + - label: 'chore' + branch: + - '/(chore)\/.*/' + - label: 'security' + branch: + - '/(security)\/.*/' + - label: 'refactor' + branch: + - '/(refactor)\/.*/' + - label: 'docs' + branch: + - '/(docs)\/.*/' + - label: 'ci' + branch: + - '/(ci)\/.*/' + - label: 'test' + branch: + - '/(test)\/.*/' + - label: 'bug' + branch: + - '/(fix)\/.*/' + - label: 'feature' + branch: + - '/(feat)\/.*/' + - label: 'minor' + branch: + - '/(feat)\/.*/' + - label: 'patch' + branch: + - '/(fix)\/.*/' + body: + - '/JIRA-[0-9]{1,4}/' + +change-template: '- $TITLE (#$NUMBER)' +exclude-contributors: + - 'meysamhadeli' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - major + minor: + labels: + - minor + patch: + labels: + - patch + default: patch + +exclude-labels: + - skip-changelog diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d5534b3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI + +on: + push: + branches: [ "main"] + paths-ignore: + - "README.md" + - "CHANGELOG.md" + pull_request: + branches: [ "main" ] + +jobs: + + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.x' + + - name: build building-blocks + run: | + npm install + npm run build + working-directory: ./src/building-blocks + + - name: build identity + run: | + npm install + npm run build + working-directory: ./src/identity + + - name: build flight + run: | + npm install + npm run build + working-directory: ./src/flight + + - name: build passenger + run: | + npm install + npm run build + working-directory: ./src/passenger + + - name: build booking + run: | + npm install + npm run build + working-directory: ./src/booking + +# - name: test identity +# run: npm test +# working-directory: ./src/identity + + diff --git a/.github/workflows/release-drafter-labeler.yml b/.github/workflows/release-drafter-labeler.yml new file mode 100644 index 0000000..960bec7 --- /dev/null +++ b/.github/workflows/release-drafter-labeler.yml @@ -0,0 +1,21 @@ +name: Release Drafter Auto Labeler + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + +jobs: + auto-labeler: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter.yml + disable-releaser: true # only run auto-labeler for PRs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..435365f --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,19 @@ + # https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/ + # https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually + name: Release Drafter + + on: + push: + branches: + - main + + jobs: + update_release_draft: + name: Release drafter + runs-on: ubuntu-latest + + steps: + - name: Update Release Draft + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 951ab31..3ce36ce 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ -# booking-microservices-nestjs +
+ +> **The main idea of creating this project is implementing an infrastructure for up and running distributed system with the latest technology and architecture like Vertical Slice Architecture, Event Driven Architecture, CQRS, Postgres, RabbitMq and Nestjs, and we will not deal mainly with business.** ๐ ## License This project is made available under the MIT license. See [LICENSE](https://github.com/meysamhadeli/booking-microservices-nestjs/blob/main/LICENSE) for details. diff --git a/assets/booking.png b/assets/booking.png new file mode 100644 index 0000000..7d0eb89 Binary files /dev/null and b/assets/booking.png differ diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..bb808f5 Binary files /dev/null and b/assets/logo.png differ diff --git a/deployments/docker-compose/infrastructure.yaml b/deployments/docker-compose/infrastructure.yaml new file mode 100644 index 0000000..cc3eed2 --- /dev/null +++ b/deployments/docker-compose/infrastructure.yaml @@ -0,0 +1,69 @@ +version: "3.3" +services: + + ####################################################### + # Rabbitmq + ####################################################### + rabbitmq: + image: rabbitmq:3-management + container_name: rabbitmq + restart: unless-stopped + ports: + - 5672:5672 + - 15672:15672 + networks: + - booking + + + ####################################################### + # Postgress + ####################################################### + postgres: + container_name: postgres + image: postgres:latest + restart: unless-stopped + ports: + - '5432:5432' + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + networks: + - booking + + + ####################################################### + # Jaeger + ####################################################### + jaeger: + image: jaegertracing/all-in-one + container_name: jaeger + restart: unless-stopped + ports: + - 5775:5775/udp + - 5778:5778 + - 6831:6831/udp + - 6832:6832/udp + - 9411:9411 + - 14268:14268 + - 16686:16686 + networks: + - booking + + ####################################################### + # Zipkin + ####################################################### + zipkin: + image: openzipkin/zipkin:latest + container_name: zipkin + restart: unless-stopped + ports: + - '9411:9411' + networks: + - booking + +networks: + booking: + + + + diff --git a/deployments/monitoring/prometheus.yml b/deployments/monitoring/prometheus.yml new file mode 100644 index 0000000..cb5f1a3 --- /dev/null +++ b/deployments/monitoring/prometheus.yml @@ -0,0 +1,23 @@ +global: + scrape_interval: 15s + scrape_timeout: 10s + evaluation_interval: 15s +scrape_configs: +- job_name: identity + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - localhost:4000 +- job_name: passenger + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - localhost:4001 \ No newline at end of file diff --git a/src/booking/package.json b/src/booking/package.json index 8dfb4f7..2925f41 100644 --- a/src/booking/package.json +++ b/src/booking/package.json @@ -7,7 +7,7 @@ "license": "MIT", "scripts": { "build": "nest build", - "dev": "tsc -p tsconfig.json && NODE_ENV=development nodemon src/main.ts --watch", + "dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix" }, @@ -65,7 +65,6 @@ "ts-mapper": "^1.2.4", "tsyringe": "4.8.0", "typeorm": "^0.3.17", - "win-node-env": "^0.6.1", "yup": "1.3.2" }, "devDependencies": { diff --git a/src/flight/package.json b/src/flight/package.json index fbc3875..dabdcc5 100644 --- a/src/flight/package.json +++ b/src/flight/package.json @@ -7,7 +7,7 @@ "license": "MIT", "scripts": { "build": "nest build", - "dev": "tsc -p tsconfig.json && NODE_ENV=development nodemon src/main.ts --watch", + "dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix" }, @@ -65,7 +65,6 @@ "tsyringe": "4.8.0", "typeorm": "^0.3.17", "typeorm-extension": "^3.2.0", - "win-node-env": "^0.6.1", "yup": "1.3.2" }, "devDependencies": { diff --git a/src/identity/package.json b/src/identity/package.json index f6acb80..77f2dc5 100644 --- a/src/identity/package.json +++ b/src/identity/package.json @@ -7,7 +7,7 @@ "license": "MIT", "scripts": { "build": "nest build", - "dev": "tsc -p tsconfig.json && NODE_ENV=development nodemon src/main.ts --watch", + "dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix" }, @@ -68,7 +68,6 @@ "tsyringe": "4.8.0", "typemoq": "^2.1.0", "typeorm": "^0.3.17", - "win-node-env": "^0.6.1", "yup": "1.3.2" }, "devDependencies": { diff --git a/src/passenger/package.json b/src/passenger/package.json index 6087374..c628a7a 100644 --- a/src/passenger/package.json +++ b/src/passenger/package.json @@ -7,7 +7,7 @@ "license": "MIT", "scripts": { "build": "nest build", - "dev": "tsc -p tsconfig.json && NODE_ENV=development nodemon src/main.ts --watch", + "dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix" }, @@ -64,7 +64,6 @@ "ts-mapper": "^1.2.4", "tsyringe": "4.8.0", "typeorm": "^0.3.17", - "win-node-env": "^0.6.1", "yup": "1.3.2" }, "devDependencies": {