{"id":1832,"date":"2017-02-27T19:22:28","date_gmt":"2017-02-27T18:22:28","guid":{"rendered":"https:\/\/blog.mi.hdm-stuttgart.de\/?p=1832"},"modified":"2023-06-09T14:20:35","modified_gmt":"2023-06-09T12:20:35","slug":"continuous-integration-with-travis-ci-and-amazon-webservices","status":"publish","type":"post","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/","title":{"rendered":"Continuous Integration with Travis CI and Amazon Webservices"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>In the the course <em>Software Engineering and Management<\/em> and<em> Interactive Media at Stuttgart<\/em> Media University, we launched an interactive web application called <strong>Emoji College<\/strong>.<\/p>\n<blockquote><p><a href=\"http:\/\/emoji.college\/\">www.emoji.college<\/a><\/p><\/blockquote>\n<p>The following blog entry is a brief description of what is going on in this project. The main focus relies on the implementation of a continuous integration pipeline with <strong><a href=\"https:\/\/travis-ci.org\">TravisC<\/a><a href=\"https:\/\/travis-ci.org\">I<\/a><\/strong> and hosting with <a href=\"https:\/\/aws.amazon.com\"><strong>AWS<\/strong><\/a>. As newcomers in dealing with AWS services it was not easy for us to get started. We have had to try a lot and have paid too much money for the services. Therefore it is our mission to explain the most important steps during the setup of AWS services easily and mention all the lessons learned. So far, there is no easy and understandable guide as we needed it.<\/p>\n<p><!--more--><\/p>\n<p>Therefore this article is relevant to all who want to operate a <a href=\"https:\/\/nodejs.org\/en\/\"><strong>Node.js<\/strong><\/a>\u00a0application with <strong>TravisCI<\/strong> and AWS such as <strong>EC2 Instances<\/strong> and <strong>CodeDeploy<\/strong>.<\/p>\n<h2>Emoji.College<\/h2>\n<p>Users of social media and instant messengers know this phenomenon very well: Emojis are often misused in the respective context and can lead not only to disagreements in the communication, but also to hard-hitting misunderstandings.<\/p>\n<p>Almost every teenager was able to experience the phase in which parents dared to take the first tentative steps in mobile communications and quickly made great progress with all kind of weird Emoji combinations. New technologies fascinate everyone and new features also want to be used. According to the old Microsoft Powerpoint principle: include all features such as animations which are given. But not only adults do mistakes with Emojis. Young people also have difficulties. Most of the Emoji are originated in Asia and the correct meaning is often not plausible for us. We often use false Emojis without knowing the original meaning.<\/p>\n<p>Especially in fast-paced, written communication, it is distinctly important to communicate clearly, since the scope for interpretation is particularly large. Gestures and other human aspects of communication are no longer there. So the Emojis are more than just a yellow circle with a smiling face. It is the expression of bundled emotions that we desperately try to integrate into written communication.<\/p>\n<p>So the correct use with Emojis has to be learned. <b>www.emoji.college<\/b> solves this problem and provides a quick quiz through most controversial Emojis with the association of a college\/school environment. If you pass the quiz, you also graduate at Emoji College and get an individual certificate.<\/p>\n<h2>Technical aspects<\/h2>\n<p>The web application (emoji.college) consists of a client side user interface as well as a server side backend for the provision of the data and assets.<\/p>\n<h3>Server<\/h3>\n<p>Based on the JavaScript runtime Node.js with a <a href=\"https:\/\/www.mongodb.com\"><b>MongoDB<\/b><\/a> database we setup the server.<\/p>\n<p>Instead of the common <a href=\"http:\/\/expressjs.com\/\"><strong>Express.js<\/strong><\/a> we use <a href=\"https:\/\/hapijs.com\/\"><b>Hapi.js<\/b><\/a>. This is also a Web Application Framework (WAF) for Node.js. It was developed by Walmart Labs and represents a good alternative to Express.js. The advantage of Hapi.js is that most of the modules are sponsored by large corporations, that is why, a continuous development can be expected. Also <a href=\"http:\/\/www.nearform.com\/\"><strong>nearForm<\/strong><\/a> \u2013 the world&#8217;s largest Node Consultancy \u2013 mainly uses Hapi in its projects. Although the number of users compared to Express.js is low, high-quality enterprise applications are primarily implemented with security, performance and durability first.<\/p>\n<h3>Client<\/h3>\n<p>At the client side we worked with <a href=\"https:\/\/angularjs.org\/\"><b>AngularJS<\/b><\/a>, <a href=\"http:\/\/sass-lang.com\/\"><b>SASS<\/b><\/a> and lots of features such as internationalization and request recovery. All this frontend stuff is bundled and processed with <a href=\"https:\/\/webpack.github.io\/\"><b>webpack<\/b><\/a> and a bunch of plugins.<\/p>\n<p>However, we do not want to deal so much with the technical subtleties of this special application, but rather generally describe how to set up the services that enable continuous integration. At each point, we look at our experience and say what you have to look out for.<\/p>\n<h2>Set up AWS &amp; Travis CI<\/h2>\n<h3>Why Travis CI:<\/h3>\n<p>Travis CI is probably one of the most easiest CI servers to get started with. Apart from being open source and free to host on your own infrastructure (above all if you are a student :)), Travis CI offers a SaaS version that allows free testing for open source projects. Setup is as easy as linking your GitHub account, giving the relevant permissions and updating the .travis.yaml file with your project specific requirements. So Travis uses <a href=\"https:\/\/github.com\/\"><strong>GitHub<\/strong><\/a> webhooks to run your project\u2019s test suite whenever you push new changes, demonstrating the health of a project\u2019s code and answering the fundamental question, \u201cDoes this thing even work?\u201d.<\/p>\n<h2>Which AWS services do you need?<\/h2>\n<p>Amazon Elastic Computer Cloud (Amazon <b>EC2<\/b>) is a web-based service that allows to run application programs in the Amazon Web Services (AWS) public cloud. EC2 enables developers to spin up virtual machines which provide compute capacity for IT projects and cloud workloads that run with global AWS data centers. So the entire project will be hosted on such an (EC2) instance.<\/p>\n<p>To get an continuous integration\/delivery service you need at least AWS CodeDeploy:<\/p>\n<p><strong>AWS<\/strong> <b>CodeDeploy<\/b> is a service that automates code provisioning for arbitrary instances, including Amazon EC2 and local servers. AWS CodeDeploy makes it easy to deploy quickly new features, avoid downtime during application deployment and simplify complex updates to your applications. You can use AWS CodeDeploy to automate software deployments, eliminating the need for error-prone manual operations. The service scales with your infrastructure, so you can easily provide code for one or thousands of instances.<\/p>\n<p>To visualise the CI process, Amazon offers a service to illustrate the whole process with an GUI. It\u2019s called CodePipeline. <strong>AWS<\/strong> <b>CodePipeline<\/b> is a continuous delivery service for fast and reliable application updates. CodePipeline develops, tests, and provides your code each time code is changed based on the models you have defined for the publishing process. This allows you to deliver functions and updates quickly and reliably. You can easily create a complete solution by using the pre-built plug-ins for popular third-party services such as GitHub. <b>AWS CodeBuild<\/b> is a pendant product from TravisCI. We decided to use Travis because the GitHub integration Service seems to be much better and we heard about the easy handling. So we just wanted to try it once. Of course you can use other AWS services such as CodePipeline or CodeBuild for the continuous delivery and its visualisation as well. The workflow is quite good.<\/p>\n<p>In the following we explain the sequence and the interaction of the individual services in an illustration:<a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.26.13.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1834\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2017-02-22-um-14-26-13\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.26.13.png\" data-orig-size=\"1024,545\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2017-02-22 um 14.26.13\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.26.13-1024x545.png\" class=\"alignnone size-full wp-image-1834\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.26.13.png\" alt=\"\" width=\"1024\" height=\"545\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.26.13.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.26.13-300x160.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.26.13-768x409.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h3>Steps to host on AWS<\/h3>\n<h4>1. Configuration AWS<\/h4>\n<p>First thing you have to is to apply the IAM (Identity and Access Management) settings.<\/p>\n<p><a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.11.06.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1836\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-11-06\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.11.06.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.11.06\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.11.06-1024x640.png\" class=\"wp-image-1836 size-medium alignright\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.11.06-300x188.png\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.11.06-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.11.06-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.11.06-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.11.06.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It is important to do this at the very beginning of the installation process in order to not get problems when granting rights later on.<\/p>\n<p>Define: <b>Users, Groups <\/b>and<b> Roles.<\/b><\/p>\n<p>For users you have to download an <i>Accesskey<\/i> and a <i>Secret Accesskey<\/i>.<\/p>\n<p>You can put users in groups. This makes sense if many users with different permissions\/rights work with AWS.<a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-06-um-18.31.41.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1837\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2017-02-06-um-18-31-41\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-06-um-18.31.41.png\" data-orig-size=\"1280,677\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2017-02-06 um 18.31.41\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-06-um-18.31.41-1024x542.png\" class=\"alignright size-medium wp-image-1837\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-06-um-18.31.41-300x159.png\" alt=\"\" width=\"300\" height=\"159\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-06-um-18.31.41-300x159.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-06-um-18.31.41-768x406.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-06-um-18.31.41-1024x542.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-06-um-18.31.41.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In our case we have only one role that grants access between EC2 and CodeDeploy. Its name is \u201cCodeDeploy\u201d. Check the Customer Policies for that and just check on the corresponding option for the permission.<\/p>\n<p>The configuration of the Identity and Access Management are outsourced in a separate service. So if everything is set correctly there are no problems when setting up the actual services (EC2 and CodeDeploy). We can therefore dedicate ourselves to the establishment of the instance.<\/p>\n<h4>2. Configuration EC2 instances<\/h4>\n<p>The range of available instances is very large. You can choose different instances depending on the application. In our case the second smallest instance fits perfectly.<a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.23.49.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1839\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-23-49\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.23.49.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.23.49\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.23.49-1024x640.png\" class=\"alignright size-medium wp-image-1839\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.23.49-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.23.49-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.23.49-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.23.49-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.23.49.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The instances are classified according to T2, M4, M3, C4, C3, X1 etc.<\/p>\n<p>Each type is for its own application. This must be discussed in detail. We use the t2.micro instance. This offers us at least 1GB RAM and a vCPU with 2.5 GHz (Intel Xeon). The cost is 1.2 cents per hour.<\/p>\n<p><b>Beware of the costs!<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1840\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-09-49\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.09.49.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.09.49\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.09.49-1024x640.png\" class=\"alignright size-medium wp-image-1840\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.09.49-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.09.49-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.09.49-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.09.49-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.09.49.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>The M4 instance with ssd memory and 8GB RAM costs about 10 ct\/h and a small X1 instance with nearly 2000GB RAM costs already $13\/h. If you start such an instance, a lot of money is accumulated very quickly. Be aware of what you start at any time, especially if you pay attention to money.<\/p>\n<p>Speaking of costs. Next, you can select the <b>virtual machine <\/b>you want to install on the instance. Operating systems do not cost directly. They are charged by runtime of the instance. In our case, the price per hour increases to 1.7 Cents per hour by installing Ubuntu. Windows Servers are much more expensive.<a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.21.47.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1841\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-21-47\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.21.47.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.21.47\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.21.47-1024x640.png\" class=\"alignright size-medium wp-image-1841\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.21.47-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.21.47-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.21.47-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.21.47-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.21.47.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Next, create <b>security groups<\/b>. As with any server, the ports must be exposed here.<\/p>\n<p>Next, apply <b>key pair<\/b> and download it. Now you can access the instance via ssh now. Amazon helps you connection via ssh. Press \u201cConnect\u201d for that information given in the screenshots.<\/p>\n<p><a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.22.04.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1842\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-22-04\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.22.04.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.22.04\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.22.04-1024x640.png\" class=\"size-medium wp-image-1842 alignleft\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.22.04-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.22.04-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.22.04-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.22.04-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.22.04.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-16.17.39.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1843\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-16-17-39\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-16.17.39.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 16.17.39\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-16.17.39-1024x640.png\" class=\"alignright size-medium wp-image-1843\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-16.17.39-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-16.17.39-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-16.17.39-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-16.17.39-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-16.17.39.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now the IAM role must be linked to the instance. If the only role created exists, it can be easily selected via the properties of the instance. In our case it\u2019s &#8220;CodeDeploy&#8221;.<\/p>\n<p>If you want to use your own IP address or domain we would suggest to set up the Elastic IP now. Then it will map it over the public IP given by AWS specific for the instance. To separate development and productive branch, we have created two t2.micro instances, each of them has been assigned a subdomain. Attention, every registered Elastic IP costs money. It\u2019s not included!<\/p>\n<p>Next, we will have a look, how to set up node.js and database on the just newly created instances.<\/p>\n<h4>3. Work on Server<\/h4>\n<p>The next steps are carried out via the shell input.<\/p>\n<p>To install Node.js, we use the <a href=\"https:\/\/github.com\/creationix\/nvm\">Node Version Manager<\/a>.\u00a0This allows to run several versions of Node.js on the server.<\/p>\n<pre class=\"prettyprint lang-sh\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">curl -o- https:\/\/raw.githubusercontent.com\/creationix\/nvm\/v0.33.0\/install.sh | bash<\/pre>\n<p>The database has to be installed next. You can install MongoDB by typing this command:<\/p>\n<pre class=\"prettyprint lang-sh\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">sudo apt-get install -y mongodb-org<\/pre>\n<p>We are running the application on port 8080. So you have to redirect port 80 to port 8080 to make it accessible from the outside. Run this command:<\/p>\n<pre class=\"prettyprint lang-sh\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080<\/pre>\n<p>Now requests to port 80 will get mapped\/redirected to port 8080.<\/p>\n<p>Another essential component that has to be installed is the CodeDeploy agent. The AWS CodeDeploy agent is a software package that, when installed and configured on an instance, enables that instance to be used in AWS CodeDeploy deployments.<\/p>\n<p>A configuration file is placed on the instance when the agent is installed. This file is used to specify how the agent works. This configuration file specifies directory paths and other settings for AWS CodeDeploy to use as it interacts with the instance.<\/p>\n<p>To install this agent you have to install ruby first. It has to be exact version 2.0!<\/p>\n<p>Use the following commands:<\/p>\n<pre class=\"prettyprint lang-sh\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">sudo apt-get -y update\n\nsudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev\n\ncd \/tmp\n\nwget http:\/\/cache.ruby-lang.org\/pub\/ruby\/2.0\/ruby-2.0.0-p481.tar.gz\n\ntar -xvzf ruby-2.0.0-p481.tar.gz\n\ncd ruby-2.0.0-p481\/\n\n.\/configure --prefix=\/usr\/local\n\nmake\n\nsudo make install<\/pre>\n<p>Now you can start to install the CodeDeploy agent:<\/p>\n<pre class=\"prettyprint lang-sh\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">cd \/home\/ubuntu\n\nwget https:\/\/aws-codedeploy-eu-central-1.s3.amazonaws.com\/latest\/install\n\nchmod +x .\/install\n\nsudo .\/install auto<\/pre>\n<p>Of cause you have to change the region of the running instance. We are running the EC2 instances in Frankfurt (eu-central-1)<\/p>\n<p>Check the running status with:<\/p>\n<pre class=\"prettyprint lang-sh\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">sudo service codedeploy-agent status<\/pre>\n<p>If the AWS CodeDeploy agent is installed and running, you should see a message like:<\/p>\n<p><em>The AWS CodeDeploy agent is running.\u00a0<\/em><\/p>\n<p>Now all requried systems are running on your instance.\u00a0It\u2019s time to set up Travis CI and and CodeDeploy.<\/p>\n<h4>4. Configuration CodeDeploy<\/h4>\n<h5>4.1 Wizard<\/h5>\n<p>The configuration of CodeDeploy can now carried out by the step by step wizard.<\/p>\n<p>First create a deployment group and the corresponding application when necessary. If there is no application yet, it is possible to create the application while creating the deployment group.\u00a0<a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.24.44.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1845\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-24-44\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.24.44.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.24.44\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.24.44-1024x640.png\" class=\"alignright size-medium wp-image-1845\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.24.44-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.24.44-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.24.44-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.24.44-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.24.44.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Furthermore, it is necessary to specify the instances to which you want to deploy your application. The available instances should be listed in the Value dropdown. The Tag Type is Amazon EC2. Here we show how the production instance links the corresponding EC2 instance with CodeDeploy to completely build the continuous integration pipeline.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1846\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-25-00\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.00.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.25.00\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.00-1024x640.png\" class=\"alignright size-medium wp-image-1846\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.00-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.00-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.00-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.00-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.00.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>There are several deployment configurations, according to one\u2019s means. All three configurations\/strategies are described in the <a href=\"http:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/deployment-configurations.html\">AWS documentation.<\/a><a href=\"http:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/deployment-configurations.html\"><br \/>\n<\/a>Because we use just one instance per stage\/group, we chose the \u201cAllAtOnce\u201d strategy.<\/p>\n<p><a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.07.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1847\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-25-07\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.07.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.25.07\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.07-1024x640.png\" class=\"alignright size-medium wp-image-1847\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.07-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.07-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.07-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.07-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.07.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Last but not least link the corresponding IAM role from the very beginning of this tutorial as a service role. It is also possible to split the permissions\/roles related to CodeDeploy and further stuff. Click on \u201cCreate Deployment Group\u201d and TA-DAAAH!<\/p>\n<p><a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.20.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1848\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2016-11-11-um-15-25-20\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.20.png\" data-orig-size=\"1280,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2016-11-11 um 15.25.20\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.20-1024x640.png\" class=\"aligncenter size-large wp-image-1848\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.20-1024x640.png\" alt=\"\" width=\"656\" height=\"410\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.20-1024x640.png 1024w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.20-300x188.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.20-768x480.png 768w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2016-11-11-um-15.25.20.png 1280w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/a><\/p>\n<p>The creation process of the deployment group is finished. Now proceed to the step \u2013 the setup of Travis CI \u2013 to complete the continuous integration pipeline.<\/p>\n<p>If the deployment fails, not yet in Travis CI but in CodeDeploy, it is possible to inspect the error logs. Visit <strong>CodeDeploy &gt; Deployments<\/strong> and click on the corresponding deployment id. With an further click on \u201cview events\u201d CodeDeploy enables to inspect hook specific error logs.<\/p>\n<h5>4.2 Configuration Files<\/h5>\n<p>The second part of the CodeDeploy configuration is defined in a configuration file called <a href=\"http:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/app-spec-ref.html\"><strong>appspec.yml<\/strong><\/a> and some linked shell scripts for the <a href=\"http:\/\/docs.aws.amazon.com\/codedeploy\/latest\/userguide\/app-spec-ref-hooks.html\"><strong>deployment hooks<\/strong><\/a>.<\/p>\n<pre class=\"prettyprint lang-xquery\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">version: 0.0\nos: linux\nfiles:\n  - source: \/\n    destination: \/home\/ubuntu\/emoji\npermissions:\n  - object: \/\n    pattern: \"**\"\n    owner: ubuntu\nhooks:\n  AfterInstall:\n    - location: \/bin\/hook-afterinstall.sh\n      runas: ubuntu<\/pre>\n<p>In this configuration file it is specified that Linux is used as operational system. Furthermore, we copy all files of the repository root directory to the defined destination on the EC2 instance. Additionally we set our user &#8220;ubuntu&#8221; as owner of the copied files\/directories. Last but not least there are several hooks. For Node.js application the <strong>AfterInstall hook<\/strong> is the most import. The hook is emitted\u00a0if the copy process is finished. The hooks enable to define a shell script file and the executing user.<\/p>\n<p>In our case the corresponding shell script looks like:<\/p>\n<pre class=\"prettyprint lang-sh\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">#!\/bin\/bash\n\ncd \/home\/ubuntu\/emoji\/\nnpm install\nnpm rebuild\nnpm run build:client\nnpm run build:server\nnpm run go<\/pre>\n<p>This script just enters the respective directory, installs\/rebuilds the npm modules, runs our build scripts and the server process. That&#8217;s it.<\/p>\n<h4>5. Working with Travis<\/h4>\n<p>Travis enables to configure the continuous integration in a fast and easy manner. The whole configuration is defined in your <a href=\"https:\/\/docs.travis-ci.com\/user\/customizing-the-build\"><strong>.travis.yml<\/strong><\/a> file based in the root directory. At the very beginning the used language (Node.js v6.X in this case) and some other basics are defined. The following lines of code are the core: the before_script, the script, the branches and the deploy part. The hook before_script is used to run some commands just before the literal commands. In our case all the <a href=\"https:\/\/www.npmjs.com\/\"><strong>npm<\/strong><\/a> module defined in <a href=\"https:\/\/docs.npmjs.com\/files\/package.json\"><strong>package.json<\/strong><\/a> will be installed. Additionally <a href=\"https:\/\/docs.docker.com\/compose\/\"><strong>docker-compose<\/strong><\/a> enables to run a simple mongo database as daemon. Afterwards some commands will be run to check the code quality with unit tests and static code analysis. The branches section defines that just pushes and pull requests on the listed branches will trigger this continuous integration pipeline.<\/p>\n<p><a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.59.18.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1849\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/27\/continuous-integration-with-travis-ci-and-amazon-webservices\/bildschirmfoto-2017-02-22-um-14-59-18\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.59.18.png\" data-orig-size=\"423,590\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bildschirmfoto 2017-02-22 um 14.59.18\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.59.18.png\" class=\"alignright size-full wp-image-1849\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.59.18.png\" alt=\"\" width=\"423\" height=\"590\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.59.18.png 423w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.59.18-215x300.png 215w\" sizes=\"auto, (max-width: 423px) 100vw, 423px\" \/><\/a><\/p>\n<p>In case the of pushes (or merged pull requests) travis will continue with the deploy section. It is possible to clarify multiple deployment providers. Just because of Amazon EC2 as IaaS it is necessary to use codedeploy as provider. Add the credentials (secret key and secret access key) defined within the IAM service before, the region and even the name of the application respective the deployment group. The last-mentioned properties are related to CodeDeploy. Furthermore, it is allowed to restrict the branches per provider. Like in the code snippet above, use one Amazon EC2 instance per branch to induce stages. The last part related to notifications is not mandatory.<br \/>\nFinally visit travis (travis.org or travis.com, depending on the publishing state), connect your GitHub account and select the repository. That\u2019s it.<\/p>\n<h2>Conclusion:<\/h2>\n<p>It is not necessary to use all AWS tools to set up a working and handy continuous integration and delivery. With this blog entry, we show that a combination of Travis CI and AWS is a good way to build a solid pipeline. Especially for small Node.js applications, this is a very good option because you can save money by dispensing with as many AWS services as possible. It is also a good start at AWS. The complex entanglements between the individual services are, in fact, unclear. We made the experience that by trying individual services very much money is consumed very quickly. Therefore, we recommend to set up the pipeline accordingly. It can be further extended with AWS products. There are some tools (for example CodePipeline) that enables to get more and more into and also facilitate the handling of larger projects.<\/p>\n<p>Finally be aware of all the costs accumulating over the time and with every new service.<\/p>\n<p>Use the billing section\/service of the Amazon Web Services to get detailed insights.<\/p>\n<hr \/>\n<p style=\"text-align: center;\">Felix Heck | CS3 \u00a0[<a href=\"mailto:fh092@hdm-stuttgart.de\">fh092@hdm-stuttgart.de<\/a>]<\/p>\n<p style=\"text-align: center;\">Simon Tolksdorf | CS3 [<a href=\"mailto:st067@hdm-stuttgart.de\">st067@hdm-stuttgart.de<\/a>]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In the the course Software Engineering and Management and Interactive Media at Stuttgart Media University, we launched an interactive web application called Emoji College. www.emoji.college The following blog entry is a brief description of what is going on in this project. The main focus relies on the implementation of a continuous integration pipeline with [&hellip;]<\/p>\n","protected":false},"author":195,"featured_media":1834,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[659,650,651,2],"tags":[88,77,84,89,90,24,87,85,78,86],"ppma_author":[717],"class_list":["post-1832","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-scalable-systems","category-system-designs","category-system-engineering","tag-amazon-elastic-cloud","tag-amazon-web-services","tag-aws","tag-codedeploy","tag-codepipeline","tag-ci","tag-ec2","tag-emoji","tag-jenkins","tag-travis"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/Bildschirmfoto-2017-02-22-um-14.26.13.png","jetpack-related-posts":[{"id":3314,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2018\/03\/28\/continuous-integration-deployment-for-a-cross-platform-application-part-1\/","url_meta":{"origin":1832,"position":0},"title":"Continuous Integration &#038; Deployment for a Cross-Platform Application &#8211; Part 1","author":"Tobias Eberle, Marco Maisel, Tobias Staib, Mario Walz","date":"28. March 2018","format":false,"excerpt":"When we started the project \"Flora CI\" for the lecture \"System Engineering\", we planned to deal with Continuous Integration. As an important aspect of software engineering all of us have previously been involved in projects where code of developers had to be merged and builds had to be automated somehow.\u2026","rel":"","context":"In &quot;DevOps&quot;","block_context":{"text":"DevOps","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/scalable-systems\/devops\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2018\/03\/flora-app.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2018\/03\/flora-app.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2018\/03\/flora-app.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2018\/03\/flora-app.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2018\/03\/flora-app.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2018\/03\/flora-app.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":79,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2015\/12\/29\/sesame-deployment-street-continuous-integration-with-jenkins-tutorial-part-1\/","url_meta":{"origin":1832,"position":1},"title":"Jenkbird \u2013 Continuous Integration with Jenkins Tutorial \u2013 Part 1","author":"Marc Stauffer","date":"29. December 2015","format":false,"excerpt":"Bad days happen to everyone, but when one happens to you, just keep doing your best and never let a bad day make you feel bad about yourself.\u201d \u2014 Big Bird about\u00a0a day with deployment problems \"Continuous Integration\" (CI) and \"Continuous Delivery\" (CD) are topics every modern software developer should\u2026","rel":"","context":"In &quot;DevOps&quot;","block_context":{"text":"DevOps","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/scalable-systems\/devops\/"},"img":{"alt_text":"Jenkbird","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2015\/12\/Yhfrwka16hgJOdDTrwFaVPWfBhzA72MWv9qwzj-tvdA-217x300.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":22151,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2022\/02\/22\/designing-and-implementing-a-scalable-web-application\/","url_meta":{"origin":1832,"position":2},"title":"Designing the framework for a scalable CI\/CD supported web application","author":"Danial Eshete","date":"22. February 2022","format":false,"excerpt":"Documentation of our approaches to the project, our experiences and finally the lessons we learned. The development team approaches the project with little knowledge of cloud services and infrastructure. Furthermore, no one has significant experience with containers and\/or containerized applications. However, the team is well experienced in web development and\u2026","rel":"","context":"In &quot;Allgemein&quot;","block_context":{"text":"Allgemein","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/allgemein\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/02\/Design_Desktop_Logged_In-3-150x150.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/02\/Design_Desktop_Logged_In-3-150x150.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/02\/Design_Desktop_Logged_In-3-150x150.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/02\/Design_Desktop_Logged_In-3-150x150.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/02\/Design_Desktop_Logged_In-3-150x150.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/02\/Design_Desktop_Logged_In-3-150x150.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1984,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/03\/09\/building-an-hdm-alexa-skill-part-4\/","url_meta":{"origin":1832,"position":3},"title":"Building an HdM Alexa Skill &#8211; Part 4","author":"Malte Vollmerhausen","date":"9. March 2017","format":false,"excerpt":"We present our own HdM Alexa Skill and share the experience we gained throughout this project. This time: Automating tests and deployment with Continuous Integration via Jenkins.","rel":"","context":"In &quot;Student Projects&quot;","block_context":{"text":"Student Projects","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/student-projects\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/jenkins.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/jenkins.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/jenkins.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/jenkins.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/jenkins.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/jenkins.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":11267,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2020\/09\/29\/montagsmaler-multiplayer-online-game-running-on-amazon-web-services\/","url_meta":{"origin":1832,"position":4},"title":"Montagsmaler \u2013 Multiplayer online game running on Amazon Web Services","author":"ns107","date":"29. September 2020","format":false,"excerpt":"by Jannik Smidt (js343), Niklas Schildhauer (ns107) and Lucas Cr\u00e4mer (lc028) Project idea Montagsmaler is a multiplayer online game for web browsers. The idea is derived from the classic Pictionary game, where players have to guess what one person is painting. Basically, we have built the digital version of it,\u2026","rel":"","context":"In &quot;Cloud Technologies&quot;","block_context":{"text":"Cloud Technologies","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/scalable-systems\/cloud-technologies\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/09\/Untitled-Diagram.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/09\/Untitled-Diagram.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/09\/Untitled-Diagram.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/09\/Untitled-Diagram.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1863,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2017\/02\/23\/building-an-hdm-alexa-skill-part-2\/","url_meta":{"origin":1832,"position":5},"title":"Building an HdM Alexa Skill &#8211; Part 2","author":"Andreas Fliehr","date":"23. February 2017","format":false,"excerpt":"We present our own HdM Alexa Skill and share the experience we gained throughout this project. This time: Decisions, Developed Modules and Implementation.","rel":"","context":"In &quot;Cloud Technologies&quot;","block_context":{"text":"Cloud Technologies","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/scalable-systems\/cloud-technologies\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/data_flow.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/data_flow.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/data_flow.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/data_flow.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2017\/02\/data_flow.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"authors":[{"term_id":717,"user_id":195,"is_guest":0,"slug":"st067","display_name":"st067","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/9105b89a37d62060454a5bc3ce696464647ec02e57187a9bf9557d731101bd5e?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/posts\/1832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/users\/195"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/comments?post=1832"}],"version-history":[{"count":21,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/posts\/1832\/revisions"}],"predecessor-version":[{"id":2354,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/posts\/1832\/revisions\/2354"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/media\/1834"}],"wp:attachment":[{"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/media?parent=1832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/categories?post=1832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/tags?post=1832"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/ppma_author?post=1832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}