From b0df3653394dbb4c36395ce533dec0534826c41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gosta=C5=84ski?= <67002661+grixu@users.noreply.github.com> Date: Wed, 21 Aug 2024 12:17:43 +0200 Subject: [PATCH] feat: define middleware port and path (#27) * feat: add extra params for deploy action * docs: update README.md --- README.md | 16 +++++++++------- deploy/action.yml | 10 +++++++++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9dac497..ab4e52d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ With those four you can easily compose the deployment script for your needs. ### build-frontend ```yaml -uses: vuestorefront/storefront-deployment/build-frontend@v1 +uses: vuestorefront/storefront-deployment/build-frontend@v4.4.0 with: project_name: ${{ secrets.PROJECT_NAME }} cloud_username: ${{ secrets.CLOUD_USERNAME }} @@ -49,7 +49,7 @@ Any environment variables needed by an application is needed to be set in the Al ### build-middleware ```yaml -uses: vuestorefront/storefront-deployment/build-middleware@v1 +uses: vuestorefront/storefront-deployment/build-middleware@v4.4.0 with: project_name: ${{ secrets.PROJECT_NAME }} cloud_username: ${{ secrets.CLOUD_USERNAME }} @@ -77,7 +77,7 @@ with: ### build-stripe-ct ```yaml -uses: vuestorefront/storefront-deployment/build-stripe-ct +uses: vuestorefront/storefront-deployment/build-stripe-ct@v4.4.0 with: project_name: ${{ secrets.PROJECT_NAME }} cloud_username: ${{ secrets.CLOUD_USERNAME }} @@ -107,7 +107,7 @@ with: ### deploy ```yaml -uses: vuestorefront/storefront-deployment/deploy@v1 +uses: vuestorefront/storefront-deployment/deploy@v4.4.0 with: project_name: ${{ secrets.PROJECT_NAME }} cloud_username: ${{ secrets.CLOUD_USERNAME }} @@ -126,12 +126,14 @@ with: - `cloud_region`: Region where the environment is set up in the Console. Required field. - `docker_registry_url`: URL to the Docker image registry. Optional field. Defaults to `registry.vuestorefront.cloud`. - `console_api_url`: URL to the Console. Optional field. Defaults to `https://api.platform.vuestorefront.io`. -- `version`: Docker image tag that will be deployed. Example: 2.3.0, 3.1.0-rc.1. If not passed, github.sha will be used +- `version`: Docker image tag that will be deployed. Example: 2.3.0, 3.1.0-rc.1. If not passed, `github.sha` will be used +- `middleware_path`: Path in URL of the Storefront on which Middleware app will be available. If not passed, `/api/` will be used +- `middleware_port`: Port on which Middleware application is working on. If not passed, `4000` will be used ### deploy/stripe-ct ```yaml -uses: vuestorefront/storefront-deployment/deploy/stripe-ct +uses: vuestorefront/storefront-deployment/deploy/stripe-ct@v4.4.0 with: project_name: ${{ secrets.PROJECT_NAME }} cloud_username: ${{ secrets.CLOUD_USERNAME }} @@ -154,4 +156,4 @@ with: - `extension_module_name`: Extension module name. It’s used as the name of the docker image and path where the api is available. Default value is `ct-stripe-extension`. - `extension_module_port`: Port of the extension module. Default value is `8080`. - `notification_module_name`: Notification module name. It’s used as the name of the docker image and path where the api is available. Default value is `ct-stripe-notification`. -- `notification_module_port`: Port of the notification module. Default value is `8081`. \ No newline at end of file +- `notification_module_port`: Port of the notification module. Default value is `8081`. diff --git a/deploy/action.yml b/deploy/action.yml index 365f62e..25ca55a 100644 --- a/deploy/action.yml +++ b/deploy/action.yml @@ -24,6 +24,14 @@ inputs: version: description: "Version of the app" required: false + middleware_path: + description: 'Path to the Middleware app on the Reverse Proxy' + required: false + default: '/api/' + middleware_port: + description: 'Port of the Middleware app' + required: false + default: 4000 runs: using: "composite" @@ -43,7 +51,7 @@ runs: url: "${{ inputs.console_api_url }}/cloud/instances/${{ inputs.project_name }}-${{ inputs.cloud_region }}-gcp-storefrontcloud-io/deploy" method: "PATCH" customHeaders: '{"Content-Type":"application/json"}' - data: '{"middleware":true,"cloudUserId":"${{ inputs.cloud_username }}","cloudUserPassword":"${{ inputs.cloud_password }}","dockerImageHash":"${{ inputs.version || github.sha }}","env_var":{"03731de5-5ff9-49d9-a6e5-8af9c4fa75d9":{"name":"NUXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID","value":"${{ inputs.version || github.sha }}","is_secret":false},"03731de5-5ff9-49d9-a6e5-8af9c4fa75":{"name":"NEXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID","value":"${{ inputs.version || github.sha }}","is_secret":false}},"middlewareData":{"path":"/api/","port":4000,"has_base_path":false}}' + data: '{"middleware":true,"cloudUserId":"${{ inputs.cloud_username }}","cloudUserPassword":"${{ inputs.cloud_password }}","dockerImageHash":"${{ inputs.version || github.sha }}","env_var":{"03731de5-5ff9-49d9-a6e5-8af9c4fa75d9":{"name":"NUXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID","value":"${{ inputs.version || github.sha }}","is_secret":false},"03731de5-5ff9-49d9-a6e5-8af9c4fa75":{"name":"NEXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID","value":"${{ inputs.version || github.sha }}","is_secret":false}},"middlewareData":{"path":"${{ inputs.middleware_path }}","port":${{ inputs.middleware_port }},"has_base_path":false}}' timeout: 60000 - name: Update deployment status (success)