Deploying in a staging environment
- Updated On 15 Sep 2020
- 2 Minutes To Read
This document describes how to deploy an application to ECS cluster in a staging environment.
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:
Example of the ECR images with the application version in tags:
1. Check the version to deploy
To deploy a specific application version, copy the version of the respective GitHub commit:
2. Define the version to deploy
To define the application version to deploy:
In the AWS Management Console, go to Services > Systems Manager > Application Management > Parameter Store.
Enter the application version into the Value field.
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.
- Select Save changes.
3. Run a deployment pipeline
To run a pipeline:
In the AWS Management Console, go to Services > CodePipeline.
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.
Optional: check the deployed application version and the application version to be deployed:
- In the Prepare_versions_information_for_Approval_stage stage, select Details.
- Select Tail logs and check the job output.
Latest deployed versionin the output.
Approve the application version to be deployed:
In the Please_approve stage, select Review.
Review the details and select Approve.
Select 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:
- In the AWS Management Console, go to Services > Elastic Container Service.
- Select spryker-staging.
- Select one of the following services:
Go to the Tasks tab.
Select the task.
- In the Image column of the Containers section, ensure that the image name of the container contains the correct application version.
Roll back an application
To roll back an application:
Find out the application version you want to roll back to. See 1. Check the version to deploy for more details.
Run a deployment pipeline as described in 3. Run a deployment pipeline.