Skip to main content
Version: 3.7.x

Update Self-Managed Commerce Images

This topic describes how to update the container images of a Self-Managed Commerce stack, and how to deploy the updated images to your Commerce environments. For an overview of how to update all CloudOps for Kubernetes components, see Update CloudOps for Kubernetes Components.

The Self-Managed Commerce stack in each Commerce environment runs these container images:

  • The Self-Managed Commerce application images, such as cortex and cm.
  • The base images that the application images are built from: amazonlinux-java and tomcat.
  • The activemq image.
  • The mysql image, in Commerce environments that use a MySQL container database.

Where Image Updates Come From​

Java, Tomcat, ActiveMQ, and MySQL​

important

The ops-spec.json file in your ep-commerce branch defines the versions of the Java Virtual Machine (JVM), Apache Tomcat, ActiveMQ, and MySQL. Elastic Path delivers security patches for these components as Self-Managed Commerce patches that update ops-spec.json. To update the JVM, Tomcat, or ActiveMQ, consume these patches and then rebuild and deploy the images.

For more information, see Operations Specification.

Operating System​

The Jenkins jobs build the images from the Elastic Path Docker project. The amazonlinux-java image starts from the latest Amazon Linux 2023 image, and the build installs all available operating system updates. The tomcat and activemq images are built from the amazonlinux-java image. Each build therefore includes the latest operating system updates. The mysql image starts from the latest official MySQL image for the MySQL version that you select.

Rebuild and deploy the images regularly, for example once a month, even when there are no new Self-Managed Commerce patches.

Update the Images​

To update the Commerce images, complete these steps:

  1. Consume the patches.
  2. Build the images.
  3. Deploy the images to each Commerce environment.

Step 1: Consume any Application Patches​

  1. Identify and obtain the latest Self-Managed Commerce patches and merge them into your ep-commerce branch. Include all patches that update ops-spec.json, because these patches update the JVM, Tomcat, and ActiveMQ versions. For instructions, see Consuming Support Fixes in the Self-Managed Commerce documentation.
  2. Review the patch release notes. Note any patch that requires a database update. You must run data population with the update-db command when you deploy those patches.
  3. Update your branch of the Elastic Path Docker project to the latest compatible release. The Jenkins jobs build the base, ActiveMQ, and MySQL images from that project. For the changes in each release, see the Elastic Path Docker Changelog.

Step 2: Build the Images​

Run the below jobs, or a pipeline that runs jobs that build the ep-commerce code and the images.

  1. Run the build-deployment-package Jenkins job. Set epCommerceBranch to the branch that includes the patches.
  2. Run the build-selected-docker-images Jenkins job:
    • Set epCommerceBranch to the same branch. The job reads ops-spec.json from this branch to find the JVM, Tomcat, and ActiveMQ versions.
    • Leave deploymentPackageUrl empty. The job then uses the deployment package that you built in the previous step.
    • Leave the Self-Managed Commerce application images selected, such as buildCortex and buildCm. These are selected by default.
    • Select buildBase and buildActivemq. These are not selected by default.
    • If any of your Commerce environments use a MySQL container database, select buildMysql and set mysqlVersion to the MySQL version of those environments.
    • Set dockerBranch to your branch of the Elastic Path Docker project.
    • Set imageTag to the tag for the new images.

Step 3: Deploy the Images to Each Commerce Environment​

Deploy and test the new images in your non-production environments before you deploy them to production. Keep the author and live environments of a Commerce stack at the same patch level.

tip

Use your existing code deployment process and jobs to roll out the updated Commerce application images.

important

Be sure to update the ActiveMQ container image in each environment. For any environments that use the MySQL containerized database, also update the MySQL container image.

warning

ActiveMQ and the MySQL container each run as one pod. While the pod is replaced, the service is unavailable. Messages and data are kept on persistent volumes. Deploy the updates at a time of low traffic.

To deploy the images to a Commerce environment, complete these steps:

  1. Optionally, retag the images, or promote them from another AWS account, with the pull-docker-images Jenkins job. Do this if it fits your team's tagging or image promotion strategy. If you built a MySQL image, add ep/mysql to the epImageRepos parameter.
  2. Update the services. The procedure depends on the image tag that the environment uses:

Restart the Services​

caution

The services pull their image every time a pod starts. When you build or retag images with a tag that is already deployed, any pod that starts uses the new image, even before you restart the services. For example, pods start when a node is replaced, when the cluster scales, or when a pod fails. The environment can then run a mix of old and new images, or run new code before the database update. You also cannot roll back to the old images by their tag.

The restart-commerce-stack Jenkins job restarts all the services that you specify at the same time. To restart the services in the correct order, run the job several times. Each run waits until its services are running again.

  1. If the environment uses a MySQL container database, run the restart-commerce-stack Jenkins job with containersToRestart set to mysql.
  2. Run the restart-commerce-stack Jenkins job with containersToRestart set to activemq.
  3. If the patches require a database update, run the run-data-pop-tool Jenkins job with the update-db command. Leave restartApps cleared.
  4. Run the restart-commerce-stack Jenkins job with containersToRestart set to searchmaster.
  5. Run the restart-commerce-stack Jenkins job with containersToRestart set to cortex cm integration batch searchslave data-sync mock. The job skips the services that are not deployed in the environment.

Update the Image Tag​

  1. Run the create-or-delete-activemq-container Jenkins job with imageTag set to the new tag. For more information, see Manage ActiveMQ Deployments.
  2. If the environment uses a MySQL container database, run the create-or-delete-mysql-container Jenkins job with imageTag set to the new tag.
  3. If the patches require a database update, run the run-data-pop-tool Jenkins job with the update-db command.
  4. Run the deploy-or-delete-commerce-stack Jenkins job with dockerImageTag set to the new tag.

For more information, see Updating Self Managed Commerce.