Skip to main content
Version: 4.0.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​

How the images get operating system updates depends on which Jenkins jobs you use to build them.

  • Existing Jenkins build jobs: The existing CloudOps for Kubernetes Jenkins build jobs from release 3.x 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.

  • New V2 pipelines: The new V2 pipelines, introduced in CloudOps for Kubernetes 4.0.x, build the images with the Self-Managed Commerce build tools in your ep-commerce branch. These build tools use a pinned Amazon Linux base image version, and they do not install operating system updates. Rebuilding an image without new patches does not add operating system updates to it. The images get new operating system updates when you consume a Self-Managed Commerce patch that updates the pinned base image version.

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. If you use the existing Jenkins build jobs, also update your branch of the Elastic Path Docker project to the latest compatible release. These 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.

Using the Existing Jenkins Jobs​

  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.

Using the New V2 Pipelines​

Run the v2-build-commerce-images Jenkins job:

  • Set epCommerceBranch to the branch that includes the patches.
  • Leave buildJava, buildTomcat, and buildActivemq selected.
  • If any of your Commerce environments use a MySQL container database, leave buildMysql selected and set mysqlVersion to the MySQL version of those environments. If the parameter is empty, the job builds the default MySQL version of your ep-commerce code, which might be different.

The default image tag is a short hash of the ep-commerce Git commit.

For more information, see V2 Builds and Artifacts.

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​

Using the Existing Jenkins Jobs​
  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.

Using the New V2 Pipelines​

To update all the services, complete these steps:

  1. In the environment files in environments/<kubernetesNickname>/, set imageTag to the new tag in these files:
    • activemq-values.yaml
    • mysql-container.yaml, if the environment uses a MySQL container database
    • commerce-values.yaml
  2. Commit and push the changes to the Git branch that the job reads the environment files from.
  3. Run the v2-configure-commerce-environment Jenkins job:
    • Set envFileSource to fromGit.
    • Set commerceImageTagSource to fromYaml. With the default value, fromCluster, the job does not change the image tag of the Self-Managed Commerce services.
    • If the patches require a database update, set dataPopCommand to update-db.

If you rebuilt only the Self-Managed Commerce application images, run the v2-deploy-commerce-images Jenkins job instead. Set sourceImageTag to the new tag. If the patches require a database update, set dataPopCommand to update-db.

For more information, see Configuring Environments with V2 Pipelines and Environment Files Reference.