Skip to content

AWS CodePipeline

AWS CodePipeline is a continuous integration and continuous delivery (CI/CD) service for fast and reliable application and infrastructure updates. This guide provides instructions on how to configure AWS CodePipeline to deploy Martini packages from your repository.

Overview

AWS CodePipeline automates the build and deployment process for your Martini packages. The pipeline can be configured to either bundle Martini Server Runtime with the packages or focus solely on deploying the packages. The process involves setting up a pipeline that fetches code from your repository, builds the necessary packages, and deploys them to your AWS environment.

Build Options:

  1. martini-build-image.yaml:
    This buildspec builds a Docker image that bundles the Martini Server Runtime with your Martini Packages, giving you control over both the runtime version and the packages within a single deployment. This method is suitable when you need to control both runtime and package versions.

  2. martini-upload-package.yaml:
    This buildspec focuses solely on deploying your Martini packages to an existing Martini Server Runtime instance. This is useful when the runtime remains the same, but frequent package updates are required.

Steps to Configure AWS CodePipeline

  1. Access the CodePipeline Code:
    The AWS CodePipeline configuration code is available on Lonti's GitHub account. You can find it here. This repository contains a setup for building and deploying Martini packages.

  2. Review the README:
    The repository includes a README file with detailed instructions on using the provided code. Review this file to understand the setup and configuration requirements, including choosing between the two buildspec files.

  3. Set Up Your Pipeline:
    Clone the repository from GitHub to your local machine:

    1
    git clone https://github.com/torocloud/martini-build-pipeline-aws-codepipeline.git
    
    Decide whether to use martini-build-image.yaml or martini-upload-package.yaml depending on your scenario..

  4. Configure AWS Parameter Store:

    For martini-build-image.yaml, define the following parameters: - MARTINI_VERSION - AWS_REGION - AWS_ACCOUNT_ID - ECR_REPO_NAME

    For martini-upload-package.yaml, define: - BASE_URL - MARTINI_USER_NAME - MARTINI_USER_PASSWORD

    Set up parameters using the following AWS CLI command:

    1
    PARAMETER=$(aws ssm get-parameter --name "${PARAMETER_NAME}" --with-decryption --query "Parameter.Value" --output text)
    

  5. Start the Pipeline Execution:
    By default, the pipeline starts a build automatically when any change is made in its source repository. However, if you need to rerun the most recent revision through the pipeline, you can do so manually using the CodePipeline console or the AWS CLI's start-pipeline-execution command.

    To manually trigger a pipeline execution, use this command:

    1
    aws codepipeline start-pipeline-execution --name pipeline-name
    

You can also extend your pipeline by adding this command into your pipeline's buildspec file, allowing for automated execution of the pipeline from the most recent revision in its source repository

Additional Resources