Deploy the integration

Learn to deploy the Digital River commercetools integration.

The Digital River commercetools integration is distributed as a container image and can be deployed to many providers. Use the instructions provided in this topic to deploy the connector for Google Cloud.

Deploy for Google Cloud

To deploy the integration for Google Cloud, you must have gcloud installed and configured so that it can be referenced in the deployment. It is also assumed that you have a Google Cloud project as well as access to the appropriate APIs.

Refer to the Google Cloud documentation and contact your Digital River representative to obtain the plugin container image used for deployment as well as installation instructions. If you do not have a Digital River representative, contact commercetools-Integration@digitalriver.com.

Create a secrets file

Perform this step only once unless values change in the future.

  1. Create an application.yml file with the following values:

    commercetools:
      client-secret: <your commercetools API key client id>
      client-id: <your commercetools API key client secret>
    
    connector:
      secret:
        decryption-key: |
          -----BEGIN RSA PRIVATE KEY-----
          <your private key for decrypting secrets>
          -----END RSA PRIVATE KEY-----
  2. Create a Google Cloud secret to store it. This only needs to be done once, even when updating.

  3. Replace <secret name> with the name you will use for the secret. For example, gcloud secrets create <secret name> --replication-policy="automatic"

  4. Set the secret content. For example: gcloud secrets versions add <secret name> --data-file="path/to/application.yml"

Deploy to CloudRun

For this step, replace <instance name> with the name that you want for your Cloud Run instance. Other values should be substituted as described in Understand integration environment variables.

gcloud beta run deploy <instance name> \
  --region <gcloud region> \
  --image <path to container image ** TODO ** > \
  --no-cpu-throttling \
  --platform managed \
  --allow-unauthenticated \
  --project <project name> \
  --timeout=20m \
  --set-env-vars 'COMMERCETOOLS_PROJECT_KEY=<your commercetools project key>' \
  --set-env-vars "COMMERCETOOLS_AUTH_URL=$<commercetools auth URL>" \
  --set-env-vars "COMMERCETOOLS_API_URL=<commercetools API URL>" \
  --set-env-vars "QUARKUS_OIDC_AUTH_SERVER_URL=<auth server for your commercetools project>" \
  --set-env-vars "CONNECTOR_BASE_URL=<base URL where the connector is reachable>" \
  --set-env-vars "DIGITAL_RIVER_SHIPPING_CALLOUT_ENDPOINT=<connector base URL>/api/v1/shipping-methods/quote" \
  --set-secrets=/secrets/application.yaml=<secret name>:latest

Note: CPU throttling needs to be disabled with Cloud Run to allow for the running of manual synchronization of products.

Subscription setup

For real-time product synchronization, you must have a "topic" that will receive messages from commercetools ProductPublish and ProductUnpublish. The topic needs to be configured to forward messages along to the Publish endpoint in the integration. Use the following steps to do this:

  1. Create a PubSub topic called commercetools_product_publish. The name can be anything of your choosing but must match the one you used in the setup procedure described in Install and configure the Digital River commercetools integration.

  2. Grant roles/pubsub.publisher to subscriptions@commercetools-platform.iam.gserviceaccount.com on this topic. See the commercetools documentation for details.

  3. Create a PubSub push subscription called commercetools_product_publish. The Push endpoint should be {base_url}/api/v1/products/publish where base_url is the location where the integration can be found. Use the following settings guidelines:

    1. The Acknowledgment deadline should be 60 seconds.

    2. The name can be anything you choose. A meaningful name is recommended.

You should make sure the /api/vi/products/publish endpoint is secure. See https://cloud.google.com/run/docs/triggering/pubsub-push for details on how to do this for CloudRun.

Use health endpoints

The integration image has 3 "health" endpoints you can use for startup and monitoring "status" purposes. These are:

  • /q/health/live

  • /q/health/ready

  • /q/health/started

Refer to the Digital River API documentation for more information on how to use these endpoints.

Last updated