Skip to content

Latest commit

 

History

History
58 lines (33 loc) · 4.17 KB

DEPLOY.md

File metadata and controls

58 lines (33 loc) · 4.17 KB

Deploying the Demo Store

The Demo Store can be deployed wherever you prefer. Please find here below the details about how to do it using some of the most common platforms. If you tested different ways to deploy it or used other services, please join the discussion and share the steps with the community!

GitHub workflows

Configuring GitHub workflows is straightforward. We already created one that can be triggered manually. To do that:

  1. Review the gh-pages.yml file by updating the environment variables. You need and create two secrets in your repository.

    Repository secrets
  2. Now you should be able to run the workflow. This will build your Demo Store statically and deploy the artifact to GitHub Pages.

    Run workflow

ℹ️ Feel free to update the workflow according to your needs. You can trigger the deploy with every git push or change the "Deploy" step (e.g. by publishing the artifact somewhere else such as AWS S3, Netlify, etc.).

⚠️ Make sure to stick to GitHub's guideline about the prohibited-uses: «GitHub Pages is not intended for or allowed to be used as a free web-hosting service to run your online business, ecommerce site, or any other website that is primarily directed at either facilitating commercial transactions [...]» ( )

Netlify

Inside the project root you can find two files: netlify.ssg.toml (for static site generation) and netlify.ssr.toml (for server-side rendering)

  1. Rename one of these into netlify.toml and update the [build.environment] section with the environment variables as you need.

  2. From your Netlify dashboard, click on "Add new site -> Import an existing project" and then select the correct repository.

  3. At this point, you should have some fields already filled in. Click on "Show advanced" and add the missing environment variables: SITE_URL, NEXT_PUBLIC_CL_CLIENT_ID, and NEXT_PUBLIC_CL_ENDPOINT. Please note that you cannot know yet which will be the SITE_URL until Netlify creates a random site name after the first deployment.

    image
  4. Click on "Deploy site". We suggest stopping the first auto-deploy by clicking on "Cancel deploy" because this way you can update the SITE_URL with the correct information first. You can also speed up the deployment by disabling the form detection (the Demo Store project doesn't include forms managed by Netlify).

  5. Trigger a new deploy and enjoy your store up and running. 🚀

Vercel

Server-side rendering

From your Vercel dashboard:

  1. Click on "Add New... -> Project"

  2. Select the correct repository.

  3. Fill in all the required information as per the image below:

    Deploy the Demo Store SSR to Vercel
  4. Click on "Deploy" and in less than 2 minutes your store will be ready to go.

ℹ️ You need to add ENABLE_EXPERIMENTAL_COREPACK=1 as an environment variable since the installed npm version used by Vercel does not run postinstall due to a bug.

Static site generation

If you prefer to go the SSG way you just need to apply the following changes to the information above:

  • Framework preset: Other
  • Build command: npm run export
  • Output directory: demo-store-core/packages/website/out
  • Environment variable: NEXT_PUBLIC_DATA_FETCHING=ssg