From 62e3de7ba56bf5a66509667fd595c745209e2331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Narciso?= Date: Tue, 25 Jun 2024 18:19:52 +0100 Subject: [PATCH 1/5] [ENG-30455] feat: use 'edge as code' and new version of CLI (#1335) --- .github/workflows/deploy-production.yml | 36 +-- .github/workflows/deploy-stage.yml | 36 +-- .gitignore | 2 +- .vulcan | 6 + README.md | 72 +++-- azion.config.cjs | 375 ++++++++++++++++++++++++ azion/azion.json | 29 -- azion/{ => production}/args.json | 0 azion/production/azion.json | 162 ++++++++++ azion/stage/args.json | 1 + azion/stage/azion.json | 162 ++++++++++ vulcan.config.js | 6 + 12 files changed, 765 insertions(+), 122 deletions(-) create mode 100644 .vulcan create mode 100644 azion.config.cjs delete mode 100644 azion/azion.json rename azion/{ => production}/args.json (100%) create mode 100644 azion/production/azion.json create mode 100644 azion/stage/args.json create mode 100644 azion/stage/azion.json create mode 100644 vulcan.config.js diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 487507ac6..f5a535915 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -22,34 +22,16 @@ jobs: - name: Install dependencies run: yarn install - - name: Build - run: yarn build --mode production - env: - VITE_RECAPTCHA_SITE_KEY: ${{ secrets.PROD_RECAPTCHA_SITE_KEY }} - - name: Download Azion CLI - run: curl https://downloads.azion.com/linux/x86_64/azioncli -o azioncli && chmod +x azioncli - - - name: Create YML file to Azion CLI - run: mkdir ~/.config/ && touch ~/.config/azioncli.yaml + run: | + wget https://github.com/aziontech/azion/releases/download/1.28.1/azion_1.28.1_linux_amd64.apk + apk add --allow-untrusted azion_1.28.1_linux_amd64.apk - name: Configure Azion CLI - run: ./azioncli configure -t ${{ secrets.PLATFORM_KIT_TOKEN }} + run: azion -t ${{ secrets.PLATFORM_KIT_TOKEN }} - - name: Define application settings - run: > - echo $(jq - --arg funcid ${{secrets.PROD_EDGE_FUNCTION_ID}} - --arg appid ${{secrets.PROD_EDGE_APPLICATION_ID}} - --arg domainid ${{secrets.PROD_DOMAIN_ID}} - '.name = "Console PK - Production" - | .function.id = ($funcid|tonumber) - | .application.id = ($appid|tonumber) - | .domain.id = ($domainid|tonumber)' - azion/azion.json) > azion/azion.json - - - name: Configure Repository - run: mkdir -p .edge/statics && cp -r ./dist/* .edge/statics - - - name: Deploy Edge Application - run: ./azioncli edge_applications publish + - name: Build & Deploy + run: azion deploy --auto --config-dir azion/production + env: + VITE_RECAPTCHA_SITE_KEY: ${{ secrets.PROD_RECAPTCHA_SITE_KEY }} + NODE_ENV: production \ No newline at end of file diff --git a/.github/workflows/deploy-stage.yml b/.github/workflows/deploy-stage.yml index 018c98c47..8b7203a12 100644 --- a/.github/workflows/deploy-stage.yml +++ b/.github/workflows/deploy-stage.yml @@ -22,34 +22,16 @@ jobs: - name: Install dependencies run: yarn install - - name: Build - run: yarn build --mode stage - env: - VITE_RECAPTCHA_SITE_KEY: ${{ secrets.STAGE_RECAPTCHA_SITE_KEY }} - - name: Download Azion CLI - run: curl https://downloads.azion.com/linux/x86_64/azioncli -o azioncli && chmod +x azioncli - - - name: Create YML file to Azion CLI - run: mkdir ~/.config/ && touch ~/.config/azioncli.yaml + run: | + wget https://github.com/aziontech/azion/releases/download/1.28.1/azion_1.28.1_linux_amd64.apk + apk add --allow-untrusted azion_1.28.1_linux_amd64.apk - name: Configure Azion CLI - run: ./azioncli configure -t ${{ secrets.PLATFORM_KIT_TOKEN }} + run: azion -t ${{ secrets.PLATFORM_KIT_TOKEN }} - - name: Define application settings - run: > - echo $(jq - --arg funcid ${{secrets.STAGE_EDGE_FUNCTION_ID}} - --arg appid ${{secrets.STAGE_EDGE_APPLICATION_ID}} - --arg domainid ${{secrets.STAGE_DOMAIN_ID}} - '.name = "Console PK - Stage" - | .function.id = ($funcid|tonumber) - | .application.id = ($appid|tonumber) - | .domain.id = ($domainid|tonumber)' - azion/azion.json) > azion/azion.json - - - name: Configure Repository - run: mkdir -p .edge/statics && cp -r ./dist/* .edge/statics - - - name: Deploy Edge Application - run: ./azioncli edge_applications publish + - name: Build & Deploy + run: azion deploy --auto --config-dir azion/production + env: + VITE_RECAPTCHA_SITE_KEY: ${{ secrets.PROD_RECAPTCHA_SITE_KEY }} + NODE_ENV: stage \ No newline at end of file diff --git a/.gitignore b/.gitignore index afaecfcf0..e668456fe 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,7 @@ cypress.env.* !cypress.env.example.json #azion vulcan folder -azion +#azion .edge src/views/Playground/PlaygroundView.vue diff --git a/.vulcan b/.vulcan new file mode 100644 index 000000000..ab01f0f08 --- /dev/null +++ b/.vulcan @@ -0,0 +1,6 @@ +builder=webpack +entry=./main.js +preset=vue +mode=deliver +useNodePolyfills=false +useOwnWorker=false diff --git a/README.md b/README.md index 15ebb9763..31ce8f16d 100644 --- a/README.md +++ b/README.md @@ -22,17 +22,17 @@ Before you begin, ensure that you have the following: 1. Clone the repository and navigate to the root folder. -```bash -git clone git@github.com:aziontech/azion-console-kit.git -cd azion-console-kit -``` + ```bash + git clone git@github.com:aziontech/azion-console-kit.git + cd azion-console-kit + ``` 2. Install dependencies and start the project: -```bash - $ yarn install - $ yarn dev --host -``` + ```bash + $ yarn install + $ yarn dev --host + ``` The webapp becomes available at [http://localhost:5173](http://localhost:5173). @@ -64,45 +64,41 @@ VITE_ENVIRONMENT='PRODUCTION' ## Running on the Edge 🚀 -Azion Console Kit can run natively on Azion's edge using Azion CLI (version >= 0.70.0). Follow these steps: +Azion Console Kit can run natively on Azion's edge using Azion CLI. Follow these steps: -1. Download and configure Azion CLI with a personal token: +1. [Download the Azion CLI here](https://www.azion.com/en/documentation/products/azion-cli/overview/) and configure your personal token: -```bash -curl https://downloads.azion.com/linux/x86_64/azioncli -o azioncli && chmod +x azioncli -./azioncli configure -t PERSONALTOKEN -``` + ```bash + azion -t ${PERSONAL_TOKEN} + ``` -2. Build the bundler and copy the content from `dist` to `.edge/statics` +2. Link project to an Azion edge application. -```bash -yarn build -mkdir -p .edge/statics && cp -r ./dist/* .edge/statics -``` + ```bash + azion link + ``` -3. Publish the edge application: + Choose the Vue preset. -```bash -azioncli edge_applications init --name azion-platform-kit --type vue --mode deliver +3. Publish your project to create the application's domain: -azioncli edge_applications publish --debug -``` + ```bash + azion deploy + ``` -After a few seconds, access your project on the domain provided by the CLI: + > This step is responsible for deploying your base project and creating a domain. This domain will be later on used to implement the configuration rules. -```bash -$ azioncli edge_applications publish -Uploading static files -[##########] 100 .edge/statics/index.html Upload completed successfully! -Created Edge Function PLATFORM-KIT-1 with ID 10908 -Created Edge Application PLATFORM-KIT-1 with ID 1694694931 -Created Domain PLATFORM-KIT-1 with ID 1694690266 -Created Cache Settings for web application -Created Rules Engine for web application -Your Edge Application was published successfully - -To visualize your application access the domain: https://ajahphrqah.map.azionedge.net -``` + 💡 Tip: You can use the `--config-dir` argument to separate project environments. The CLI will use the reference to store application states. If you don't need two environments, don't pass the argument and it will use the original reference. + +4. Deploy your Project + + ```bash + azion deploy + ``` + + One of the rules used in `azion.config.cjs` _(to rewrite the authentication cookie using your domain)_ needs the created domain to work. So, **after the first deploy**, just run the `Azion deploy` command again and everything should work 🚀 + +After a few seconds, access your project on the domain provided by the CLI. ## Features 🧩 diff --git a/azion.config.cjs b/azion.config.cjs new file mode 100644 index 000000000..eb972600c --- /dev/null +++ b/azion.config.cjs @@ -0,0 +1,375 @@ +/* if you have two environments for the same application */ +const environment = process.env.VITE_ENVIRONMENT || 'production'; +//const config = require(`./azion/${environment}/azion.json`) + +/* eslint-env node */ +//const config = require(`./azion/azion.json`) ?? null +//const myDomain = +// config.domain.domain_name && config.domain.domain_name.trim() !== '' +// ? config.domain.domain_name +// : 'console.azion.com' + +const addStagePrefix = (origin) => { + if (environment === 'stage') { + return origin?.map(origin => ({ + ...origin, + hostHeader: `stage-${origin.hostHeader}`, + addresses: origin.addresses?.map(addr => `stage-${addr}`) + })); + } + return origin; +}; + +const addStageSuffixToCookies = (cookieName) => { + return environment === 'stage' ? `${cookieName}_stg` : cookieName; +}; + + +const cacheConfig = [ + { + name: 'Statics - Cache', + stale: false, + queryStringSort: false, + methods: { + post: false, + options: false + }, + browser: { + maxAgeSeconds: 1000 * 5 // 5000 seconds + }, + edge: { + maxAgeSeconds: 60 * 60 * 24 * 5 // 5 days + } + }, + { + name: 'Marketplace - Cache', + stale: false, + queryStringSort: false, + methods: { + post: false, + options: false + }, + edge: { + maxAgeSeconds: 60 * 60 * 24 * 2 // 2 days + } + }, + { + name: 'Cities - Cache', + stale: false, + queryStringSort: false, + methods: { + post: false, + options: false + }, + browser: { + maxAgeSeconds: 1000 * 10 // 10000 seconds + }, + edge: { + maxAgeSeconds: 60 * 60 * 24 * 7 // 7 days + } + }, +] + +const commonRules = [ + { + name: 'Apply Common Configuration for All Requests', + description: + 'Applies common settings for all requests, including standard headers and HTTP to HTTPS redirection.', + match: '^\\/', + behavior: { + setHeaders: ['Accept: application/json; version=3;'], + bypassCache: true, + forwardCookies: true, + httpToHttps: true + } + } +] + +const frontRules = [ + { + name: 'Set Storage Origin for All Requests', + description: 'Sets the default object storage as the origin for all requests.', + match: '^\\/', + behavior: { + setOrigin: { + name: 'origin-storage-default', + type: 'object_storage' + } + } + }, + { + name: 'Deliver Static Assets from Storage', + description: + 'Sets the storage origin and deliver for all requests using the default object storage.', + match: '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', + behavior: { + setOrigin: { + name: 'origin-storage-default', + type: 'object_storage' + }, + setCache: 'Statics - Cache', + deliver: true + } + }, + { + name: 'Redirect All Non-Asset Requests to to index.html', + description: + 'Delivers static assets such as CSS, JS, images, and other files directly from object storage.', + match: '^\\/', + behavior: { + rewrite: `/index.html` + } + } +] + +const backRules = [ + { + name: 'Route API Default Requests to API Origin', + description: 'Routes all default API requests to the specific API origin.', + match: '^/api', + behavior: { + setOrigin: { + name: 'origin-api', + type: 'single_origin' + } + } + }, + { + name: 'Route Specific API Services to Marketplace Origin', + description: + 'Routes marketplace API services to the manager origin, forwarding cookies and bypassing cache.', + match: '^/api/marketplace', + behavior: { + setOrigin: { + name: 'origin-manager', + type: 'single_origin' + }, + forwardCookies: true, + capture: { + match: '/api/marketplace/(.*)', + captured: 'captured', + subject: 'request_uri' + }, + rewrite: `/marketplace/api/%{captured[1]}`, + setCache: 'Marketplace - Cache' + } + }, + { + name: 'Route Specific API Services to Template Engine Origin', + description: + 'Routes template-engine API services to the manager origin, forwarding cookies and bypassing cache.', + match: '^/api/template-engine', + behavior: { + setOrigin: { + name: 'origin-manager', + type: 'single_origin' + }, + forwardCookies: true, + capture: { + match: '/api/template-engine/(.*)', + captured: 'captured', + subject: 'request_uri' + }, + rewrite: `/template-engine/api/%{captured[1]}`, + bypassCache: true + } + }, + { + name: 'Route Specific API Services to Script Runner Origin', + description: + 'Routes script-runner API services to the script runner origin, forwarding cookies and bypassing cache.', + match: '^/api/script-runner', + behavior: { + setOrigin: { + name: 'origin-script-runner', + type: 'single_origin' + }, + forwardCookies: true, + capture: { + match: '/api/script-runner/(.*)', + captured: 'captured', + subject: 'request_uri' + }, + rewrite: `/script-runner/api/%{captured[1]}`, + bypassCache: true + } + }, + { + name: 'Route Version Control System API to VCS Origin', + description: 'Routes version control system API requests to the VCS origin.', + match: '^/api/vcs', + behavior: { + setOrigin: { + name: 'origin-vcs', + type: 'single_origin' + } + } + }, + { + name: 'Route User Authentication and Account Management to SSO Origin', + description: + 'Routes user authentication and account management requests to the SSO origin, with cookie forwarding and cache bypass.', + match: '^/api/(account|user|token|switch-account|auth|password|totp)|^/logout', + behavior: { + setOrigin: { + name: 'origin-sso', + type: 'single_origin' + }, + forwardCookies: true, + bypassCache: true + } + }, + { + name: 'Route GraphQL City Queries to Cities Origin', + description: 'Routes GraphQL queries for cities to the specific cities origin.', + match: '^/graphql/cities/', + behavior: { + forwardCookies: true, + setOrigin: { + name: 'origin-cities', + type: 'single_origin' + }, + rewrite: '/graphql/', + setCache: 'Cities - Cache' + } + }, +] + +const AzionConfig = { + cache: [...cacheConfig], + origin: addStagePrefix([ + { + name: 'origin-storage-default', + type: 'object_storage' + }, + { + name: 'origin-manager', + type: 'single_origin', + hostHeader: `manager-origin.azion.com`, + addresses: [`manager-origin.azion.com`] + }, + { + name: 'origin-vcs', + type: 'single_origin', + hostHeader: `vcs-api.azion.net`, + addresses: [`vcs-api.azion.net`] + }, + { + name: 'origin-cities', + type: 'single_origin', + hostHeader: `cities.azion.com`, + addresses: [`cities.azion.com`] + }, + { + name: 'origin-sso', + type: 'single_origin', + hostHeader: `sso.azion.com`, + addresses: [`sso.azion.com`] + }, + { + name: 'origin-api', + type: 'single_origin', + hostHeader: `api.azion.com`, + addresses: [`api.azion.com`] + }, + { + name: 'origin-script-runner', + type: 'single_origin', + hostHeader: 'script-runner.azion.com', + addresses: ['script-runner.azion.com'] + } + // { + // name: 'origin-iam', + // type: 'single_origin', + // hostHeader: 'iam.azion.com', + // addresses: ['iam.azion.com'] + // }, + // { + // name: 'origin-variables', + // type: 'single_origin', + // hostHeader: 'variables.azion.com', + // addresses: ['variables.azion.com'] + // } + ]), + rules: { + request: [...commonRules, ...frontRules, ...backRules], + response: [ + { + name: 'Rewrite _azrt Cookie', + description: + 'Captures and rewrites the _azrt cookie from upstream responses, setting it with specific domain, path, and security settings.', + match: '.*', + variable: `upstream_cookie_${addStageSuffixToCookies('_azrt')}`, + behavior: { + capture: { + match: '(.*)', + captured: 'azrt_arr', + subject: `upstream_cookie_${addStageSuffixToCookies('_azrt')}` + }, + setCookie: `${addStageSuffixToCookies('_azrt')}=%{azrt_arr[0]}; Max-Age=1209600; Path=/; SameSite=Lax; Secure`, + filterCookie: addStageSuffixToCookies('_azrt') + } + }, + { + name: 'Rewrite azsid Cookie', + description: + 'Captures and rewrites the azsid cookie from upstream responses, applying new domain, expiration, and secure attributes.', + match: '.*', + variable: `upstream_cookie_${addStageSuffixToCookies('azsid')}`, + behavior: { + capture: { + match: '(.*)', + captured: 'azsid_arr', + subject: `upstream_cookie_${addStageSuffixToCookies('azsid')}` + }, + setCookie: `${addStageSuffixToCookies('azsid')}=%{azsid_arr[0]}; Max-Age=1209600; Path=/; SameSite=Lax; Secure`, + filterCookie: addStageSuffixToCookies('azsid') + } + }, + { + name: 'Rewrite _azat Cookie', + description: + 'Captures and rewrites the _azat cookie from upstream responses, setting secure, domain-specific settings for enhanced security.', + match: '.*', + variable: `upstream_cookie_${addStageSuffixToCookies('_azat')}`, + behavior: { + capture: { + match: '(.*)', + captured: 'azat_arr', + subject: `upstream_cookie_${addStageSuffixToCookies('_azat')}` + }, + setCookie: `${addStageSuffixToCookies('_azat')}=%{azat_arr[0]}; Max-Age=1209600; Path=/; SameSite=Lax; Secure`, + filterCookie: addStageSuffixToCookies('_azat') + } + }, + { + name: 'Secure Headers', + description: + 'Sets various security headers to enhance the security posture of responses, including protections against clickjacking, XSS, and other web vulnerabilities.', + match: '^\\/', + behavior: { + setHeaders: [ + 'X-Frame-Options: SAMEORIGIN', + 'X-Content-Type-Options: nosniff', + 'Strict-Transport-Security: max-age=2592000; includeSubDomains', + 'Referrer-Policy: strict-origin-when-cross-origin', + 'X-XSS-Protection: 1; mode=block', + 'Cross-Origin-Opener-Policy: same-origin' + ] + } + } + // { + // name: 'CSP Header - Content Secure Policy', + // description: 'Sets a comprehensive Content Security Policy (CSP) header to enhance security by defining a whitelist of sources from which various types of resources can be loaded. This policy helps mitigate various types of attacks including Cross-Site Scripting (XSS) and data injection.', + // match: '^\\/', + // behavior: { + // setHeaders: [ + // `Content-Security-Policy: default-src 'self' *.azion.com https://storage.googleapis.com cdn.segment.com api.segment.io; connect-src 'self' *.azion.com https://storage.googleapis.com cdn.segment.com api.segment.io https://www.google-analytics.com https://www.clarity.ms https://*.clarity.ms; frame-src https://feedback.fish *.azion.com https://www.google.com; frame-ancestors 'none'; upgrade-insecure-requests; block-all-mixed-content; style-src https://storage.googleapis.com https://console.azion.com https://fonts.azion.com cdn.jsdelivr.net 'unsafe-hashes' 'unsafe-inline'; font-src https://storage.googleapis.com https://console.azion.com https://fonts.azion.com data:; script-src https://storage.googleapis.com *.azion.com https://feedback.fish 'unsafe-inline' https://www.google-analytics.com https://www.googletagmanager.com https://www.clarity.ms https://*.clarity.ms; style-src-elem https://storage.googleapis.com *.azion.com https://feedback.fish cdn.jsdelivr.net 'unsafe-inline' https://${myDomain}; script-src-elem https://storage.googleapis.com *.azion.com https://feedback.fish https://cdn.jsdelivr.net https://cdn.segment.com https://www.google.com https://www.gstatic.com https://www.google-analytics.com https://www.googletagmanager.com https://www.google-analytics.com https://www.clarity.ms https://*.clarity.ms 'unsafe-inline' https://${myDomain}; img-src *` + // ] + // } + // } + ] + } +} + +module.exports = AzionConfig diff --git a/azion/azion.json b/azion/azion.json deleted file mode 100644 index f8645d109..000000000 --- a/azion/azion.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "Console - PK", - "type": "vue", - "mode": "deliver", - "env": "production", - "version-id": "", - "function": { - "id": 0, - "name": "__DEFAULT__", - "file": ".edge/worker.js", - "args": "./azion/args.json" - }, - "application": { - "id": 0, - "name": "__DEFAULT__" - }, - "domain": { - "id": 0, - "name": "__DEFAULT__" - }, - "rt-purge": { - "purge_on_publish": true - }, - "origin": { - "id": 0, - "name": "", - "address": null - } -} diff --git a/azion/args.json b/azion/production/args.json similarity index 100% rename from azion/args.json rename to azion/production/args.json diff --git a/azion/production/azion.json b/azion/production/azion.json new file mode 100644 index 000000000..b3b49ffc1 --- /dev/null +++ b/azion/production/azion.json @@ -0,0 +1,162 @@ +{ + "name": "console_kit_production", + "bucket": "consolekitproduction", + "preset": "vue", + "mode": "deliver", + "env": "production", + "prefix": "20240625173345", + "not-first-run": true, + "function": { + "id": 25650, + "name": "__DEFAULT__", + "file": ".edge/worker.js", + "args": "azion/production/args.json", + "instance-id": 24884, + "instance-name": "__DEFAULT__", + "cache-id": 0 + }, + "application": { + "id": 1719268926, + "name": "__DEFAULT__" + }, + "domain": { + "id": 1719266455, + "name": "console_kit_production", + "domain_name": "ivslss619f.map.azionedge.net", + "url": "https://ivslss619f.map.azionedge.net" + }, + "rt-purge": { + "purge_on_publish": true + }, + "origin": [ + { + "origin-id": 139231, + "origin-key": "811175b6-1438-41b7-a890-0a661f6ef3f8", + "name": "origin-storage-default" + }, + { + "origin-id": 139232, + "origin-key": "0c2a4c1f-3f32-4b89-8433-f63463bbc812", + "name": "origin-manager" + }, + { + "origin-id": 139233, + "origin-key": "d4129eb3-de13-41ce-b300-78c9d40b9a6d", + "name": "origin-vcs" + }, + { + "origin-id": 139234, + "origin-key": "445a7bba-47b2-4f21-aaed-48cd218ce125", + "name": "origin-cities" + }, + { + "origin-id": 139235, + "origin-key": "8420c41b-53c3-468f-983a-611e2009293b", + "name": "origin-sso" + }, + { + "origin-id": 139236, + "origin-key": "3d92d42f-26b5-4341-a0f8-61ead6bb36d6", + "name": "origin-api" + }, + { + "origin-id": 139237, + "origin-key": "07b56aa4-41e6-40f5-9db2-1e911ba4193f", + "name": "origin-script-runner" + } + ], + "rules-engine": { + "created": false, + "rules": [ + { + "id": 263048, + "name": "Apply Common Configuration for All Requests", + "phase": "request" + }, + { + "id": 263049, + "name": "Set Storage Origin for All Requests", + "phase": "request" + }, + { + "id": 263050, + "name": "Deliver Static Assets from Storage", + "phase": "request" + }, + { + "id": 263051, + "name": "Redirect All Non-Asset Requests to to index.html", + "phase": "request" + }, + { + "id": 263052, + "name": "Route API Default Requests to API Origin", + "phase": "request" + }, + { + "id": 263053, + "name": "Route Specific API Services to Marketplace Origin", + "phase": "request" + }, + { + "id": 263054, + "name": "Route Specific API Services to Template Engine Origin", + "phase": "request" + }, + { + "id": 263055, + "name": "Route Specific API Services to Script Runner Origin", + "phase": "request" + }, + { + "id": 263056, + "name": "Route Version Control System API to VCS Origin", + "phase": "request" + }, + { + "id": 263057, + "name": "Route User Authentication and Account Management to SSO Origin", + "phase": "request" + }, + { + "id": 263058, + "name": "Route GraphQL City Queries to Cities Origin", + "phase": "request" + }, + { + "id": 263059, + "name": "Rewrite _azrt Cookie", + "phase": "response" + }, + { + "id": 263060, + "name": "Rewrite azsid Cookie", + "phase": "response" + }, + { + "id": 263061, + "name": "Rewrite _azat Cookie", + "phase": "response" + }, + { + "id": 263062, + "name": "Secure Headers", + "phase": "response" + } + ] + }, + "cache-settings": [ + { + "id": 157896, + "name": "Statics - Cache" + }, + { + "id": 157897, + "name": "Marketplace - Cache" + }, + { + "id": 157898, + "name": "Cities - Cache" + } + ] +} \ No newline at end of file diff --git a/azion/stage/args.json b/azion/stage/args.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/azion/stage/args.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/azion/stage/azion.json b/azion/stage/azion.json new file mode 100644 index 000000000..87356187e --- /dev/null +++ b/azion/stage/azion.json @@ -0,0 +1,162 @@ +{ + "name": "console_kit_stage", + "bucket": "consolekitstage", + "preset": "vue", + "mode": "deliver", + "env": "production", + "prefix": "20240625173729", + "not-first-run": true, + "function": { + "id": 25649, + "name": "__DEFAULT__", + "file": ".edge/worker.js", + "args": "azion/stage/args.json", + "instance-id": 24883, + "instance-name": "__DEFAULT__", + "cache-id": 0 + }, + "application": { + "id": 1719268922, + "name": "__DEFAULT__" + }, + "domain": { + "id": 1719266445, + "name": "console_kit_stage", + "domain_name": "dadyar9y3d.map.azionedge.net", + "url": "https://dadyar9y3d.map.azionedge.net" + }, + "rt-purge": { + "purge_on_publish": true + }, + "origin": [ + { + "origin-id": 139220, + "origin-key": "8363ac96-d4b2-41a4-a515-e6cd9dae322c", + "name": "origin-storage-default" + }, + { + "origin-id": 139221, + "origin-key": "70ac07ce-649f-49f6-b589-2d8fadf4afc2", + "name": "origin-manager" + }, + { + "origin-id": 139222, + "origin-key": "2e4f170f-1b0f-4e63-abe6-2713139e90d4", + "name": "origin-vcs" + }, + { + "origin-id": 139223, + "origin-key": "abfc7ea3-6fba-44f4-a7b9-6d00d91686f6", + "name": "origin-cities" + }, + { + "origin-id": 139224, + "origin-key": "82bd3728-0a17-48da-9e52-c1cdcb58549e", + "name": "origin-sso" + }, + { + "origin-id": 139225, + "origin-key": "55026ad0-1f47-49f8-9442-7a6443ab7bbd", + "name": "origin-api" + }, + { + "origin-id": 139226, + "origin-key": "90966025-1eac-436e-bac0-2bbd5bbc2654", + "name": "origin-script-runner" + } + ], + "rules-engine": { + "created": false, + "rules": [ + { + "id": 263027, + "name": "Apply Common Configuration for All Requests", + "phase": "request" + }, + { + "id": 263028, + "name": "Set Storage Origin for All Requests", + "phase": "request" + }, + { + "id": 263029, + "name": "Deliver Static Assets from Storage", + "phase": "request" + }, + { + "id": 263030, + "name": "Redirect All Non-Asset Requests to to index.html", + "phase": "request" + }, + { + "id": 263031, + "name": "Route API Default Requests to API Origin", + "phase": "request" + }, + { + "id": 263032, + "name": "Route Specific API Services to Marketplace Origin", + "phase": "request" + }, + { + "id": 263033, + "name": "Route Specific API Services to Template Engine Origin", + "phase": "request" + }, + { + "id": 263034, + "name": "Route Specific API Services to Script Runner Origin", + "phase": "request" + }, + { + "id": 263035, + "name": "Route Version Control System API to VCS Origin", + "phase": "request" + }, + { + "id": 263036, + "name": "Route User Authentication and Account Management to SSO Origin", + "phase": "request" + }, + { + "id": 263037, + "name": "Route GraphQL City Queries to Cities Origin", + "phase": "request" + }, + { + "id": 263038, + "name": "Rewrite _azrt Cookie", + "phase": "response" + }, + { + "id": 263039, + "name": "Rewrite azsid Cookie", + "phase": "response" + }, + { + "id": 263040, + "name": "Rewrite _azat Cookie", + "phase": "response" + }, + { + "id": 263041, + "name": "Secure Headers", + "phase": "response" + } + ] + }, + "cache-settings": [ + { + "id": 157890, + "name": "Statics - Cache" + }, + { + "id": 157891, + "name": "Marketplace - Cache" + }, + { + "id": 157892, + "name": "Cities - Cache" + } + ] +} \ No newline at end of file diff --git a/vulcan.config.js b/vulcan.config.js new file mode 100644 index 000000000..5be70367d --- /dev/null +++ b/vulcan.config.js @@ -0,0 +1,6 @@ +export default { + preset: { + name: "vue", + mode: "deliver", + } +} \ No newline at end of file From 689c123f8fbcb4218c8877666bb2219885380392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Narciso?= Date: Tue, 25 Jun 2024 18:28:54 +0100 Subject: [PATCH 2/5] fix: cli version (#1353) --- .github/workflows/deploy-production.yml | 2 +- .github/workflows/deploy-stage.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index f5a535915..af17dc194 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -24,7 +24,7 @@ jobs: - name: Download Azion CLI run: | - wget https://github.com/aziontech/azion/releases/download/1.28.1/azion_1.28.1_linux_amd64.apk + wget https://github.com/aziontech/azion/releases/download/1.29.0/azion_1.29.0_linux_amd64.apk apk add --allow-untrusted azion_1.28.1_linux_amd64.apk - name: Configure Azion CLI diff --git a/.github/workflows/deploy-stage.yml b/.github/workflows/deploy-stage.yml index 8b7203a12..184d3ca50 100644 --- a/.github/workflows/deploy-stage.yml +++ b/.github/workflows/deploy-stage.yml @@ -24,7 +24,7 @@ jobs: - name: Download Azion CLI run: | - wget https://github.com/aziontech/azion/releases/download/1.28.1/azion_1.28.1_linux_amd64.apk + wget https://github.com/aziontech/azion/releases/download/1.29.0/azion_1.29.0_linux_amd64.apk apk add --allow-untrusted azion_1.28.1_linux_amd64.apk - name: Configure Azion CLI From 1f5be07458917fdcfd86d01f11bb92bccc8803a2 Mon Sep 17 00:00:00 2001 From: Gabriel Nes <39065202+gabrielnes-azion@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:32:59 -0300 Subject: [PATCH 3/5] fix: CICD CLI (#1354) --- .github/workflows/deploy-production.yml | 4 ++-- .github/workflows/deploy-stage.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index af17dc194..2f68eb0fc 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -25,7 +25,7 @@ jobs: - name: Download Azion CLI run: | wget https://github.com/aziontech/azion/releases/download/1.29.0/azion_1.29.0_linux_amd64.apk - apk add --allow-untrusted azion_1.28.1_linux_amd64.apk + apk add --allow-untrusted azion_1.29.0_linux_amd64.apk - name: Configure Azion CLI run: azion -t ${{ secrets.PLATFORM_KIT_TOKEN }} @@ -34,4 +34,4 @@ jobs: run: azion deploy --auto --config-dir azion/production env: VITE_RECAPTCHA_SITE_KEY: ${{ secrets.PROD_RECAPTCHA_SITE_KEY }} - NODE_ENV: production \ No newline at end of file + NODE_ENV: production diff --git a/.github/workflows/deploy-stage.yml b/.github/workflows/deploy-stage.yml index 184d3ca50..83630abf2 100644 --- a/.github/workflows/deploy-stage.yml +++ b/.github/workflows/deploy-stage.yml @@ -25,7 +25,7 @@ jobs: - name: Download Azion CLI run: | wget https://github.com/aziontech/azion/releases/download/1.29.0/azion_1.29.0_linux_amd64.apk - apk add --allow-untrusted azion_1.28.1_linux_amd64.apk + apk add --allow-untrusted azion_1.29.0_linux_amd64.apk - name: Configure Azion CLI run: azion -t ${{ secrets.PLATFORM_KIT_TOKEN }} @@ -34,4 +34,4 @@ jobs: run: azion deploy --auto --config-dir azion/production env: VITE_RECAPTCHA_SITE_KEY: ${{ secrets.PROD_RECAPTCHA_SITE_KEY }} - NODE_ENV: stage \ No newline at end of file + NODE_ENV: stage From ddb0f7ba5381eb0e6e9596e6aaeb8e120095e801 Mon Sep 17 00:00:00 2001 From: Gabriel Nes <39065202+gabrielnes-azion@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:35:21 -0300 Subject: [PATCH 4/5] fix: Update deploy-stage.yml --- .github/workflows/deploy-stage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-stage.yml b/.github/workflows/deploy-stage.yml index 83630abf2..b598a62f7 100644 --- a/.github/workflows/deploy-stage.yml +++ b/.github/workflows/deploy-stage.yml @@ -31,7 +31,7 @@ jobs: run: azion -t ${{ secrets.PLATFORM_KIT_TOKEN }} - name: Build & Deploy - run: azion deploy --auto --config-dir azion/production + run: azion deploy --auto --config-dir azion/stage env: VITE_RECAPTCHA_SITE_KEY: ${{ secrets.PROD_RECAPTCHA_SITE_KEY }} NODE_ENV: stage From dea240fe019894af1973ad3cc22b607d1e3673ab Mon Sep 17 00:00:00 2001 From: Gabriel Nes <39065202+gabrielnes-azion@users.noreply.github.com> Date: Tue, 25 Jun 2024 15:03:40 -0300 Subject: [PATCH 5/5] fix: CICD deploy-stage.yml --- .github/workflows/deploy-stage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-stage.yml b/.github/workflows/deploy-stage.yml index b598a62f7..660017f1c 100644 --- a/.github/workflows/deploy-stage.yml +++ b/.github/workflows/deploy-stage.yml @@ -35,3 +35,4 @@ jobs: env: VITE_RECAPTCHA_SITE_KEY: ${{ secrets.PROD_RECAPTCHA_SITE_KEY }} NODE_ENV: stage + VITE_ENVIRONMENT: stage