Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update deployment best practices for DSR #1621

Merged
merged 9 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions products/digital-sales-rooms/best-practices/app-deployment/aws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
nav:
title: AWS
position: 10

---

# Deploy with AWS Amplify

In this chapter, you will learn how to deploy the frontend source code to [AWS Amplify](https://aws.amazon.com/amplify/).

## Prerequisites

* Register an AWS account.
* Clone the frontend source code and push it to your GitHub repository.
* Download the plugin zip. After extracting it, you will find it inside `/templates/dsr-frontends`.
* Push source code to your Git repository.

## Deploy

* Login to the AWS Amplify Hosting Console.
* Create a new app in AWS Amplify.
* Select and authorize access to your Git repository provider and select the main branch (it will auto deploy when there are some changes in the main branch).
* Choose a name for your app and make sure build settings are auto-detected.
* Set Environment variables under the Advanced Settings section.
* Add `SHOPWARE_STORE_API`, `SHOPWARE_ADMIN_API`, `SHOPWARE_STORE_API_ACCESS_TOKEN`, `SHOPWARE_STOREFRONT_URL`, `ORIGIN` variables with appropriate values.
* Confirm configuration and click on "Save and Deploy".

## Custom domain

After deploying your code to AWS Amplify, you may wish to point custom domains (or subdomains) to your site. AWS has an [instruction](https://docs.aws.amazon.com/amplify/latest/userguide/custom-domains.html).

## Configure sales channel domain

Your website is ready, and you should have a frontend app domain. Please use the current domain to configure [sales channel domain](../../configuration/domain-config.md).
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
nav:
title: Cloudflare
position: 10
position: 20

---

Expand Down Expand Up @@ -49,7 +49,7 @@

* In GitHub Secrets, add `CLOUDFLARE_API_TOKEN` with API token value.
* [Create an API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) in the Cloudflare dashboard with the "Cloudflare Pages — Edit" permission.
* In GitHub environment variables, create new environment named `production`. Add `SHOPWARE_ENDPOINT` and `SHOPWARE_ACCESS_TOKEN` variables with appropriate values.
* In GitHub environment variables, create new environment named `production`. Add `SHOPWARE_STORE_API`, `SHOPWARE_ADMIN_API`, `SHOPWARE_STORE_API_ACCESS_TOKEN`, `SHOPWARE_STOREFRONT_URL`, `ORIGIN` variables with appropriate values.
* Besides `production`, we can add new values for the same variable names in multiple environments such as `development`, `staging`.

### Setup pipeline
Expand Down Expand Up @@ -95,8 +95,12 @@
- name: Build env file
run: |
touch .env
echo SHOPWARE_ENDPOINT=${{ vars.SHOPWARE_ENDPOINT }} >> .env
echo SHOPWARE_ACCESS_TOKEN=${{ vars.SHOPWARE_ACCESS_TOKEN }} >> .env
# echo ALLOW_ANONYMOUS_MERCURE=${{ vars.ALLOW_ANONYMOUS_MERCURE }} >> .env
echo SHOPWARE_STORE_API=${{ vars.SHOPWARE_STORE_API }} >> .env
echo SHOPWARE_ADMIN_API=${{ vars.SHOPWARE_ADMIN_API }} >> .env
echo SHOPWARE_STORE_API_ACCESS_TOKEN=${{ vars.SHOPWARE_STORE_API_ACCESS_TOKEN }} >> .env
echo SHOPWARE_STOREFRONT_URL=${{ vars.SHOPWARE_STOREFRONT_URL }} >> .env
echo ORIGIN=${{ vars.ORIGIN }} >> .env

Check warning on line 103 in products/digital-sales-rooms/best-practices/app-deployment/cloudflare.md

View workflow job for this annotation

GitHub Actions / Runner

[LanguageTool] reported by reviewdog 🐶 If a new sentence starts here, add a space and start with an uppercase letter. (LC_AFTER_PERIOD[1]) Suggestions: ` ORIGIN` Rule: https://community.languagetool.org/rule/show/LC_AFTER_PERIOD?lang=en-US&subId=1 Category: CASING Raw Output: products/digital-sales-rooms/best-practices/app-deployment/cloudflare.md:103:29: If a new sentence starts here, add a space and start with an uppercase letter. (LC_AFTER_PERIOD[1]) Suggestions: ` ORIGIN` Rule: https://community.languagetool.org/rule/show/LC_AFTER_PERIOD?lang=en-US&subId=1 Category: CASING
cat .env

- name: Build code
Expand Down
Loading