Deploying to Google Cloud with Static Web Apps
This deployment example refers to Google Cloud Static Web Apps
Before you get started, you need to have:
In your Custom Application config, provide the Custom Application ID you got when you configured the Custom Application in the Merchant Center.
Using environment variables
In case you want to avoid hardcoding certain values, for example the Application ID, or the Project key, you can use variable placeholders in your Custom Application config.
Set up Google Cloud
Configuring the bucket
Depending on the access options you choose, if you want to configure permissions, select the created bucket, go to the permissions tab and click the
Add link. For the
New principals field, select
AllUsers and for the
Role, search for
Storage Object Viewer. Click
Save to make the bucket publicly accessible.
Creating buckets with domain names requires to verify the ownership of the domain.
Google does not provide a domain by default when using Google Cloud Storage. If you don't have an existing domain, then there are many services through which you can register a new domain, such as Google Domains.
We recommend following the instructions for Domain-named bucket verification to configure things properly.
Another way to verify your domain is by using a load balancer. You have the chance to upload an SSL certificate to your load balancer. If you are using Google Domain Name Service, in your domain configuration, add a new record that points your domain to the IP address of the load balancer you created.
Connect Google Cloud with GitHub Actions
One of the ways to deploy to Google Cloud Storage (GCS) is to use Cloud Storage Uploader GitHub Action. Follow the instructions to integrate it with your repository CI.
Configuring rewrite rules
A Custom Application is a Single-Page Application that uses client-side routing. Therefore, you need to edit website configuration for your bucket to rewrite all requests to serve the
The main command to create the production bundles is
mc-scripts build. The output folder is
See Going to production for more information.
Test your deployment
In the Merchant Center, you can now follow the steps to install the Custom Application and access it in your Projects.