Giter Club home page Giter Club logo

docker-amazonlinux2-codedeploy's Introduction

docker-amazonlinux2-codedeploy

Custom Docker Image to Test and Debug AWS CodeDeploy locally with Node.js.

Motivation

AWS CodeDeploy is a powerful service for automating deployments to Amazon EC2, AWS Lambda, and on-premises servers. However, it can take some effort to get complex deployments up and running or to identify the error in your application when something goes wrong.

The proper way to deal with CodeDeploy is by testing and debugging it locally and once everything working properly fire your deployment process in AWS CodeDeploy.

However, to have a CodeDeploy environment up and running locally is not so trivial, at least until now! ๐Ÿป

About this image

Amazonlinux in Docker (created via FROM amazonlinux:2) is so bare and empty that it doesn't even have basic stuffs like sudo or passwd. New AWS EC2 instances do. Plus this image contains the current Node.js LTS version (12) and Yarn Package Manager.

Now, we can work very close to a fresh EC2 instance running in Docker.

On top of it, we have all AWS CodeDeploy stuff installed to you playing with it locally.

How to use this image

Preparing your container

  • Run a container in privileged mode with docker run --name awscodedeploy -d --privileged richardsilveira/amazonlinux2-codedeploy:latest.
  • Go inside it with docker exec -it awscodedeploy bash
  • Start the CodeDeploy agent service codedeploy-agent start
  • Check the status of the agent through service codedeploy-agent status (sometimes you'll need to exec start command above again)
  • Create an codedeploy-local alias with alias codedeploy-local='sudo /opt/codedeploy-agent/bin/codedeploy-local'

Note: Don't leave your container, you'll work a lot here while testing your deployment.

Testing/Debugging your deployment

Go to your app root directory (at same level of your appspec.yml file), zip your app and copy the zip into the running container with docker cp <yourapp>.zip awscodedeploy:/.

Now, back to your running container run codedeploy-local --bundle-location <yourapp>.zip -t zip --deployment-group my-deployment-group

As soon the execution is done, a message like this See the deployment log at /opt/codedeploy-agent/deployment-root/my-deployment-group/<randomidentifier>-local/logs/scripts.log for more details will be showed at console, then you check whats is going on with your deployment by running cat /opt/codedeploy-agent/deployment-root/my-deployment-group/<randomidentifier>-local/logs/scripts.log.

Note: Don't forget that it's a regular EC2 instance running locally, so, you can install everything you need to reproduce your application up and running in AWS Cloud environment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.