Search code examples
javascriptnode.jsamazon-web-servicescontinuous-integrationaws-code-deploy

Continuous deployment for node.js applications using CI and CodeDeploy


I am having trouble figuring out how to setup continuous deployment for my node.js application (through aws CodeDeploy). So far I completed following steps:

  1. Created IAM user with required permissions
  2. Created Elastic Beanstalk instance running node.js
  3. Created CodeDeploy application and linked it to my EC2 instance and IAM user

I have also signed up and set up tests to use with CircleCI a CI I will use for my deployment.

Now I am stuck at stage where I need to create an appspec.yml file that will correctly deploy the application. I am not sure about this one at all, i.e. what source / destination should I specify etc.. Do I need to run my npm build script (creates dist/ folder) at this stage or during my CircleCI tests / builds?


Solution

  • The source is the source of the files that will be deployed. The destination is the place where the files will be deployed to. You might want to run npm build after the files are copied over to the host (you can do this in AfterInstall hook). A list of available hooks as well as the detailed documentations are available here: http://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref.html for further reference.

    Also please be more specific about the questions you have. It is hard to deduce what problems you are experiencing from etc..