{"id":436,"date":"2016-12-10T15:05:51","date_gmt":"2016-12-10T15:05:51","guid":{"rendered":"http:\/\/tuxlabs.com\/?p=436"},"modified":"2016-12-10T15:15:31","modified_gmt":"2016-12-10T15:15:31","slug":"setting-up-netflixs-edda-cmdb-in-aws-on-ubuntu","status":"publish","type":"post","link":"https:\/\/tuxlabs.com\/?p=436","title":{"rendered":"Setting up Netflix&#8217;s Edda (CMDB) in AWS on Ubuntu"},"content":{"rendered":"<p>If you are running any kind of environment with greater than 10 servers, than you need a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Configuration_management_database\">CMDB<\/a> (Configuration Management DataBase). CMDB&#8217;s are the brain of your fleet &amp; it&#8217;s environment. You can store anything in a CMDB, but commonly the metadata in CMDB&#8217;s consists of any of the following physical &amp; digital asset inventory, software licenses, software configuration data, policy information, relationships (I.E. This VM&#8212;&gt; Compute &#8211;&gt; Rack &#8211;&gt; Availability Zone &#8211;&gt; Datacenter), automation metadata, and more&#8230; they also commonly provide change history for changes in your environment.<\/p>\n<blockquote><p>In the world of infrastructure as code, CMDB is king.<\/p><\/blockquote>\n<p>CMDB&#8217;s\u00a0enable endless automation possibilities, without them you are stuck gathering and collecting &#8216;current&#8217; configuration state\u00a0about your infrastructure every time you want perform an automated change or run an audit\/report . In my career I have\u00a0built or been a part of CMDB efforts at nearly every company I have worked for. They are simply necessary, and by their nature they tend to require the choice of &#8216;built by us&#8217; vs &#8216;buy or run&#8217;.<\/p>\n<p>However, if you have the luxury of only running in AWS, you are in luck, because Netflix (The AWS poster child) \u00a0open sourced\u00a0<a href=\"https:\/\/github.com\/Netflix\/edda\">Edda<\/a>\u00a0in <a href=\"http:\/\/techblog.netflix.com\/2012\/11\/edda-learn-stories-of-your-cloud.html\">2012<\/a> for this purpose!<\/p>\n<p>Rather than talk about the specific features of Edda refer to <a href=\"http:\/\/techblog.netflix.com\/2012\/11\/edda-learn-stories-of-your-cloud.html\">the blog post<\/a> or <a href=\"https:\/\/github.com\/Netflix\/edda\/wiki\">documentation<\/a>, I want to keep this article short and jump right into setting up Edda, which is a bit tricky, because the documentation is out of date!<\/p>\n<h2>Setting Up Edda (2016)<\/h2>\n<p>First, in AWS you need setup an EC2 VM that has at least.. 6G for OS + dependencies including Mongo, and then however much disk you need to store the metadata for your environment (keep in mind it keeps change history). Personally I just created a root partition with 100G to keep things simple. For instance type I used &#8216;m4.xlarge&#8217; and\u00a0the Ubuntu version is 14.04.<\/p>\n<p>After booting the VM, SSH to it and create a directory\u00a0wherever your storage is allocated partition wise to store Edda &amp; it&#8217;s dependencies. I will be using \/cmdb\/ in my example.<\/p>\n<h3>Initial Install Steps<\/h3>\n<pre class=\"lang:default decode:true\">mkdir \/cmdb\r\ncd \/cmdb\r\nexport JAVA_OPTS=\"-Xmx1g -XX:MaxPermSize=256M\"\r\ngit clone https:\/\/github.com\/Netflix\/edda.git\r\nsudo add-apt-repository -y ppa:webupd8team\/java &amp;&gt; \/dev\/null\r\nsudo apt-get update\r\nsudo debconf-set-selections &lt;&lt;&lt; 'oracle-java8-installer shared\/accepted-oracle-license-v1-1 boolean true'\r\nsudo apt-get install -y oracle-java8-installer\r\nsudo apt-get install -y scala\r\nsudo apt-get install make\r\n\r\ncd \/cmdb\/edda\r\nmake build<\/pre>\n<p>For the record, the <a href=\"https:\/\/github.com\/Netflix\/edda\/wiki\">Edda Wiki<\/a> has the build steps wrong, it appears they no long are using Gradle, but have switch to <a href=\"http:\/\/www.scala-sbt.org\/\">SBT<\/a>&#8230; which reminds me be aware Edda is written in Scala, which isn&#8217;t as popular as Java, Python etc&#8230; in addition it&#8217;s functional programming, which I don&#8217;t personally know a lot about, but I hear it&#8217;s got quite the learning curve..so beware if you need to make custom code changes, I would not recommend it, unless you know Scala ! \ud83d\ude42<\/p>\n<p>After the build of Edda succeeds, install Mongo<\/p>\n<pre class=\"lang:default decode:true\">apt-get install -y mongodb\r\n<\/pre>\n<p>That&#8217;s it for dependencies<\/p>\n<h3>Configuring Mongo<\/h3>\n<p>For Edda to use Mongo all we need to do is &#8216;use&#8217;\u00a0the database we want to use for Edda &amp; create an associated user. (Mongo will auto-create DB&#8217;s upon insert).<\/p>\n<pre class=\"lang:default decode:true\">mongo\r\n\r\n&gt; use edda\r\n&gt; db.addUser({user:'edda',pwd:'t00t0ri4l',Roles: { edda: ['readWrite']}, roles: []})<\/pre>\n<p><strong>You can test the user is working by doing&#8230;\u00a0<\/strong><\/p>\n<pre class=\"lang:default decode:true\">$ mongo edda -u edda -p\r\nMongoDB shell version: 2.4.9\r\nEnter password:\r\nconnecting to: edda\r\nServer has startup warnings:\r\nSat Dec 10 00:53:21.093 [initandlisten]\r\nSat Dec 10 00:53:21.094 [initandlisten] ** WARNING: You are running on a NUMA machine.\r\nSat Dec 10 00:53:21.094 [initandlisten] **          We suggest launching mongod like this to avoid performance problems:\r\nSat Dec 10 00:53:21.094 [initandlisten] **              numactl --interleave=all mongod [other options]\r\nSat Dec 10 00:53:21.094 [initandlisten]\r\n&gt;<\/pre>\n<h3>Configuring Edda<\/h3>\n<p>Under \/cmdb\/edda\/src\/main\/resources we need to modify &#8216;edda.properties&#8217; with valid config values for accounts, regions &amp; mongo access.<\/p>\n<p><strong>Relevant Mongo Values<\/strong><\/p>\n<pre class=\"lang:default decode:true\">edda.mongo.address=127.0.0.1:27017\r\nedda.mongo.database=edda\r\nedda.mongo.user=edda\r\nedda.mongo.password=t00t0ri4l<\/pre>\n<p><strong>Account &amp; Region Values\u00a0<\/strong><\/p>\n<pre class=\"lang:default decode:true \">edda.accounts=dev.us-east-1\r\nedda.dev.us-east-1.region=us-east-1\r\nedda.dev.us-east-1.aws.accessKey=fakeaccesskey\r\nedda.dev.us-east-1.aws.secretKey=fakesecret<\/pre>\n<p>The above example is using one account and only one region. The Edda configuration uses generic labels, they are very flexible, but when using them you might be confused by the name of the label as it&#8217;s intent. Don&#8217;t fall into that trap, I did, and then I found <a href=\"https:\/\/groups.google.com\/forum\/#!searchin\/edda-users\/accounts%7Csort:relevance\/edda-users\/C7Bi8UpV7Ks\/OsPtSN7c658J\">this post<\/a> on Google Groups&#8230; Check it out to gain more insight on how the configuration works and can be tweaked for \u00a0your needs. There is also the standard <a href=\"https:\/\/github.com\/Netflix\/edda\/wiki\/Configuration\">documentation<\/a>, but it&#8217;s a little light IMO.<\/p>\n<h3>Running Edda<\/h3>\n<p>Congrats you made it, time to run Edda ! Again the documentation has this wrong (listed as gradle &amp; Jetty)&#8230;instead were using SBT + Jetty&#8230;<\/p>\n<pre class=\"lang:default decode:true \">$ cd \/cmdb\/edda\/\r\n$ .\/project\/sbt\r\n&gt; jetty:start<\/pre>\n<p>If everything goes smoothly you will start to see logs about crawling\u00a0AWS API&#8217;s spewing to your screen \ud83d\ude42 After about 2 minutes you should see data. You can check by doing a curl.<\/p>\n<pre class=\"lang:default decode:true \">curl http:\/\/127.0.0.1:8080\/api\/v2\/view\/instances<\/pre>\n<p>This API URL should return a JSON object with instance ID&#8217;s for the account &amp; region specified.<\/p>\n<p>Additionally, Edda is listening on whatever private IP address you have setup, you will just need to modify the default security group to allow 8080 on your machine.<\/p>\n<p>I get a bit frustrated with out of date documentation..so I hope this helps ! Happy automating !<\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/tuxlabs.com\/?p=436\" rel=\"bookmark\" title=\"Permalink to Setting up Netflix&#8217;s Edda (CMDB) in AWS on Ubuntu\"><p>If you are running any kind of environment with greater than 10 servers, than you need a CMDB (Configuration Management DataBase). CMDB&#8217;s are the brain of your fleet &amp; it&#8217;s environment. You can store anything in a CMDB, but commonly the metadata in CMDB&#8217;s consists of any of the following physical &amp; digital asset inventory, [&hellip;]<\/p>\n<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[131,130,1],"tags":[23,155,154,153,104],"class_list":{"0":"post-436","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-aws","7":"category-cloud","8":"category-howtos","9":"tag-aws","10":"tag-cmdb","11":"tag-edda","12":"tag-netflix","13":"tag-ubuntu","14":"h-entry","15":"hentry"},"_links":{"self":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=436"}],"version-history":[{"count":9,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/436\/revisions"}],"predecessor-version":[{"id":445,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/436\/revisions\/445"}],"wp:attachment":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}