Deploy in a staging environment

Edit on GitHub

This document describes how to deploy an application to ECS cluster in a staging environment.

Prerequisites

We use the spryker-staging environment as an example. Adjust the name according to your project name.

In this document, an application version is a Git commit hash string which is set as a Docker Image tag for all Elastic Container Registry (ECR) repositories for the environment.

Example of Git commit hash: 290b955bd06d029c8643c093b58a0cedb86b1c8d

Example of the ECR images with the application version in tags:

  • spryker-staging-b2c-yves:290b955bd06d029c8643c093b58a0cedb86b1c8d
  • spryker-staging-b2c-zed:290b955bd06d029c8643c093b58a0cedb86b1c8d
  • spryker-staging-b2c-glue:290b955bd06d029c8643c093b58a0cedb86b1c8d
  • spryker-staging-frontend:290b955bd06d029c8643c093b58a0cedb86b1c8d
  • spryker-staging-jenkins:290b955bd06d029c8643c093b58a0cedb86b1c8d

1. Check the version to deploy

To deploy a specific application version, copy the version of the respective GitHub commit:

version to deploy

2. Define the version to deploy

  1. In the AWS Management Console, go to Services > Systems Manager > Application Management > Parameter Store.

  2. Select /spryker-staging/desired_version.

  3. Select Edit.

  4. Enter the application version into the Value field.

Deploying *latest*

Enter latest if you want to deploy the last built application version. You can check this version in the /spryker-staging/lastbuildversion parameter in the Parameter Store. We recommend deploying latest in the staging environment to:

  • Keep the application up to date with the latest changes.
  • Avoid updating /spryker-staging/desired_version during each deployment.
  1. Select Save changes.

3. Run a deployment pipeline

  1. In the AWS Management Console, go to Services > CodePipeline.

  2. Select NORMAL_Deploy_Spryker_spryker-staging.

Deploy types

Normal deploy is a pipeline that includes all the stages of a complete CI/CD flow. The Install stage of this pipeline does not perform any dangerous data manipulations like database cleanup or scheduler reset. If you want to reset demo data during deployment, select DESTRUCTIVE_Deploy_Spryker_spryker-staging.

  1. Optional: check the deployed application version and the application version to be deployed:

    1. In the Prepare_versions_information_for_Approval_stage stage, select Details.

    compare application stage

    1. Select Tail logs and check the job output.

    tail logs

    1. Check Deploymnet version and Latest deployed version in the output.

    deployment versions logs

  2. Approve the application version to be deployed:

    1. In the Please_approve stage, select Review.

    2. Review the details and select Approve.

  3. Select Release change.

release change

If the deployment is successful, the /spryker-staging/lastdeployedversion parameter in the Parameter Store is updated with the application version you’ve deployed.

Check the deployed application version

To check the deployed application version in the ECS cluster, do following:

  1. In the AWS Management Console, go to Services > Elastic Container Service.
  2. Select spryker-staging.
  3. Select one of the following services:
    • spryker-staging-storeapp
    • spryker-staging-backoffice
    • spryker-staging-frontend
    • spryker-staging-zed
    • spryker-staging-yves

cluster

  1. Go to the Tasks tab.

  2. Select the task.

select task

  1. In the Image column of the Containers section, ensure that the image name of the container contains the correct application version.

check image task

Roll back an application

To roll back an application:

  1. Find out the application version you want to roll back to. See 1. Check the version to deploy for more details.

  2. In Parameter Store, set the application version as the value of the /spryker-staging/desired_version parameter. See 2. Define the version to deploy for more details.

  3. Run a deployment pipeline as described in 3. Run a deployment pipeline.

Next step

Configuring debugging