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
cortexandcm. - The base images that the application images are built from:
amazonlinux-javaandtomcat. - The
activemqimage. - The
mysqlimage, in Commerce environments that use a MySQL container database.
Where Image Updates Come From
Java, Tomcat, ActiveMQ, and MySQL
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:
Step 1: Consume any Application Patches
- Identify and obtain the latest Self-Managed Commerce patches and merge them into your
ep-commercebranch. Include all patches that updateops-spec.json, because these patches update the JVM, Tomcat, and ActiveMQ versions. For instructions, see Consuming Support Fixes in the Self-Managed Commerce documentation. - Review the patch release notes. Note any patch that requires a database update. You must run data population with the
update-dbcommand when you deploy those patches. - 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.
- Run the
build-deployment-packageJenkins job. SetepCommerceBranchto the branch that includes the patches. - Run the
build-selected-docker-imagesJenkins job:- Set
epCommerceBranchto the same branch. The job readsops-spec.jsonfrom this branch to find the JVM, Tomcat, and ActiveMQ versions. - Leave
deploymentPackageUrlempty. The job then uses the deployment package that you built in the previous step. - Leave the Self-Managed Commerce application images selected, such as
buildCortexandbuildCm. These are selected by default. - Select
buildBaseandbuildActivemq. These are not selected by default. - If any of your Commerce environments use a MySQL container database, select
buildMysqland setmysqlVersionto the MySQL version of those environments. - Set
dockerBranchto your branch of the Elastic Path Docker project. - Set
imageTagto the tag for the new images.
- Set
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.
Use your existing code deployment process and jobs to roll out the updated Commerce application images.
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.
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:
- Optionally, retag the images, or promote them from another AWS account, with the
pull-docker-imagesJenkins job. Do this if it fits your team's tagging or image promotion strategy. If you built a MySQL image, addep/mysqlto theepImageReposparameter. - Update the services. The procedure depends on the image tag that the environment uses:
- If the environment already uses the tag of the new images, see Restart the Services.
- If the environment uses a different tag, see Update the Image Tag.
Restart the Services
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.
- If the environment uses a MySQL container database, run the
restart-commerce-stackJenkins job withcontainersToRestartset tomysql. - Run the
restart-commerce-stackJenkins job withcontainersToRestartset toactivemq. - If the patches require a database update, run the
run-data-pop-toolJenkins job with theupdate-dbcommand. LeaverestartAppscleared. - Run the
restart-commerce-stackJenkins job withcontainersToRestartset tosearchmaster. - Run the
restart-commerce-stackJenkins job withcontainersToRestartset tocortex cm integration batch searchslave data-sync mock. The job skips the services that are not deployed in the environment.
Update the Image Tag
- Run the
create-or-delete-activemq-containerJenkins job withimageTagset to the new tag. For more information, see Manage ActiveMQ Deployments. - If the environment uses a MySQL container database, run the
create-or-delete-mysql-containerJenkins job withimageTagset to the new tag. - If the patches require a database update, run the
run-data-pop-toolJenkins job with theupdate-dbcommand. - Run the
deploy-or-delete-commerce-stackJenkins job withdockerImageTagset to the new tag.
For more information, see Updating Self Managed Commerce.