<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Süha Sülün on Medium]]></title>
        <description><![CDATA[Stories by Süha Sülün on Medium]]></description>
        <link>https://medium.com/@suhasulun?source=rss-aa8d6ec60a12------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jSKiJkJr45DewH3zugfNlw.png</url>
            <title>Stories by Süha Sülün on Medium</title>
            <link>https://medium.com/@suhasulun?source=rss-aa8d6ec60a12------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 21:45:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@suhasulun/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Daha İyi Bir Zihinsel Durum İçin Beyin Dalgalarını Yönlendirin ve Daha Akıllıca Çalışın]]></title>
            <link>https://medium.com/@suhasulun/daha-i%CC%87yi-bir-zihinsel-durum-i%CC%87%C3%A7in-beyin-dalgalar%C4%B1n%C4%B1-y%C3%B6nlendirin-ve-daha-ak%C4%B1ll%C4%B1ca-%C3%A7al%C4%B1%C5%9F%C4%B1n-ba73eeb99f51?source=rss-aa8d6ec60a12------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba73eeb99f51</guid>
            <category><![CDATA[wellbeing]]></category>
            <category><![CDATA[brain]]></category>
            <category><![CDATA[inspiration]]></category>
            <category><![CDATA[alpha]]></category>
            <dc:creator><![CDATA[Süha Sülün]]></dc:creator>
            <pubDate>Sat, 05 Aug 2023 11:49:24 GMT</pubDate>
            <atom:updated>2023-08-08T12:54:53.358Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*Q7OXXyU3HPiShXGNjsxZdw.jpeg" /></figure><p>Beynin elektrokimyasal bir organ olduğu iyi bilinmektedir. Bu elektrik gücü çok sınırlı olmasına rağmen, insan beyninin karakteristiği olan çok özel şekillerde gerçekleşir. Beyinden yayılan elektriksel aktivite, beyin dalgaları şeklinde gösterilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*AddcIAKgFIAX-It9AzsTWQ.jpeg" /><figcaption>Hiç beyninin sesini dinledin mi?</figcaption></figure><p><strong>432Hz</strong> müzik dinlemenin faydaları;<br>432 Hz müzik dinlemenin en önemli faydalarından biri, zihinsel netliği ve odaklanmayı geliştirmeye yardımcı olabilmesidir.<br>Bunun nedeni, müziğin akort edilmesinin, zihinsel bulanıklığı azaltmaya ve konsantrasyonu artırmaya yardımcı olabilecek bir rahatlama ve sakinlik durumunu teşvik etmesidir.</p><p><a href="https://pubmed.ncbi.nlm.nih.gov/31031095/">Referans</a></p><p>Örnek <a href="https://www.youtube.com/watch?v=iaJGDTR0DVE">muzik</a><br>En sevdiğiniz şarkıları veya çalma listelerini <a href="https://sourceforge.net/projects/converter432hz/">bununla </a>432Hz’e dönüştürebilirsiniz.</p><p>Beyin uyarıldığında ve aktif olarak zihinsel faaliyetlerle meşgul olduğunda, Beta dalgaları üretir.<br>Beta dalgaları, güçlü bir şekilde meşgul olan bir zihnin özellikleridir. Yetişkinler gün boyunca çoğunlukla beta durumundadır; bilinçli olma, aktif düşünme, öğrenme, odaklanma, konsantrasyon<br>Aktif konuşmadaki bir kişi betada olacaktır. Bir tartışmacı yüksek betada olacaktır. Konuşma yapan bir kişi, bir öğretmen veya bir talk-show sunucusu, işiyle meşgul olduğunda hepsi beta halinde olacaktır.<br><strong>14–30 Hz</strong>; daha fazla enerjiye ihtiyaç duyan yüksek frekans ve sonrasında kendinizi yorgun hissedersiniz.</p><p>Sıklık sırasına göre bir sonraki beyin dalgası kategorisi Alfa’dır.<br>Beta uyarılmayı temsil ederken, alfa uyarılmamayı temsil eder. Bu beyin dalgaları önemlidir çünkü stres seviyelerini düşürmeye yardımcı olabilir ve bir akışa girmeyi ve bilgiyi özümsemeyi kolaylaştırabilir.<br>Güne uyanmadan ve tüm görevlerinizi beta durumunda tamamlamadan önce, mutlu ve rahatlamış alfa dalgalarının tadını çıkarmalısınız.<br>Alfadayken işleri daha az çabayla ve daha sakin bir şekilde halledebilirsiniz, bu da günlük tutmak, okumak, vücudunuzu hareket ettirmek ve meditasyon yapmak için mükemmel bir zamandır.<br>Bir görevi tamamlayan ve dinlenmek için oturan kişi genellikle alfa durumundadır. Bu durum için algı, zihinsel denge ve yaratıcılık çok çok yüksektir.<br><strong>7–14 Hz</strong></p><p>Bu nedenle, gün boyunca Alfa durumunda çalışmayı başarabilirseniz, daha fazla enerjiyi koruyacak ve tüm gün enerjik hissedeceksiniz. Akıllıca çalışmanın en kolay yolu, daha çok çalışmak değil. Bu sizi çok kolay bir şekilde Alfa durumuna sokabilir.</p><blockquote>Yaklaşık 8 Hz’lik Alfa-Teta sınır alanı, <strong>alan </strong>veya <strong>akış durumu</strong> olarak tanınır. Bu, bilinçli ve bilinçaltı zihin arasındaki sınırdır. Yoğun bir yaratıcılık içinde olduğunuzda, ilahi zihninizle derin bir diyaloga girdiğiniz mistik bir teta patlaması yaşıyorsunuz ve performansınıza şaşıracaksınız. Bu, işinizin zahmetsiz hissettirdiği “<strong>alanda </strong>olmanın” beyin durumudur.</blockquote><p>Bir sonraki durum olan Teta beyin dalgaları tipik olarak daha büyük genliğe ve daha yavaş frekansa sahiptir.<br>Bir görevden izin alıp hayal kurmaya başlayan bir kişi, genellikle teta beyin dalgası durumundadır. Çok fazla otobanda araba kullanan kişiler, genellikle teta oldukları bu dönemlerde iyi fikirler edinirler.<br>Açık havada koşan kişiler genellikle alfadan daha yavaş bir zihinsel rahatlama durumundadırlar ve tetadayken fikir akışına eğilimlidirler.<br>Bu aynı zamanda duşta veya küvette veya hatta tıraş olurken veya saçınızı fırçalarken de olabilir. Bu, görevlerin zihinsel olarak onlardan ayrılabileceğiniz kadar otomatik hale geldiği bir durumdur.<br>Teta durumunda gerçekleşebilen fikir, genellikle serbest akıştır ve sansür veya suçluluk duymadan gerçekleşir. Tipik olarak çok olumlu bir zihinsel durumdur.<br><strong>4–8 Hz</strong></p><p>Son beyin dalgası durumu <strong>Delta</strong>’dır. Burada beyin dalgaları en büyük genliğe ve en yavaş frekansa sahiptir.<br>Tipik olarak saniyede 1,5 ila 4 devir aralığında merkezlenirler. Bu durumda huzurun ve içsel gücün merkezindesiniz.<br>Asla sıfıra inmezler çünkü bu sizin beyin ölümü yaptığınız anlamına gelir.<br>Ancak derin rüyasız uyku sizi en düşük frekansa indirir. Tipik olarak, saniyede 2 ila 3 döngü.<br><strong>0–4 Hz</strong></p><p><strong>İpucu:</strong><br>Yatağa gidip uyumaya çalışmadan önce birkaç dakika kitap okuduğumuz zaman, muhtemelen düşük betadayız.<br>Kitabı bıraktığımızda, ışıkları söndürdüğümüzde ve gözlerimizi kapattığımızda, beyin dalgalarımız betadan alfaya, tetaya ve nihayet uykuya daldığımızda deltaya inecektir.</p><p><strong>Sağlıklı yaşamak, güzel düşünmek lüks değil. Olması gereken bir şey. Bunun için yaydığımız frekanslar büyük önem taşıyor.</strong></p><p><strong>Negatif yayınları kapatıp ilham kanallarına açık olmayı seçmeye izinlisiniz.</strong></p><p>Bugün güzel bir dilek ile güne başlayın!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba73eeb99f51" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manipulate Brain Waves for a Better Mental State and Work Smarter]]></title>
            <link>https://medium.com/@suhasulun/manipulate-brain-waves-for-a-better-mental-state-and-work-smarter-662b58e2a2d6?source=rss-aa8d6ec60a12------2</link>
            <guid isPermaLink="false">https://medium.com/p/662b58e2a2d6</guid>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <category><![CDATA[positive-thinking]]></category>
            <dc:creator><![CDATA[Süha Sülün]]></dc:creator>
            <pubDate>Thu, 03 Aug 2023 12:01:52 GMT</pubDate>
            <atom:updated>2023-08-08T12:43:47.697Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*Q7OXXyU3HPiShXGNjsxZdw.jpeg" /></figure><p>It is well known that the brain is an electrochemical organ. Even though this electrical power is very limited, it does occur in very specific ways that are characteristic of the human brain. Electrical activity emanating from the brain is displayed in the form of brainwaves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*AddcIAKgFIAX-It9AzsTWQ.jpeg" /><figcaption>Have you ever listened your brain noise?</figcaption></figure><p>Benefits of listening <strong>432Hz</strong> music;<br>One of the most significant benefits of listening to 432 Hz music is that it can help to improve mental clarity and focus. <br>This is because the tuning of the music promotes a state of relaxation and calmness, which can help to reduce mental fog and increase concentration.</p><p><a href="https://pubmed.ncbi.nlm.nih.gov/31031095/">Reference</a></p><p>Example <a href="https://www.youtube.com/watch?v=iaJGDTR0DVE">music</a><br>You can convert your favorite songs or playlists to 432Hz with this <a href="https://sourceforge.net/projects/converter432hz/">util</a>.</p><p>When the brain is aroused and actively engaged in mental activities, it generates <strong><em>Beta</em></strong> waves.<br>Beta waves are characteristics of a strongly engaged mind. Adults are mostly in beta state during the day; being conscious, active thinking, learning, focusing, concentration<br>A person in active conversation would be in beta. A debater would be in high beta. A person making a speech, or a teacher, or a talk show host would all be in beta when they are engaged in their work.<br><strong>14–30 Hz</strong>; high frequency, which needs more energy an you feel tired afterwards.</p><p>The next brainwave category in order of frequency is <strong><em>Alpha</em></strong>. <br>Where Beta represented arousal, alpha represents non-arousal. These brain waves are important because they can help to reduce stress levels and make it easier to get into a flow and absorb information.<br>Before you get up for the day and complete all your tasks in a beta state, you should enjoy the happy and relaxed alpha waves. <br>You can get things done with less effort and in a calmer state whilst you’re in alpha, which makes it the perfect time to journal, read, move your body, and meditate.<br>A person who has completed a task and sits down to rest is often in an alpha state. Perception, mental balance and creativity are very very high for this state.<br><strong>7–14 Hz</strong>; So if you can achieve working in Alpha state during the day you will preserve more energy and feel energetic all the day. Easiest way to work smart not harder. <a href="https://www.youtube.com/watch?v=Jx2clgKOpKM">This one</a> can put you in an Alpha state very easily.</p><blockquote>The Alpha-Theta border area of around 8 Hz is recognized as the zone or the state of <strong>flow</strong>. This is the border between the conscious and the subconscious mind. When you are in an intense creativity, you are having a mystical theta burst where you engage in deep dialogue with your divine mind and you’ll be surprised by your performance. This is the brain state of “being in the zone” where your work feels effortless.</blockquote><p>The next state, <strong><em>Theta </em></strong>brainwaves, are typically of even greater amplitude and slower frequency.<br>A person who has taken time off from a task and begins to daydream is often in a theta brainwave state.Individuals who do a lot of freeway driving often get good ideas during those periods when they are in theta. <br>Individuals who run outdoors often are in the state of mental relaxation that is slower than alpha and when in theta, they are prone to a flow of ideas. <br>This can also occur in the shower or tub or even while shaving or brushing your hair. It is a state where tasks become so automatic that you can mentally disengage from them. <br>The ideation that can take place during the theta state is often free flow and occurs without censorship or guilt. It is typically a very positive mental state. <br><strong>4–8 Hz</strong></p><p>The final brainwave state is <strong><em>Delta</em></strong>. Here the brainwaves are of the greatest amplitude and slowest frequency. <br>They typically center around a range of 1.5 to 4 cycles per second. You are in the center of peace and inner power during this state.<br>They never go down to zero because that would mean that you were brain dead. <br>But, deep dreamless sleep would take you down to the lowest frequency. Typically, 2 to 3 cycles a second.<br><strong>0–4 Hz</strong></p><p><strong>Tip:</strong> <br>When we go to bed and read for a few minutes before attempting sleep, we are likely to be in low beta. <br>When we put the book down, turn off the lights and close our eyes, our brainwaves will descend from beta, to alpha, to theta and finally, when we fall asleep, to delta.</p><p><strong><em>A healthy life, thinking beautiful is not a luxury. It’s a must have thing. For this, the frequencies we emit are of great importance.</em></strong></p><p><strong>Start your day with a good wish today!</strong></p><p>Reference for brain study link is <a href="https://www.scientificamerican.com/article/what-is-the-function-of-t-1997-12-22/">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=662b58e2a2d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying SRE, DevOps, and Platform Engineering: Understanding the Differences]]></title>
            <link>https://medium.com/automation-avengers/demystifying-sre-devops-and-platform-engineering-understanding-the-differences-5ef37b5d813?source=rss-aa8d6ec60a12------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ef37b5d813</guid>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[platform]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Süha Sülün]]></dc:creator>
            <pubDate>Sat, 22 Jul 2023 16:22:22 GMT</pubDate>
            <atom:updated>2023-07-24T10:29:55.764Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xijxurI1f4TLGeKvBZVnjA.png" /><figcaption>DevOps vs Platform Engineering vs SRE</figcaption></figure><p>As an experienced DevOps/SRE/Platform Engineering consultant over years; working in various domains which have rich tool-stack in different businesses helped me to gain broad expertise on development platforms, automation flexibility, team structure, responsibility and topologies.</p><p>Roles like Site Reliability Engineering (SRE), DevOps, and Platform Engineering have arisen to meet the problems of developing and maintaining dependable and scalable systems in the constantly changing world of software engineering and operations. Even though these roles first appear to be identical, they each have their own special viewpoints and areas of specialization. In this article we’ll examine the contrasts between SRE, DevOps, and Platform Engineering, illuminating their unique roles and contributions. The first paragraph includes a breakdown of each of these tools to visually show the difference between them.</p><p><strong>DIFFERENCES</strong></p><p><strong><em>Site Reliability Engineering (SRE)</em></strong></p><p>In order to guarantee the dependability and performance of systems, Google invented Site Reliability Engineering, which combines the ideas of software engineering and operations. To combine creativity and dependability, SREs work closely with development teams to match software design with operational requirements. Their ultimate objective is to maintain systems in good working order, respond quickly to issues, and continuously enhance system performance via monitoring.</p><p>Key Features:</p><ul><li>Enhanced uptime of systems</li><li>Keeps things operational and reliable</li><li>Preventing re-occurrence of problems and being prepared</li><li>Creates a bridge between development and operations</li><li>Standardization and automation</li></ul><p>These goals depend upon various factors but majorly on agreement with the customer around the performance of the service, the level of user satisfaction, etc.</p><p>The associated terms with these goals are SLI, SLO, SLA, and error budget measurement goals.</p><p><strong><em>DevOps</em></strong></p><p>Development and operations teams are encouraged to work together and integrate using the DevOps methodology. The old borders between these teams are being shattered by DevOps practitioners in order to promote seamless cooperation, shared responsibility, and increased communication. Moreover, DevOps aims to optimize software development processes. DevOps specialists concentrate on the methods, procedures, and procedures that make it possible for development and operations teams to collaborate effectively, leading to quicker software delivery and higher reliability.</p><p><strong><em>What are the Key Components of DevOps?</em></strong></p><ul><li>Continuous Development</li><li>Continuous Integration</li><li>Automated Delivery Pipeline</li><li>Configuration Management</li><li>Breaking Silo’s between dev and ops teams</li><li>Regular Integration</li><li>Automated Monitoring and Health Checks</li><li>Infrastructure as code</li></ul><p>Here are some advantages of DevOps:</p><ul><li><strong>Faster Time-to-Market:</strong> DevOps practices such as continuous integration and continuous delivery enable faster delivery of software, reducing the time it takes to get new features and updates to users.</li><li><strong>Improved Collaboration:</strong> DevOps promotes collaboration between development and operations teams. This can result in improved communication, faster resolutions to problems, and more efficient delivery of new features.</li><li><strong>Increased Efficiency :</strong> DevOps automation helps streamline the development process, reducing the time and effort required for manual tasks and enabling teams to focus on more strategic work.</li><li><strong>More Agility and Flexibility :</strong> DevOps enables teams to respond quickly to changing requirements and customer needs, adapting the development pipeline as necessary.</li><li><strong>Improved Reliability and Stability :</strong> DevOps processes ensure that software is deployed consistently and reliably, reducing the risk of downtime or outages.</li><li><strong>Higher Quality Software :</strong> DevOps practices such as automated testing and monitoring help improve software quality, reducing the risk of errors and improving user satisfaction.</li><li><strong>Improved Security :</strong> DevOps practices can help improve security by integrating security testing into the development process and ensuring security is built in from the start.</li><li><strong>Cost Savings:</strong> DevOps automation and efficiency can help reduce costs associated with manual tasks and enable organizations to optimize resource utilization.</li><li><strong>Better Customer Satisfaction :</strong> DevOps practices help to deliver higher quality software that meets the needs and expectations of customers, resulting in greater satisfaction and loyalty.</li></ul><p><strong><em>Platform Engineering</em></strong></p><p>Building and maintaining the fundamental infrastructure and tooling that facilitates the creation and use of software applications is the focus of platform engineering. The foundational platforms, services, and frameworks needed by development teams are provided by platform engineers. This comprises the cloud infrastructure, deployment pipelines, monitoring tools, and logging frameworks. Their goal is to establish a dependable and expandable platform that gives developers the tools they need to effectively design, deploy, and manage software. Developers may concentrate on their primary objectives rather than infrastructure issues thanks to platform engineers’ efforts to provide self-service capabilities and abstract away complexity.</p><p><strong>Key Features</strong></p><ul><li>Building Internal Developer Platforms.</li><li>Standardizing and securing key delivery processes.</li><li>Setting and maintaining internal service level agreements.</li><li>Monitoring team performance metrics.</li><li>Standardizing and setting toolstack’s way of working, usage and maintenance</li></ul><p><strong>In short:</strong></p><ul><li>Platform engineering implements reusable tools and self-service capabilities with automated infrastructure operations, improving the developer experience and productivity.</li><li>This technology approach utilizes reusable configurable application components and services.</li><li>The benefit to users is in standardized tools, components and automated processes.</li></ul><p>SRE, DevOps, and Platform Engineering have different analytical structures depending on the salary range, popularity, topics to cover, complexity, and team size in firms.</p><p>The improvement of software development and deployment procedures is a goal shared by SRE, DevOps, and Platform Engineering, although their skill sets, responsibilities, and priority areas are distinct. The analysis of each engineering structure will be looked at in the second section in terms of its salary range, topics to cover, popularity, complexity, and team size in firms.</p><p><strong>BRANCH ANALYSIS</strong></p><p><strong><em>SRE (Site Reliability Engineering)</em></strong></p><p>Due to their specific skills and great demand, Site Reliability Engineers (SREs) often earn lucrative incomes. Depending on characteristics including experience, geography, and company size, the wage range for SREs varies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eQjQELSNAnsaVvmE7JCmcQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4B3tA6xeJGH0u4jcbaFQAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7y7582CLgdI2TJAEh5ENg.png" /></figure><p>SREs manage highly available, scalable systems with a focus on dependability, fault tolerance, and performance enhancement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*IwWcQFw9qK_UXxQfRvEWcw.png" /></figure><p>For system performance, incident response, and dependability, organizations may employ specialized SRE teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXkyDyK6HQv6M4CPdy-IHg.png" /></figure><p><strong><em>DevOps</em></strong></p><p>Depending on experience, geography, and organizational size, DevOps engineers can expect to earn a respectable salary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*B9J9LxGbH6GW4pa0JI2KRw.png" /></figure><p>Due to its emphasis on collaboration and automation, DevOps has been widely adopted across a variety of industries and is only continuing to gain popularity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WczYiRCqxTbGznLPsfgFWw.png" /></figure><p>Despite this, the DevOps industry has a very promising future, and a rising number of companies claim that it has so far had a good effect on their business.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXcm8guWRtS1kTJwBSIbEg.png" /></figure><p>DevOps engineers tackle the challenging integration of continuous delivery, automation, and development and operations workflows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NMTNoCHj39Wwk4G8WmOCPA.png" /></figure><p>DevOps engineers tackle the challenging integration of continuous delivery, automation, and development and operations workflows.</p><p><strong><em>Platform Engineering</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F463yjQ7wSAk4_lEB28eDQ.png" /></figure><p>Platform Engineers in the United States earn an estimated $171,066 in total compensation annually, with an average wage of $128,264. These figures show the median, or the midpoint of the ranges, from our unique Total Pay Estimate methodology, which is based on data about wages gathered from our users. The extra compensation is thought to be worth $42,802 annually.</p><p>Platform Engineering’s acceptance varies based on the sector, size of the business, and pace of technological advancement. Businesses that place a high priority on microservices designs, scalable infrastructure, and cloud-native apps are more likely to allocate teams to Platform Engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4oe1BWsnBQfl0ccexn3pzw.png" /></figure><p>Platform Engineering is becoming increasingly popular, which is generally attributed to the development of cloud computing and the acceptance of platforms, let’s take as an example Kubernetes. Utilizing scalable and resilient infrastructure is made possible by these technologies, which makes it simpler to deploy and operate applications at scale. As a result, there is now a greater need for experts in platform engineering.</p><p>Platform engineers take on the challenging work of planning, creating, and maintaining infrastructure, facilitating the smooth development and deployment of software.</p><p>Companies may have specialized platform engineering teams that are in charge of developing and maintaining the platforms and underlying infrastructure. That’s an example of what a Platform Engineering team looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*IPY5nD16oVwyZcVjI6iRLQ.png" /></figure><p>When we consider the distinctions between SRE, DevOps, and Platform Engineering and carefully consider how their models and structures look, the third section provides a discussion of each branch’s career path, driving forces, and knowledge base from the viewpoint of the engineers.</p><p><strong>MOTIVATION</strong></p><p><strong><em>SRE (Site Reliability Engineering)</em></strong></p><p><strong>Motivation</strong> of SREs are driven to ensure system dependability, reduce downtime, and enhance performance in order to satisfy service-level goals.</p><p><strong>Knowledge Base</strong> includes software engineers, systems designers, network engineers, and troubleshooters all need solid backgrounds.</p><p>SREs can rise to senior or lead positions and pursue specializations in reliability architecture, performance engineering, or incident management.</p><blockquote>SRE space has tagged 2.4K times in medium.</blockquote><p><strong><em>DevOps</em></strong></p><p>DevOps engineers are driven to streamline procedures, boost productivity, and promote a climate of cooperation and continuous development.</p><p><strong>Knowledge Base</strong>: DevOps engineers require a mix of operations and development abilities, as well as knowledge of tools, automation, and cloud technologies.</p><p><strong>Career Path</strong>: DevOps practitioners can advance to leadership positions that emphasize strategic planning, the adoption of the DevOps culture, and the promotion of organizational change.</p><blockquote>DevOps space has tagged 67K times in medium.</blockquote><p><strong><em>Platform Engineering</em></strong></p><p>Platform engineers are driven by the need to empower developers, build scalable infrastructure, and facilitate effective software delivery.</p><p><strong>Knowledge Base</strong>: Deep understanding of cloud computing platforms, container technologies, infrastructure management, and security procedures is required of platform engineers.</p><p>Developing into positions such as infrastructure architects, platform managers, or technical leads, platform engineers can contribute to enterprise-level platform strategy.</p><p>The improvement of software development and deployment procedures is a goal shared by SRE, DevOps, and Platform Engineering, although their skill sets, responsibilities, and priority areas are distinct. Organizations can identify the precise requirements and skill sets needed for their engineering teams by understanding these distinctions. Engineers with an interest in these areas can decide on their professional development by carefully weighing the analytics, motivation, knowledge base, and potential career routes associated with each specialization. Ultimately, the effective implementation and integration of these roles can result in increased operational effectiveness, software reliability, and organizational success.</p><blockquote>Platform space has tagged 10.7K times in medium.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ef37b5d813" width="1" height="1" alt=""><hr><p><a href="https://medium.com/automation-avengers/demystifying-sre-devops-and-platform-engineering-understanding-the-differences-5ef37b5d813">Demystifying SRE, DevOps, and Platform Engineering: Understanding the Differences</a> was originally published in <a href="https://medium.com/automation-avengers">Automation Avengers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying to AWS with Ansible and Terraform]]></title>
            <link>https://medium.com/automation-avengers/deploying-to-aws-with-ansible-and-terraform-4c3be121ba51?source=rss-aa8d6ec60a12------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c3be121ba51</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Süha Sülün]]></dc:creator>
            <pubDate>Tue, 11 Sep 2018 12:06:12 GMT</pubDate>
            <atom:updated>2018-09-11T12:06:12.286Z</atom:updated>
            <content:encoded><![CDATA[<h4>Terraform is a powerful provisioning tool that supports immutable infrastructure and a declarative language</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*xvtglV_UwvYkzu62_723tg.png" /></figure><p>I am sure about the fact that by now, most of us have used public cloud services like AWS, Azure, &amp; Google Cloud. Well, if not all three, at least aws for sure(because aws is the biggest player in the public cloud service offering). Creating your infrastructure on top of these public cloud is pretty straightforward and easy, if done manually, by using their respective web console. However, it is not that simple to automate the infrastructure building process in a reusable fashion. Please keep the fact in mind that we are talking about automating the “infrastructure” here and not about your applications and services running on your servers.</p><p>When I say infrastructure, I am referring to the below in the cloud..</p><ul><li>Networks</li><li>Subnetworks</li><li>Firewalls</li><li>LoadBalancers</li><li>Storage</li><li>Public IPs</li><li>DNS Entries.. And much more..</li></ul><p>There are already many configuration management tools out there in the market, that can automate your Applications and Services running inside instances(VMs). For example, Puppet, Chef, Ansible, Salt etc can be used for automating your applications and services running inside your VM (or in other words…your app running in the infrastructure).</p><p>We need a method and a reusable process to build infrastructure using code. The idea is to basically treat the infrastructure components that we listed above, in the same manner that we treat our application(ie: Using code). Hence the name “Infrastructure As code”. The tool that we are going to discuss today falls under IaC (Infra as Code). It is called “Terraform”</p><p>So basically the principles that we generally apply to software development can then be applied to infrastructure as well. Like version controlling, Infrastructure can be shared(because its code), can go back in time (because we can go to the previous version).</p><p>You can declare the required state of your infrastructure using Terraform, and it will take care of the underlying complexities to create it.</p><p>Let’s imagine you want to create an AWS instance, and then attach a public IP(elastic ip), and then finally add a DNS entry for your instance. As I mentioned earlier, you simply specify the end state that you want using terraform.</p><ul><li>A Public IP</li><li>A DNS Entry</li><li>An Instance</li></ul><p>There are dependencies between each step that we have above. Terraform will calculate the dependencies and create each of the resources above in the correct order. Let’s think about this for a moment. An instance should be created before we can attach a public IP to it. The public IP should be created before adding the DNS entry. Which means the order is important here, and terraform will take care of this by building a graph internally.</p><p>So basically terraform will provision your infra in a cloud of your interest (terraform also falls under the umbrella of tools called as provisioners). Hence it can be also be called a cloud provisioner.</p><h3>Why Can’t We Use Puppet, Chef or Ansible for this?</h3><p>The primary area where Puppet, Chef and Ansible focuses is on configuration inside the instances (ie: Your application and server specific configs). Although there are modules available to use these configuration management tools to manage some of the infrastructure stuff, the original intent behind their creation was application configuration inside the operating system.</p><p>Being said that, you can still use these configuration management tools along with terraform to configure things inside the VMs as we will use in this tutorial(basically these tools can be used by terraform as a provisioner to configure applications inside your infrastructure).</p><p>Apart from this, if you are using Docker containers for running your applications, the containers are self sufficient and will have all the required configuration packed into it for your application. In this case, the need of a configuration management tool like chef or puppet is not that much. But you still need something to manage your infrastructure with code. Because the containers will ultimately run on top of a server/vm in a cloud infra. Terraform can step in and create your required infra for your containers to run on.</p><p>Lets not deny the fact that all these tools(chef, puppet, ansible etc) can be used as IaC(Infrastructure as Code) as well. But terraform is well suited for this purpose as it maintains the state of the infrastructure.</p><blockquote>Tutorial focus</blockquote><ol><li>Jenkins will trigger tests/deployment/provisioning as CI/CD</li><li>**I suggest to add test steps via Gerrit Pull request which runs terraform validate/plan steps before apply commands</li><li>Packer will create our production grade baseimage OS and save AWS AMI</li><li>Terraform will provision AWS VPC and deploy infra IAC</li><li>Ansible will deploy/test application on EC2 instance</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*rmwpOy4OtvgVz3yJvBetuQ.png" /><figcaption><a href="https://www.terraform.io/downloads.html">https://www.terraform.io/downloads.html</a></figcaption></figure><p><em>Pull and run latest Jenkins Blueocean docker image:</em></p><pre>sudo docker run -d -p 8080:8080 -p 50000:50000 -v /data/jenkins:/var/jenkinshome — restart unless-stopped jenkinsci/blueocean:latest</pre><p><em>Jenkins Configuration</em></p><ol><li>Install suggested plugins</li><li>Add awsCred, repoCred credentials for AWS Account and Github account.</li><li>AWS user must have EC2FullAccess rights.</li><li>Create new pipeline and use <a href="https://github.com/suhasulun/Test">https://github.com/</a>repository repo as Jenkinsfile source.</li></ol><p><em>Required:</em></p><p>yourdockerhub/agent-image for docker agent (git, bash, jdk, packer, terraform preinstalled) or build your own image with below dockerfile and push to registry.</p><h4>Dockerfile for jenkins agent</h4><pre>FROM alpine</pre><pre>ENV LANG=C.UTF-8 \<br> JAVA_VERSION=8 \<br> JAVA_UPDATE=171 \<br> JAVA_BUILD=11 \<br> JAVA_PATH=512cd62ec5174c3487ac17c61aaa89e8 \<br> JAVA_HOME=”/usr/lib/jvm/default-jvm”</pre><pre># Here we install GNU libc (aka glibc) and set C.UTF-8 locale as default.</pre><pre>RUN ALPINE_GLIBC_BASE_URL=”<a href="https://github.com/sgerrand/alpine-pkg-glibc/releases/download">https://github.com/sgerrand/alpine-pkg-glibc/releases/download</a>&quot; &amp;&amp; \<br> ALPINE_GLIBC_PACKAGE_VERSION=”2.27-r0&quot; &amp;&amp; \<br> ALPINE_GLIBC_BASE_PACKAGE_FILENAME=”glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk” &amp;&amp; \<br> ALPINE_GLIBC_BIN_PACKAGE_FILENAME=”glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk” &amp;&amp; \<br> ALPINE_GLIBC_I18N_PACKAGE_FILENAME=”glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk” &amp;&amp; \<br> apk add — no-cache — virtual=.build-dependencies wget ca-certificates &amp;&amp; \<br> wget \<br> “<a href="https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub">https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub</a>&quot; \<br> -O “/etc/apk/keys/sgerrand.rsa.pub” &amp;&amp; \<br> wget \<br> “$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME” \<br> “$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME” \<br> “$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME” &amp;&amp; \<br> apk add — no-cache \<br> “$ALPINE_GLIBC_BASE_PACKAGE_FILENAME” \<br> “$ALPINE_GLIBC_BIN_PACKAGE_FILENAME” \<br> “$ALPINE_GLIBC_I18N_PACKAGE_FILENAME” &amp;&amp; \<br> \<br> rm “/etc/apk/keys/sgerrand.rsa.pub” &amp;&amp; \<br> /usr/glibc-compat/bin/localedef — force — inputfile POSIX — charmap UTF-8 “$LANG” || true &amp;&amp; \<br> echo “export LANG=$LANG” &gt; /etc/profile.d/locale.sh &amp;&amp; \<br> \<br> apk del glibc-i18n &amp;&amp; \<br> \<br> rm “/root/.wget-hsts” &amp;&amp; \<br> apk del .build-dependencies &amp;&amp; \<br> rm \<br> “$ALPINE_GLIBC_BASE_PACKAGE_FILENAME” \<br> “$ALPINE_GLIBC_BIN_PACKAGE_FILENAME” \<br> “$ALPINE_GLIBC_I18N_PACKAGE_FILENAME”</pre><pre>RUN apk add — no-cache — virtual=build-dependencies wget ca-certificates unzip &amp;&amp; \<br> cd “/tmp” &amp;&amp; \<br> wget — header “Cookie: oraclelicense=accept-securebackup-cookie;” \<br> “<a href="http://download.oracle.com/otn-pub/java/jdk/$%7BJAVA_VERSION%7Du$%7BJAVA_UPDATE%7D-b$%7BJAVA_BUILD%7D/$%7BJAVA_PATH%7D/jdk-$%7BJAVA_VERSION%7Du$%7BJAVA_UPDATE%7D-linux-x64.tar.gz">http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION}u${JAVA_UPDATE}-b${JAVA_BUILD}/${JAVA_PATH}/jdk-${JAVA_VERSION}u${JAVA_UPDATE}-linux-x64.tar.gz</a>&quot; &amp;&amp; \<br> tar -xzf “jdk-${JAVA_VERSION}u${JAVA_UPDATE}-linux-x64.tar.gz” &amp;&amp; \<br> mkdir -p “/usr/lib/jvm” &amp;&amp; \<br> mv “/tmp/jdk1.${JAVA_VERSION}.0_${JAVA_UPDATE}” “/usr/lib/jvm/java-${JAVA_VERSION}-oracle” &amp;&amp; \<br> ln -s “java-${JAVA_VERSION}-oracle” “$JAVA_HOME” &amp;&amp; \<br> ln -s “$JAVA_HOME/bin/”* “/usr/bin/” &amp;&amp; \<br> rm -rf “$JAVA_HOME/”*src.zip &amp;&amp; \<br> wget — header “Cookie: oraclelicense=accept-securebackup-cookie;” \<br> “<a href="http://download.oracle.com/otn-pub/java/jce/$%7BJAVA_VERSION%7D/jce_policy-$%7BJAVA_VERSION%7D.zip">http://download.oracle.com/otn-pub/java/jce/${JAVA_VERSION}/jce_policy-${JAVA_VERSION}.zip</a>&quot; &amp;&amp; \<br> unzip -jo -d “${JAVA_HOME}/jre/lib/security” “jce_policy-${JAVA_VERSION}.zip” &amp;&amp; \<br> rm “${JAVA_HOME}/jre/lib/security/README.txt” &amp;&amp; \<br> apk del build-dependencies &amp;&amp; \<br> rm “/tmp/”*<br> <br>RUN mkdir /root/packer</pre><pre>WORKDIR /root/packer</pre><pre>RUN wget <a href="https://releases.hashicorp.com/packer/1.2.4/packer_1.2.4_linux_amd64.zip">https://releases.hashicorp.com/packer/1.2.4/packer_1.2.4_linux_amd64.zip</a><br>RUN wget <a href="https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip">https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip</a></pre><pre>RUN apk update</pre><pre>RUN unzip packer_1.2.4_linux_amd64.zip<br>RUN unzip terraform_0.11.7_linux_amd64.zip<br>RUN mv packer /usr/local/bin/packer<br>RUN mv terraform /usr/local/bin/terraform<br>RUN rm packer_1.2.4_linux_amd64.zip<br>RUN rm terraform_0.11.7_linux_amd64.zip</pre><pre>RUN apk update &amp;&amp; apk upgrade &amp;&amp; \<br> apk add — no-cache bash git openssh</pre><p>Jenkins job pulls docker image and runs commands in it.</p><p>Pipeline has 3 stages for create AWS Environment;</p><blockquote>Checkout SCM repository</blockquote><h4>Jenkinsfile</h4><pre>pipeline {<br>  agent {<br>    docker {<br>      image &#39;yourdockerhub/agent-image:latest&#39;<br>    }<br>  }<br>  stages {<br>    stage(&#39;Create Packer AMI&#39;) {<br>        steps {<br>          withCredentials([<br>            usernamePassword(credentialsId: &#39;awsCred&#39;, passwordVariable: &#39;AWS_SECRET&#39;, usernameVariable: &#39;AWS_KEY&#39;)<br>          ]) {<br>            sh &#39;packer build -debug -var aws_access_key=${AWS_KEY} -var aws_secret_key=${AWS_SECRET} packer/packer.json&#39;<br>        }<br>      }<br>    }<br>    stage(&#39;AWS Deployment&#39;) {<br>      steps {<br>          withCredentials([<br>            usernamePassword(credentialsId: &#39;awsCred&#39;, passwordVariable: &#39;AWS_SECRET&#39;, usernameVariable: &#39;AWS_KEY&#39;),<br>            usernamePassword(credentialsId: &#39;repoCred&#39;, passwordVariable: &#39;REPO_PASS&#39;, usernameVariable: &#39;REPO_USER&#39;),<br>          ]) {<br>            sh &#39;rm -rf repository&#39;<br>            sh &#39;git clone <a href="https://github.com/suhasulun/test-terraform.git&#39;">https://github.com/suhasulun/repository.git&#39;</a><br>            sh &#39;&#39;&#39;<br>               cd repository<br>               terraform init<br>               terraform apply -auto-approve -var access_key=${AWS_KEY} -var secret_key=${AWS_SECRET}<br>               git add terraform.tfstate<br>               git -c user.name=&quot;Suha Sulun&quot; -c user.email=&quot;<a href="/service/mailto:suhasulun@hotmail.com">suha.sulun@test.com</a>&quot; commit -m &quot;terraform state update from Jenkins&quot;<br>               git push <a href="https://${REPO_USER}:${REPO_PASS}&lt;a href=">@github</a>.com/suhasulun/repository.git&quot;&gt;https://${REPO_USER}:${REPO_PASS}<a href="http://twitter.com/github">@github</a>.com/suhasulun/repository.git master<br>            &#39;&#39;&#39;<br>        }<br>      }<br>    }<br>  }<br>}</pre><p>Create EC2 AMI in AWS with Packer and create ELB, ASG, LC, SG, AZ with Terraform and commit AWS Environment state to repository repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*YXna2q9RyI7Te8AV-NgfHQ.png" /><figcaption>Jenkins Blueocean Pipeline</figcaption></figure><p><strong>Packer;</strong> (awsCred should be set in Jenkins Credentials properly)</p><p>Provisions Unix machine from Europe Region and perform below task on AMI;</p><p>· Install suitable docker version for OS</p><p>· Install Ansible</p><p>· Download SpringBoot artifact</p><p>· Build docker image and tag as springboot/app:latest</p><p>· Run latest springboot/app latest image on machine</p><p>· Run ansible-playbook (install git, nginx) Test Docker image is running</p><p>· Save AMI in AWS as name like prod-image*</p><h4>Packer.json</h4><pre>{<br>  &quot;variables&quot;: {<br>    &quot;aws_access_key&quot;: &quot;&quot;,<br>    &quot;aws_secret_key&quot;: &quot;&quot;<br>  },</pre><pre>&quot;provisioners&quot;: [<br>    {<br>        &quot;type&quot;: &quot;shell&quot;,<br>        &quot;execute_command&quot;: &quot;echo &#39;admin&#39; | {{ .Vars }} sudo -E -S sh &#39;{{ .Path }}&#39;&quot;,<br>        &quot;inline&quot;: [<br>            &quot;sleep 30&quot;,<br>            &quot;apt-add-repository ppa:ansible/ansible -y&quot;,<br>            &quot;/usr/bin/apt-get update&quot;,<br>            &quot;/usr/bin/apt-get -y install ansible&quot;,<br>            &quot;mkdir /home/debian/app&quot;,<br>            &quot;chown admin:admin /home/debian/app&quot;<br>        ]<br>    },</pre><pre>&quot;_comment&quot;: &quot;Install docker&quot;,<br>    {<br>      &quot;type&quot;: &quot;shell&quot;,<br>      &quot;script&quot;: &quot;install.sh&quot;,<br>      &quot;pause_before&quot;: &quot;5s&quot;<br>    },</pre><pre>&quot;_comment&quot;: &quot;Build latest dockerimage for application&quot;,<br>    {<br>      &quot;type&quot;: &quot;shell&quot;,<br>      &quot;script&quot;: &quot;packer/app.sh&quot;,<br>      &quot;pause_before&quot;: &quot;5s&quot;<br>    },<br>    {<br>      &quot;type&quot;: &quot;file&quot;,<br>      &quot;source&quot;: &quot;.&quot;,<br>      &quot;destination&quot;: &quot;/home/debian/app/&quot;<br>    },</pre><pre>&quot;_comment&quot;: &quot;Run playbook for deployment steps&quot;<br>    {<br>      &quot;type&quot;: &quot;ansible-local&quot;,<br>      &quot;playbook_file&quot;: &quot;packer/ansible-playbook.yml&quot;<br>    }<br>  ],</pre><pre>&quot;builders&quot;: [{<br>    &quot;type&quot;: &quot;amazon-ebs&quot;,<br>    &quot;access_key&quot;: &quot;{{user `aws_access_key`}}&quot;,<br>    &quot;secret_key&quot;: &quot;{{user `aws_secret_key`}}&quot;,<br>    &quot;region&quot;: &quot;eu-west-2&quot;,<br>    &quot;source_ami_filter&quot;: {<br>      &quot;filters&quot;: {<br>        &quot;virtualization-type&quot;: &quot;hvm&quot;,<br>        &quot;name&quot;: &quot;debian/images/*debian-strecth-9.5-*&quot;,<br>        &quot;root-device-type&quot;: &quot;ebs&quot;<br>      },<br>      &quot;owners&quot;: [&quot;099720109477&quot;],<br>      &quot;most_recent&quot;: true<br>    }, <br> &quot;tags&quot;: {<br>        &quot;OS_Version&quot;: &quot;Debian&quot;,<br>        &quot;Release&quot;: &quot;Latest&quot;,<br>        &quot;Runner&quot;: &quot;EC2&quot;,<br>  &quot;Name&quot;: &quot;Packer Baked AMI&quot;<br>      },<br>    &quot;instance_type&quot;: &quot;t2.small&quot;,<br>    &quot;ssh_username&quot;: &quot;admin&quot;,<br>    &quot;ami_name&quot;: &quot;prod-image {{timestamp}}&quot;,<br>    &quot;launch_block_device_mappings&quot;: [{<br>      &quot;device_name&quot;: &quot;/dev/sda1&quot;,<br>      &quot;volume_size&quot;: 8,<br>      &quot;volume_type&quot;: &quot;gp2&quot;,<br>      &quot;delete_on_termination&quot;: true<br>    }]<br>  }]<br>}</pre><p><strong>Terraform;</strong> (awsCred should be set in Jenkins Credentials properly)</p><p>Create AWS Resources and Deployment</p><p>· Provisions latest prod-image* AMI</p><p>· Apply Launch Configuration settings with given Security Group port settings</p><p>· Apply Auto Scale Group definitions min:2 to max:5 instances</p><p>· AMIs’ attach behind Elastic Load Balancer</p><p>· Spin cross in All Availibility Zones</p><p>· Commits Env state to <a href="https://github.com/suhasulun/test-terraform">https://github.com/suhasulun/repository</a> repo</p><p>· Deployment is done</p><p>· Lifecycle hook is set as create before destroy enabled</p><p>*You may choose to use .tfvars file to read variables from local and ofc not in version control system or just use vault and invoke for variable&amp;credential reading.</p><pre>terraform apply \<br>  -var-file=&quot;secret.tfvars&quot; \<br>  -var-file=&quot;production.tfvars&quot;</pre><h4>Terraformfile</h4><pre>variable &quot;access_key&quot; {}<br>variable &quot;secret_key&quot; {}</pre><pre>provider &quot;aws&quot; {<br>  access_key = &quot;${var.access_key}&quot;<br>  secret_key = &quot;${var.secret_key}&quot;<br>  region     = &quot;eu-west-2&quot;<br>}<br>data &quot;aws_ami&quot; &quot;sp_app_ami&quot; {<br>  most_recent = true</pre><pre>filter {<br>    name   = &quot;name&quot;<br>    values = [&quot;prod-image*&quot;]<br>  }</pre><pre>filter {<br>    name   = &quot;virtualization-type&quot;<br>    values = [&quot;hvm&quot;]<br>  }</pre><pre>owners = [&quot;684695514035&quot;]<br>}</pre><pre>resource &quot;aws_launch_configuration&quot; &quot;sp_app_lc&quot; {<br>  image_id      = &quot;${data.aws_ami.sp_app_ami.id}&quot;<br>  instance_type = &quot;t2.micro&quot;<br>  security_groups = [&quot;${aws_security_group.sp_app_websg.id}&quot;]<br>  lifecycle {<br>    create_before_destroy = true<br>  }<br>}</pre><pre>resource &quot;aws_autoscaling_group&quot; &quot;sp_app_asg&quot; {<br>  name                 = &quot;terraform-asg-springboot-app-${aws_launch_configuration.sp_app_lc.name}&quot;<br>  launch_configuration = &quot;${aws_launch_configuration.sp_app_lc.name}&quot;<br>  availability_zones = [&quot;${data.aws_availability_zones.allzones.names}&quot;]<br>  min_size             = 2<br>  max_size             = 5</pre><pre>load_balancers = [&quot;${aws_elb.elb1.id}&quot;]<br>  health_check_type = &quot;ELB&quot;</pre><pre>lifecycle {<br>    create_before_destroy = true<br>  }<br>}</pre><pre>resource &quot;aws_security_group&quot; &quot;sp_app_websg&quot; {<br>  name = &quot;security_group_for_sp_app_websg&quot;<br>  ingress {<br>    from_port = 8080<br>    to_port = 8080<br>    protocol = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }</pre><pre>lifecycle {<br>    create_before_destroy = true<br>  }<br>}</pre><pre>resource &quot;aws_security_group&quot; &quot;elbsg&quot; {<br>  name = &quot;security_group_for_elb&quot;<br>  ingress {<br>    from_port = 80<br>    to_port = 8080<br>    protocol = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }</pre><pre>egress {<br>    from_port = 0<br>    to_port = 0<br>    protocol = &quot;-1&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }</pre><pre>lifecycle {<br>    create_before_destroy = true<br>  }<br>}</pre><pre>data &quot;aws_availability_zones&quot; &quot;allzones&quot; {}</pre><pre>resource &quot;aws_elb&quot; &quot;elb1&quot; {<br>  name = &quot;terraform-elb-springboot-app&quot;<br>  availability_zones = [&quot;${data.aws_availability_zones.allzones.names}&quot;]<br>  security_groups = [&quot;${aws_security_group.elbsg.id}&quot;]<br>  <br>  listener {<br>    instance_port = 8080<br>    instance_protocol = &quot;http&quot;<br>    lb_port = 80<br>    lb_protocol = &quot;http&quot;<br>  }</pre><pre>health_check {<br>    healthy_threshold = 2<br>    unhealthy_threshold = 2<br>    timeout = 3<br>    target = &quot;HTTP:8080/&quot;<br>      interval = 30<br>  }</pre><pre>cross_zone_load_balancing = true<br>  idle_timeout = 400<br>  connection_draining = true<br>  connection_draining_timeout = 400</pre><pre>tags {<br>    Name = &quot;terraform - elb - springboot-app&quot;<br>  }<br>}</pre><p>Check your infra running from ELB DNS_Name A Record as loadbalanced</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*IRBKxHa8TjW-NPGLPmzkUw.png" /><figcaption>Springboot App is running on ELB</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c3be121ba51" width="1" height="1" alt=""><hr><p><a href="https://medium.com/automation-avengers/deploying-to-aws-with-ansible-and-terraform-4c3be121ba51">Deploying to AWS with Ansible and Terraform</a> was originally published in <a href="https://medium.com/automation-avengers">Automation Avengers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium Grid Infrastructure by using Rancher, Packer and Docker on AWS]]></title>
            <link>https://medium.com/automation-avengers/selenium-grid-infrastructure-by-using-rancher-packer-and-docker-on-aws-f60a523a3925?source=rss-aa8d6ec60a12------2</link>
            <guid isPermaLink="false">https://medium.com/p/f60a523a3925</guid>
            <category><![CDATA[rancher]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Süha Sülün]]></dc:creator>
            <pubDate>Fri, 20 Jul 2018 16:10:40 GMT</pubDate>
            <atom:updated>2018-08-25T12:23:03.352Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi all, in this article, I will explain to you how to setup <strong>Selenium Grid with Rancher on AWS</strong>. First we need to create an <strong>AWS account</strong>, for now, we may use <strong>t2.micro instances</strong> in US Regions which are <strong>the free-tier option enabled for new users</strong> in the first year of membership. These light resources can handle our demonstration load.</p><h4>Objectives on AWS Cloud</h4><ul><li>Create AWS EC2 instance running Ubuntu 16.04.</li><li>Ensure EC2 security group has port 8080, 22(in case if you need ssh), 2376, 450, 4500 open.</li><li>Install Docker.</li><li>Add Ubuntu user to docker group sudo usermod –append –groups docker ubuntu.</li><li>Pull Rancher Server container image from Docker Store and run at startup.</li></ul><h4>Identity Access Management (IAM)</h4><p>We need to create Group to define policies like users to have EC2FullAccess rights. So Rancher can manage EC2 resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*dUrKZXAlleYN26XDNU216w.jpeg" /></figure><p>We need to create User for programmatic access: Management Console &gt; IAM &gt; Create User &amp; choose access type programmatic access and add a user to Group that we created above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h52CCEjOjdNY537NLvg4lg.jpeg" /></figure><p><strong>Programmatic Access</strong></p><p>Enables an <strong>access key ID</strong> and <strong>secret access key</strong> for the AWS API, CLI, SDK, and other development tools. For us, it’s used for Packer and Rancher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vQYubi1WK1yn3exD1VYIGA.jpeg" /></figure><h4>Elastic Computing (EC2)</h4><p>We need to create a security group and open ports below for inbound access to EC2 machines.</p><p>UDP 450, TCP 2376, UDP 4500, TCP 8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fF5oqSfMszrs-bVGzGJ05A.png" /></figure><h4>Amazon Machine Images (AMI) Creation for Rancher Server</h4><p>I’d like to use <a href="https://www.packer.io/"><strong>Packer</strong></a> for creation desired ubuntu machine image in AWS. You may want to check <strong>more detailed Packer Article from</strong> <a href="https://medium.com/devopslinks/build-your-own-ec2-machine-images-with-packer-ansible-on-aws-for-immutable-aws-deployments-f7dbe81934a1"><strong>here</strong></a>. You should install Packer first and add packer.exe to Environment Variable PATH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*NE3B0WkpWyTf4Ht4lByIXg.jpeg" /><figcaption><a href="https://releases.hashicorp.com/packer/1.2.5/packer_1.2.5_windows_amd64.zip">https://releases.hashicorp.com/packer/1.2.5/packer_1.2.5_windows_amd64.zip</a></figcaption></figure><h4>Objectives</h4><ul><li>Provision Ubuntu image from AWS.</li><li>Installs compatible docker version on Ubuntu image.</li><li>Pull rancher server container image and run.</li><li>Pack AMI image and ready on the created region.</li></ul><p><strong>Packer JSON File:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfec2eff0818a8b8dace1c2b94f52968/href">https://medium.com/media/dfec2eff0818a8b8dace1c2b94f52968/href</a></iframe><p><strong>provision.sh file</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a73ec282f3cfcf3e42991511b9dfe0c/href">https://medium.com/media/3a73ec282f3cfcf3e42991511b9dfe0c/href</a></iframe><pre>Packer validate packer.json</pre><p><strong>Packer example run command;</strong></p><pre>packer build -var ‘aws_access_key=AKIAJOLN6HYMWIDFNZOA’ -var ‘aws_secret_key=WJBen0fMGxmiKlks2q9CrQQ4C/Nhacy55YlAC4nh’ packer.json</pre><p><strong>Output</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf5393a3bf68bc22557ac16d67a8d540/href">https://medium.com/media/bf5393a3bf68bc22557ac16d67a8d540/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*vqVd2IyUsUTjXm4tY_GH5g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*0N3iuEocFyxRu0H5kWWc8Q.jpeg" /></figure><p>Now head over to <strong>EC2 → AMIs tab</strong>, <strong>find your rancher-master</strong> 1529683817 <strong>image and</strong> <strong>launch</strong>. <strong>Select Security Group</strong> that we created before and <strong>click Review and Launch</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*DHfrybyIP4N32dnLaaN1mQ.jpeg" /></figure><p><strong>Go to Instances tab</strong> and <strong>wait for the instance to be ready</strong>. The EC2 machine will boot up and run rancher server container on port 8080. This can approximately take 3–5 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6SqAn8m8xjJhS2ZQ7NX9zQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wrCFY9ghseNhPUgLaF6VTw.jpeg" /></figure><p>Click instance id to review status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*KwBFqL9Hfpbntt7XNsCifw.jpeg" /></figure><p>Let’s check docker container on the host;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M3FDEaQrMXIOmSL4jPkQyQ.png" /></figure><p><strong>Copy IPv4 public IP Address and hit url</strong> http://&lt; ${Ipv4 public IP Address}&gt; :8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*CtqwU1voGs8lKs-HGPTj-A.png" /></figure><p>Add a Host</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PfYMjnExdBV4x1btkhgzIw.png" /></figure><p>Host machines will cover your infrastructure resources; containers will be running on these hosts as automatically distributed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hb8oswX1drrq0-XrN-Q_hQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GEolis32yzF-ymvfeGfK_A.png" /></figure><p>I selected host quantity as 3 and it’s going to provision 3 Ubuntu t2.micro 16GB disk mounted AMIs on EC2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CkqwDyxeJjsCukfUyDSPuQ.png" /></figure><p>We are ready to create Environment and Stack;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*_-SlxGKg-DYefkYGfq05Ag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wAxqzXwoztwF8EYaKHw8zA.png" /></figure><p>Then we can add our services for creating SeleniumGrid Stack;</p><ul><li>1 container for Selenium Hub</li><li>1 container for Chrome Node</li><li>1 container for Firefox Node</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EzakpEMduN1adl16m6x3bA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9rB9U0r-C0nUoA0wgkBgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q7h4nQ4upQyT7n5wWjn2xQ.png" /></figure><p>Wait for the stack to be ready and active.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5a5E6x0XQmuiDFlVsBdjPA.png" /></figure><p>Selenium Grid Container Information;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VbzZjoE7x-CvhgayS8exYQ.png" /></figure><p>Go to Selenium Grid Dashboard;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0FpVz22il--6H_JQyraaaw.png" /></figure><p>As you can see Selenium Hub is attached with 1 Chrome and 1 Firefox WebDriver instances.</p><p>If you want to scale out services of WebDrivers increase Scale count; I did for both nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0LknLZ2nOmPAW-ObAmGjUQ.png" /></figure><p>Updated Dashboard view after scaleout:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*dyjsW0fSUCTBWF0EmD5MZg.png" /></figure><p>Also, you can upload below <strong>.yml files</strong> to create Stack directly in Add Stack page. So you won’t need these manual steps anymore.</p><p><strong>Docker-compose.yml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5846f42ca5dcb32aa25eee4fe81f3bfc/href">https://medium.com/media/5846f42ca5dcb32aa25eee4fe81f3bfc/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6079ab65cad9d49f7b9e3664d7a1fe1b/href">https://medium.com/media/6079ab65cad9d49f7b9e3664d7a1fe1b/href</a></iframe><p>This is the end of the article and I hope you enjoyed to read and create a Selenium Grid architecture by using Rancher on AWS. If you have any questions, please write a comment and I will help you when I see them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f60a523a3925" width="1" height="1" alt=""><hr><p><a href="https://medium.com/automation-avengers/selenium-grid-infrastructure-by-using-rancher-packer-and-docker-on-aws-f60a523a3925">Selenium Grid Infrastructure by using Rancher, Packer and Docker on AWS</a> was originally published in <a href="https://medium.com/automation-avengers">Automation Avengers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bring your App Development & Production Environment home with Vagrant and Ansible within CI/CD]]></title>
            <link>https://medium.com/automation-avengers/bring-your-springboot-app-development-production-environment-home-with-vagrant-and-ansible-within-ec70fd32efaa?source=rss-aa8d6ec60a12------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec70fd32efaa</guid>
            <category><![CDATA[vagrant]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Süha Sülün]]></dc:creator>
            <pubDate>Tue, 17 Apr 2018 21:13:05 GMT</pubDate>
            <atom:updated>2018-06-01T18:04:02.695Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Let’s continue our stories with another awesome tool by Hashicorp</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*CeLodb9NY0j-vGY2VNeqIg.jpeg" /><figcaption>Configuration Management Stack</figcaption></figure><p>The Story sets up the following:</p><ul><li>An Open-source stack that builds and simulates your desired environment.</li><li>Ubuntu virtual machines provisioned and configured with Vagrant in private network along with given resources and forwarded ports, to provide you with your own virtual machines on local computer.</li><li>A NAT gateway to allow access to the internet.</li><li>Ansible runs on Automation Vm and deploys all desired Tools&amp;Configurations.</li><li>Jenkins container runs on Automation vm get ready for running pipeline.</li><li>In the private network, an Ivy Register Service (Container Registry) store and serve docker images.</li><li>Production vm to pull application docker image and runs container from the Ivy repository.</li></ul><h3><strong>What is Vagrant?</strong></h3><p>In a nutshell, Vagrant is a tool for working with virtual environments, and in most circumstances, this means working with virtual machines. Vagrant provides a simple and easy to use command-line client for managing these environments, and an interpreter for the text-based definitions of what each environment looks like, called Vagrantfiles. Vagrant is <a href="https://opensource.com/resources/what-open-source">open source</a>, which means that anyone can download it, modify it, and share it freely.</p><p>While many virtual machine hypervisors provide their own command-line interface, and technically the provisioning of virtual machines through these programs can be done directly or through shell scripts, the advantage Vagrant provides by adding an additional layer is simplicity, interoperability across multiple systems, and a more consistent approach which could theoretically be used with any virtual environment running on top of any other system.</p><p>By providing a common text-based format to work with virtual machines, your environment can be defined in code, making it easy to back up, modify, share, and manage with revision control. It also means that rather than sharing a whole virtual machine image, which could be many gigabytes, every time a change is made to the configuration, a simple text file weighing at just a few kilobytes can be shared instead.</p><h3>Why would I use Vagrant?</h3><p>While at its core, Vagrant provides a rather simple function, it may be useful to a wide range of people working on different kinds of tasks.</p><p>For developers, Vagrant makes it easy to create a local environment which mimics the environment upon which your code will eventually be deployed. You can make sure you have the same libraries and dependencies installed, same processes installed, same operating system and version, and many other details without having to sacrifice the way your local machine is set up, and without the lag or cost of creating an external development environment and connecting to it.</p><p><strong>Before starting;</strong></p><p>We need to install <a href="https://www.virtualbox.org/wiki/Downloads">virtualbox</a> and <a href="https://www.vagrantup.com/downloads.html">vagrant</a> on our local computer to work with vagrant.</p><h3>Vagrantfile</h3><p>The primary function of the Vagrantfile is to describe the type of machine required for a project, and how to configure and provision these machines. Vagrantfiles are called Vagrantfiles because the actual literal filename for the file is Vagrantfile (casing does not matter unless your file system is running in a strict case sensitive mode).</p><p>Vagrant is meant to run with one Vagrantfile per project, and the Vagrantfile is supposed to be committed to version control. This allows other developers involved in the project to check out the code, run vagrant up, and be on their way. Vagrantfiles are portable across every platform Vagrant supports.</p><p>The syntax of Vagrantfiles is <a href="http://www.ruby-lang.org/">Ruby</a>, but knowledge of the Ruby programming language is not necessary to make modifications to the Vagrantfile, since it is mostly simple variable assignment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d05b70dd3608c18d664e3ed1f90f5a7/href">https://medium.com/media/1d05b70dd3608c18d664e3ed1f90f5a7/href</a></iframe><p>Above vagrantfile provisions 2 Ubuntu machines in private network on your local computer, opens and redirect desired ports, installs Ansible on automation machine and runs automation.yml Playbook for installing roles; Java, Docker, Maven, Jenkins and Registry for Automation vm.</p><p>We need to run below command in project folder to start vagrant do it’s magic .</p><pre>vagrant up</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a26525bdb35c4f09cec2f69d9c6011d/href">https://medium.com/media/3a26525bdb35c4f09cec2f69d9c6011d/href</a></iframe><p>Above script used for install Ansible on automation vm after provisioning. Then automation.yml file runs on automation vm to play below roles;</p><p>— java<br> — docker<br> — registry<br> — maven<br> — jenkins</p><p>Ansible folder tree;</p><pre>│ ansible.cfg<br>│ automation.yml<br>│ springboot.yml<br>│ <br>│ <br>├───hosts<br>│ prod<br>│ <br>└───roles<br> ├───docker<br> │ ├───files<br> │ │ docker<br> │ │ <br> │ └───tasks<br> │ main.yml<br> │ <br> ├───hello-automation<br> │ └───tasks<br> │ main.yml<br> │ <br> ├───java<br> │ └───tasks<br> │ main.yml<br> │ <br> ├───jenkins<br> │ ├───defaults<br> │ │ main.yml<br> │ │ <br> │ ├───files<br> │ │ config.xml<br> │ │ git-client.hpi<br> │ │ git.hpi<br> │ │ scm-api.hpi<br> │ │ <br> │ ├───tasks<br> │ │ main.yml<br> │ │ <br> │ └───templates<br> │ build.xml.j2<br> │ deployment.xml.j2<br> │ provision.xml.j2<br> │ <br> ├───maven<br> │ └───tasks<br> │ main.yml<br> │ <br> └───registry<br> ├───defaults<br> │ main.yml<br> │ <br> └───tasks<br> main.yml</pre><p><strong>Java Role</strong></p><p>Adds Oracle Java Repo to apt-repository</p><p>Install Oracle Java 8 JDK and CA certificates</p><p><strong>Docker Role</strong></p><p>Adds Docker Repo to apt-repository,</p><p>installs following;</p><ul><li>docker-engine</li><li>python-pip</li><li>docker-py</li><li>restarts docker service</li></ul><p><strong>Registry Role</strong></p><ul><li>Creates Ivy Registry directory for internal container images repository</li><li>Downloads and run ivy docker image on port 5000</li><li>Registers itself for prevent insecure docker push failure</li></ul><p><strong>Maven Role</strong></p><ul><li>Installs latest maven package</li></ul><p><strong>Hello-automation Role</strong></p><ul><li>Creates directory for application</li><li>Pulls latest docker image for application</li><li>Checks container exist or not</li><li>Runs container on 8080 exposed port and bind it to 9001 port on prod vm</li></ul><p><strong>Jenkins Role</strong></p><ul><li>Creates jobs, configuration and plugin directories</li><li>Jenkins CI Server for;</li></ul><p> code checkout</p><p> build</p><p> test</p><p> deployment to prod vm</p><ul><li>Produces build, deployment and provision jobs for each job and setup objects from Jinja templates</li><li>Pulls Jenkins docker image and mounts jenkins volume</li><li>Runs container on port 8080</li></ul><p>You may reach Jenkins UI from localhost/192.168.100.11:8081</p><p>Initial setup steps for jenkins slave node on automation vm;</p><p>*User:vagrant *Pass:vagrant</p><ul><li>Click Manage Jenkins &gt; Manage Nodes &gt; Automation&gt; Configure.</li><li>Click Add button in the Credentials Section.</li><li>Type vagrant as both username and password and click the Add button.</li><li>Select the newly created key in the Credentials section.</li><li>Click the Save and finally; the Launch slave agent buttons</li></ul><p><strong>Jenkins Files</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16ba9f35de7063f0affa9688d32bc59a/href">https://medium.com/media/16ba9f35de7063f0affa9688d32bc59a/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ceb38164297c1d2fb314e543b047ef1/href">https://medium.com/media/8ceb38164297c1d2fb314e543b047ef1/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4349fdbb4dfee85f9013f91a34bd6dc0/href">https://medium.com/media/4349fdbb4dfee85f9013f91a34bd6dc0/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c24a46d5ed0673d5d51f79dac7b3dc5a/href">https://medium.com/media/c24a46d5ed0673d5d51f79dac7b3dc5a/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8563223630abd4d3d8becb35eae52f60/href">https://medium.com/media/8563223630abd4d3d8becb35eae52f60/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2675247c09a35422dd6c07112777beb0/href">https://medium.com/media/2675247c09a35422dd6c07112777beb0/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8EpFuUARqAAC5RRxZ6VomQ.png" /><figcaption>CD Ready Automation Stack</figcaption></figure><p>Spring Boot build and deployment jobs are created from J2 templates by jobs tag in defaults&gt;main.yml. You can add other project names for automated job creation.</p><p>Automation-provision job is created from provision J2 template by setup tag in defaults&gt;main.yml</p><p>Below playbook runs on prod machine which is defined as hello-automation tag host in hosts folder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/deb7aeae1532d7b064a329b2174861c2/href">https://medium.com/media/deb7aeae1532d7b064a329b2174861c2/href</a></iframe><p>Below playbook explains how we deploy&amp;pull latest application image from automation vm’s internal container registry to prod machine by pulling and checking it as absent or not. Then it runs application container by exposing 8080 port to vm’s bind port 9001.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b8634a9c148e932a8289cd9ecb9fe75/href">https://medium.com/media/9b8634a9c148e932a8289cd9ecb9fe75/href</a></iframe><p>This article represents a way to the Continuous Integration, Delivery or Deployment pipeline with local resource virtualization. We use Jenkins, Docker, Ansible and Vagrant to deploy Continuous Delivery and production servers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec70fd32efaa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/automation-avengers/bring-your-springboot-app-development-production-environment-home-with-vagrant-and-ansible-within-ec70fd32efaa">Bring your App Development &amp; Production Environment home with Vagrant and Ansible within CI/CD</a> was originally published in <a href="https://medium.com/automation-avengers">Automation Avengers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Secure Your Masternode VPS!]]></title>
            <link>https://medium.com/automation-avengers/how-to-secure-your-masternode-vps-2206341a50ce?source=rss-aa8d6ec60a12------2</link>
            <guid isPermaLink="false">https://medium.com/p/2206341a50ce</guid>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[masternodes]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Süha Sülün]]></dc:creator>
            <pubDate>Mon, 19 Feb 2018 18:50:15 GMT</pubDate>
            <atom:updated>2018-02-19T21:16:18.768Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kufIhklkgod83ec-uq21Gw.png" /></figure><p>Master your HODLING )</p><p>In the cryptosphere, they say only those who can finely analyze the market or are day traders can make money. <em>But that’s not true!!</em></p><p>In the cryptosphere, there are several ways by which you can make profits and earn a handsome amount of money. And the best thing is that you can choose the best way that works for you and can accordingly adjust your reward/risk ratio.</p><p>One such way of earning in cryptosphere is by running a <strong><em>masternode</em></strong>, but before I tell you how to do that it is imperative that you first understand what a masternode is.</p><h3>What is Masternode?</h3><p>Masternode is simply a <a href="https://coinsutra.com/cryptocurrency-exchange/">cryptocurrency</a> full node or computer wallet that keeps the full copy of the blockchain in real-time, just like your have <a href="https://en.bitcoin.it/wiki/Full_node">Bitcoin full nodes</a> and is always up &amp; running.</p><p>But masternodes are considerably different in their functionality than normal nodes. You can run masternodes with just only POS consensus coins.</p><p>They are different because they perform several other functions apart from just keeping the full blockchain and relaying blocks/transactions as a full node does in <a href="https://coinsutra.com/bitcoin/">Bitcoin</a>/Litcoin.</p><p>Some of the special functions that these nodes perform are:</p><ul><li>Increasing privacy of transactions</li><li>Doing instant transactions</li><li>Participating in governance and voting</li><li>Enable budgeting and treasury system in cryptos</li></ul><p>These masternodes are not standalone but they are always communicating with other such nodes to make a decentralized network and are often referred in short form as MN.</p><p><strong>Note:</strong> Mostly the masternodes perform the tasks that I have listed above but it can slightly vary from cryptocurrency to cryptocurrency depending upon how masternodes have been implemented. But more or less they perform these functions in a cryptocurrency.</p><h3>What is a proof of stake?</h3><p>Proof of stake is a different way to validate transactions based and achieve the distributed consensus.</p><p>It is still an algorithm, and the purpose is the same of the proof of work, but the process to reach the goal is quite different.</p><p>Unlike the proof-of-Work, where the algorithm rewards miners who solve mathematical problems with the goal of validating transactions and creating new blocks, with the proof of stake, the creator of a new block is chosen in a deterministic way, depending on its wealth, also defined as stake.</p><p>No block reward</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*shfaYhCNaD88JjpnoXYqYw.png" /><figcaption>Example Staking Desktop Wallet</figcaption></figure><p>Also, all the digital currencies are previously created in the beginning, and their number never changes.</p><p>This means that in the PoS system there is no block reward, so, the miners take the transaction fees.</p><p>This is why, in fact, in this PoS system miners are called forgers, instead.</p><p>“So these precious machines need some attention and security hedge”</p><h3><strong>VPS Security Tips</strong></h3><ol><li>Block your all open ports of vps except ssh and masternode port. (AWS in Security Groups, Google Cloud from vps and Vultr from vps besides these options are cost effective options for unix vps)</li><li>I recommend cold wallet (controller) + node design for masternode operations. You may locate your wallet and coins on your local computer, vm or another vps other than 7/24 online node vps. <br>Online node will just require your collateral amount of tokens transfer tx hash and index id. You may set automatic snapshot for your controller vps to make automatic bakcup for wallet and controller OS.</li><li>Change vps default ssh port number 22 to different unused port number to prevent attacks from common known ssh port.</li></ol><pre>Open sshd config file<br>vim /etc/ssh/sshd_config</pre><pre>change port number and remove #sembol. <br>#Port 22</pre><pre>Save your changes and close the sshd_config file.<br>Restart sshd service to make</pre><pre>service sshd restart</pre><pre>*The # symbol tells the server to ignore anything after it on the same line, so we will need to remove that character.</pre><p>4. Prevent making connection with password ( use instead ssh key-based authentication ) and disable root account login.</p><p>First configure SSH Key-Based Authentication from below link;</p><p><a href="https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server">How To Configure SSH Key-Based Authentication on a Linux Server | DigitalOcean</a></p><p>To disable this setting, you can do the following:</p><pre>nano /etc/ssh/sshd_config</pre><pre>In this file, set the following settings to the following values. If these settings are already in the file, set them to “no” rather than add new lines.</pre><pre>ChallengeResponseAuthentication no<br>PasswordAuthentication no<br>PermitRootLogin no<br>UsePAM no</pre><pre>Once this is done, restart the SSH daemon to apply the settings.</pre><pre>/etc/init.d/sshd restart</pre><p>5. Run Anti-ddos script (Change mnport with your masternode communication port)</p><pre>#!/bin/sh</pre><pre># For debugging use iptables -v.<br>IPTABLES=&quot;/sbin/iptables&quot;<br>IP6TABLES=&quot;/sbin/ip6tables&quot;<br>MODPROBE=&quot;/sbin/modprobe&quot;<br>RMMOD=&quot;/sbin/rmmod&quot;<br>ARP=&quot;/usr/sbin/arp&quot;</pre><pre># Logging options.<br>#------------------------------------------------------------------------------<br>LOG=&quot;LOG --log-level debug --log-tcp-sequence --log-tcp-options&quot;<br>LOG=&quot;$LOG --log-ip-options&quot;</pre><pre># Defaults for rate limiting<br>#------------------------------------------------------------------------------<br>RLIMIT=&quot;-m limit --limit 3/s --limit-burst 8&quot;</pre><pre># Unprivileged ports.<br>#------------------------------------------------------------------------------<br>PHIGH=&quot;1024:65535&quot;<br>PSSH=&quot;1000:1023&quot;</pre><pre># Load required kernel modules<br>#------------------------------------------------------------------------------<br>$MODPROBE ip_conntrack_ftp<br>$MODPROBE ip_conntrack_irc</pre><pre># Mitigate ARP spoofing/poisoning and similar attacks.<br>#------------------------------------------------------------------------------<br># Hardcode static ARP cache entries here<br># $ARP -s IP-ADDRESS MAC-ADDRESS</pre><pre># Kernel configuration.<br>#------------------------------------------------------------------------------</pre><pre># Disable IP forwarding.<br># On =&gt; Off = (reset)<br>echo 1 &gt; /proc/sys/net/ipv4/ip_forward<br>echo 0 &gt; /proc/sys/net/ipv4/ip_forward</pre><pre># Enable IP spoofing protection<br>for i in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 1 &gt; $i; done</pre><pre># Protect against SYN flood attacks<br>echo 1 &gt; /proc/sys/net/ipv4/tcp_syncookies</pre><pre># Ignore all incoming ICMP echo requests<br>echo 0 &gt; /proc/sys/net/ipv4/icmp_echo_ignore_all</pre><pre># Ignore ICMP echo requests to broadcast<br>echo 1 &gt; /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts</pre><pre># Log packets with impossible addresses.<br>for i in /proc/sys/net/ipv4/conf/*/log_martians; do echo 1 &gt; $i; done</pre><pre># Don&#39;t log invalid responses to broadcast<br>echo 1 &gt; /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses</pre><pre># Don&#39;t accept or send ICMP redirects.<br>for i in /proc/sys/net/ipv4/conf/*/accept_redirects; do echo 0 &gt; $i; done<br>for i in /proc/sys/net/ipv4/conf/*/send_redirects; do echo 0 &gt; $i; done</pre><pre># Don&#39;t accept source routed packets.<br>for i in /proc/sys/net/ipv4/conf/*/accept_source_route; do echo 0 &gt; $i; done</pre><pre># Disable multicast routing<br># for i in /proc/sys/net/ipv4/conf/*/mc_forwarding; do echo 0 &gt; $i; done</pre><pre># Disable proxy_arp.<br>for i in /proc/sys/net/ipv4/conf/*/proxy_arp; do echo 0 &gt; $i; done</pre><pre># Enable secure redirects, i.e. only accept ICMP redirects for gateways<br># Helps against MITM attacks.<br>for i in /proc/sys/net/ipv4/conf/*/secure_redirects; do echo 1 &gt; $i; done</pre><pre># Disable bootp_relay<br>for i in /proc/sys/net/ipv4/conf/*/bootp_relay; do echo 0 &gt; $i; done</pre><pre># Default policies.<br>#------------------------------------------------------------------------------</pre><pre># Drop everything by default.<br>$IPTABLES -P INPUT DROP<br>$IPTABLES -P FORWARD DROP<br>$IPTABLES -P OUTPUT DROP</pre><pre># Set the nat/mangle/raw tables&#39; chains to ACCEPT<br>$IPTABLES -t nat -P PREROUTING ACCEPT<br>$IPTABLES -t nat -P OUTPUT ACCEPT<br>$IPTABLES -t nat -P POSTROUTING ACCEPT</pre><pre>$IPTABLES -t mangle -P PREROUTING ACCEPT<br>$IPTABLES -t mangle -P INPUT ACCEPT<br>$IPTABLES -t mangle -P FORWARD ACCEPT<br>$IPTABLES -t mangle -P OUTPUT ACCEPT<br>$IPTABLES -t mangle -P POSTROUTING ACCEPT</pre><pre># Cleanup.<br>#------------------------------------------------------------------------------</pre><pre># Delete all<br>$IPTABLES -F<br>$IPTABLES -t nat -F<br>$IPTABLES -t mangle -F</pre><pre># Delete all<br>$IPTABLES -X<br>$IPTABLES -t nat -X<br>$IPTABLES -t mangle -X</pre><pre># Zero all packets and counters.<br>$IPTABLES -Z<br>$IPTABLES -t nat -Z<br>$IPTABLES -t mangle -Z</pre><pre># Completely disable IPv6.<br>#------------------------------------------------------------------------------</pre><pre># Block all IPv6 traffic<br># If the ip6tables command is available, try to block all IPv6 traffic.<br>if test -x $IP6TABLES; then<br># Set the default policies<br># drop everything<br>$IP6TABLES -P INPUT DROP 2&gt;/dev/null<br>$IP6TABLES -P FORWARD DROP 2&gt;/dev/null<br>$IP6TABLES -P OUTPUT DROP 2&gt;/dev/null</pre><pre># The mangle table can pass everything<br>$IP6TABLES -t mangle -P PREROUTING ACCEPT 2&gt;/dev/null<br>$IP6TABLES -t mangle -P INPUT ACCEPT 2&gt;/dev/null<br>$IP6TABLES -t mangle -P FORWARD ACCEPT 2&gt;/dev/null<br>$IP6TABLES -t mangle -P OUTPUT ACCEPT 2&gt;/dev/null<br>$IP6TABLES -t mangle -P POSTROUTING ACCEPT 2&gt;/dev/null</pre><pre># Delete all rules.<br>$IP6TABLES -F 2&gt;/dev/null<br>$IP6TABLES -t mangle -F 2&gt;/dev/null</pre><pre># Delete all chains.<br>$IP6TABLES -X 2&gt;/dev/null<br>$IP6TABLES -t mangle -X 2&gt;/dev/null</pre><pre># Zero all packets and counters.<br>$IP6TABLES -Z 2&gt;/dev/null<br>$IP6TABLES -t mangle -Z 2&gt;/dev/null<br>fi</pre><pre># Custom user-defined chains.<br>#------------------------------------------------------------------------------</pre><pre># LOG packets, then ACCEPT.<br>$IPTABLES -N ACCEPTLOG<br>$IPTABLES -A ACCEPTLOG -j $LOG $RLIMIT --log-prefix &quot;ACCEPT &quot;<br>$IPTABLES -A ACCEPTLOG -j ACCEPT</pre><pre># LOG packets, then DROP.<br>$IPTABLES -N DROPLOG<br>$IPTABLES -A DROPLOG -j $LOG $RLIMIT --log-prefix &quot;DROP &quot;<br>$IPTABLES -A DROPLOG -j DROP</pre><pre># LOG packets, then REJECT.<br># TCP packets are rejected with a TCP reset.<br>$IPTABLES -N REJECTLOG<br>$IPTABLES -A REJECTLOG -j $LOG $RLIMIT --log-prefix &quot;REJECT &quot;<br>$IPTABLES -A REJECTLOG -p tcp -j REJECT --reject-with tcp-reset<br>$IPTABLES -A REJECTLOG -j REJECT</pre><pre># Only allows RELATED ICMP types<br># (destination-unreachable, time-exceeded, and parameter-problem).<br># TODO: Rate-limit this traffic?<br># TODO: Allow fragmentation-needed?<br># TODO: Test.<br>$IPTABLES -N RELATED_ICMP<br>$IPTABLES -A RELATED_ICMP -p icmp --icmp-type destination-unreachable -j ACCEPT<br>$IPTABLES -A RELATED_ICMP -p icmp --icmp-type time-exceeded -j ACCEPT<br>$IPTABLES -A RELATED_ICMP -p icmp --icmp-type parameter-problem -j ACCEPT<br>$IPTABLES -A RELATED_ICMP -j DROPLOG</pre><pre># Make It Even Harder To Multi-PING<br>$IPTABLES  -A INPUT -p icmp -m limit --limit 1/s --limit-burst 2 -j ACCEPT<br>$IPTABLES  -A INPUT -p icmp -m limit --limit 1/s --limit-burst 2 -j LOG --log-prefix PING-DROP:<br>$IPTABLES  -A INPUT -p icmp -j DROP<br>$IPTABLES  -A OUTPUT -p icmp -j ACCEPT</pre><pre># Only allow the minimally required/recommended parts of ICMP. Block the rest.<br>#------------------------------------------------------------------------------</pre><pre># TODO: This section needs a lot of testing!</pre><pre># First, drop all fragmented ICMP packets (almost always malicious).<br>$IPTABLES -A INPUT -p icmp --fragment -j DROPLOG<br>$IPTABLES -A OUTPUT -p icmp --fragment -j DROPLOG<br>$IPTABLES -A FORWARD -p icmp --fragment -j DROPLOG</pre><pre># Allow all ESTABLISHED ICMP traffic.<br>$IPTABLES -A INPUT -p icmp -m state --state ESTABLISHED -j ACCEPT $RLIMIT<br>$IPTABLES -A OUTPUT -p icmp -m state --state ESTABLISHED -j ACCEPT $RLIMIT</pre><pre># Allow some parts of the RELATED ICMP traffic, block the rest.<br>$IPTABLES -A INPUT -p icmp -m state --state RELATED -j RELATED_ICMP $RLIMIT<br>$IPTABLES -A OUTPUT -p icmp -m state --state RELATED -j RELATED_ICMP $RLIMIT</pre><pre># Allow incoming ICMP echo requests (ping), but only rate-limited.<br>$IPTABLES -A INPUT -p icmp --icmp-type echo-request -j ACCEPT $RLIMIT</pre><pre># Allow outgoing ICMP echo requests (ping), but only rate-limited.<br>$IPTABLES -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT $RLIMIT</pre><pre># Drop any other ICMP traffic.<br>$IPTABLES -A INPUT -p icmp -j DROPLOG<br>$IPTABLES -A OUTPUT -p icmp -j DROPLOG<br>$IPTABLES -A FORWARD -p icmp -j DROPLOG</pre><pre># Selectively allow certain special types of traffic.<br>#------------------------------------------------------------------------------</pre><pre># Allow loopback interface to do anything.<br>$IPTABLES -A INPUT -i lo -j ACCEPT<br>$IPTABLES -A OUTPUT -o lo -j ACCEPT</pre><pre># Allow incoming connections related to existing allowed connections.<br>$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</pre><pre># Allow outgoing connections EXCEPT invalid<br>$IPTABLES -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT</pre><pre># Miscellaneous.<br>#------------------------------------------------------------------------------</pre><pre># We don&#39;t care about Milkosoft, Drop SMB/CIFS/etc..<br>$IPTABLES -A INPUT -p tcp -m multiport --dports 135,137,138,139,445,1433,1434 -j DROP<br>$IPTABLES -A INPUT -p udp -m multiport --dports 135,137,138,139,445,1433,1434 -j DROP</pre><pre># Explicitly drop invalid incoming traffic<br>$IPTABLES -A INPUT -m state --state INVALID -j DROP</pre><pre># Drop invalid outgoing traffic, too.<br>$IPTABLES -A OUTPUT -m state --state INVALID -j DROP</pre><pre># If we would use NAT, INVALID packets would pass - BLOCK them anyways<br>$IPTABLES -A FORWARD -m state --state INVALID -j DROP</pre><pre># PORT Scanners (stealth also)<br>$IPTABLES -A INPUT -m state --state NEW -p tcp --tcp-flags ALL ALL -j DROP<br>$IPTABLES -A INPUT -m state --state NEW -p tcp --tcp-flags ALL NONE -j DROP</pre><pre># TODO: Some more anti-spoofing rules? For example:<br># $IPTABLES -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP<br># $IPTABLES -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP<br># $IPTABLES -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP<br>$IPTABLES -N SYN_FLOOD<br>$IPTABLES -A INPUT -p tcp --syn -j SYN_FLOOD<br>$IPTABLES -A SYN_FLOOD -m limit --limit 2/s --limit-burst 6 -j RETURN<br>$IPTABLES -A SYN_FLOOD -j DROP</pre><pre># TODO: Block known-bad IPs (see <a href="http://www.dshield.org/top10.php">http://www.dshield.org/top10.php</a>).<br># $IPTABLES -A INPUT -s INSERT-BAD-IP-HERE -j DROPLOG</pre><pre># Drop any traffic from IANA-reserved IPs.<br>#------------------------------------------------------------------------------</pre><pre>$IPTABLES -A INPUT -s 0.0.0.0/7 -j DROP<br>$IPTABLES -A INPUT -s 2.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 5.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 7.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 10.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 23.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 27.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 31.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 36.0.0.0/7 -j DROP<br>$IPTABLES -A INPUT -s 39.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 42.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 49.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 50.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 77.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 78.0.0.0/7 -j DROP<br>$IPTABLES -A INPUT -s 92.0.0.0/6 -j DROP<br>$IPTABLES -A INPUT -s 96.0.0.0/4 -j DROP<br>$IPTABLES -A INPUT -s 112.0.0.0/5 -j DROP<br>$IPTABLES -A INPUT -s 120.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 169.254.0.0/16 -j DROP<br>$IPTABLES -A INPUT -s 172.16.0.0/12 -j DROP<br>$IPTABLES -A INPUT -s 173.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 174.0.0.0/7 -j DROP<br>$IPTABLES -A INPUT -s 176.0.0.0/5 -j DROP<br>$IPTABLES -A INPUT -s 184.0.0.0/6 -j DROP<br>$IPTABLES -A INPUT -s 192.0.2.0/24 -j DROP<br>$IPTABLES -A INPUT -s 197.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 198.18.0.0/15 -j DROP<br>$IPTABLES -A INPUT -s 223.0.0.0/8 -j DROP<br>$IPTABLES -A INPUT -s 224.0.0.0/3 -j DROP</pre><pre># Selectively allow certain outbound connections, block the rest.<br>#------------------------------------------------------------------------------</pre><pre># Allow outgoing Masternode requests.<br>$IPTABLES -A OUTPUT -m state --state NEW -p tcp --dport ${mnport} -j ACCEPT</pre><pre># Allow outgoing DNS requests. Few things will work without this.<br>#$IPTABLES -A OUTPUT -m state --state NEW -p udp --dport 53 -j ACCEPT<br>#$IPTABLES -A OUTPUT -m state --state NEW -p tcp --dport 53 -j ACCEPT</pre><pre># Allow outgoing HTTP requests. Unencrypted, use with care.<br>#$IPTABLES -A OUTPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT</pre><pre># Allow outgoing HTTPS requests.<br>#$IPTABLES -A OUTPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT</pre><pre># Allow outgoing &quot;submission&quot; (RFC 2476) requests.<br>#$IPTABLES -A OUTPUT -m state --state NEW -p tcp --dport 587 -j ACCEPT</pre><pre># Allow outgoing SSH requests.<br>$IPTABLES -A OUTPUT -m state --state NEW -p tcp --dport 14855 -j ACCEPT</pre><pre># Selectively allow certain inbound connections, block the rest.<br>#------------------------------------------------------------------------------</pre><pre># Allow incomming Masternode requests.<br>$IPTABLES -A INPUT -m state --state NEW -p tcp --dport ${mnport} -j ACCEPT</pre><pre># Allow incoming DNS requests.<br>#$IPTABLES -A INPUT -m state --state NEW -p udp --dport 53 -j ACCEPT<br>#$IPTABLES -A INPUT -m state --state NEW -p tcp --dport 53 -j ACCEPT</pre><pre># Allow incoming HTTP requests.<br>#$IPTABLES -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT</pre><pre># Allow incoming HTTPS requests.<br>#$IPTABLES -A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT</pre><pre># Allow incoming SSH requests.<br>$IPTABLES -A INPUT -m state --state NEW -p tcp --dport 14855 -j ACCEPT</pre><pre># Explicitly log and reject everything else.<br>#------------------------------------------------------------------------------</pre><pre># Use REJECT instead of REJECTLOG if you don&#39;t need/want logging.<br>$IPTABLES -A INPUT -j REJECTLOG<br>$IPTABLES -A OUTPUT -j REJECTLOG<br>$IPTABLES -A FORWARD -j REJECTLOG</pre><pre>#------------------------------------------------------------------------------<br># Testing the firewall.<br>#------------------------------------------------------------------------------</pre><pre># You should check/test that the firewall really works, using<br># iptables -vnL, nmap, ping, telnet, ...</pre><pre># Exit gracefully.<br>#------------------------------------------------------------------------------</pre><pre>exit 0</pre><h3>Bonus</h3><ol><li>Make sure your daemon is not stuck on the same block (checks block number every 30th minute)</li></ol><pre>#!/bin/bash<br># checkdaemon.sh<br># Make sure the daemon is not stuck.<br># Add the following to the crontab (i.e. crontab -e)<br># */30 * * * * ~/yourcurrency/checkdaemon.sh </pre><pre>previousBlock=$(cat ~/yourcurrency/blockcount)<br>currentBlock=$(yourcurrency-cli getblockcount)</pre><pre>yourcurrency-cli getblockcount &gt; ~/yourcurrency/blockcount</pre><pre>if [ “$previousBlock” == “$currentBlock” ]; then<br>   yourcurrency-cli stop <br>   sleep 10 <br>   yourcurrencyd<br>fi</pre><p>2. Clear your log files once a day</p><pre>#!/bin/bash<br># clearlog.sh<br># Clear debug.log every other day<br># Add the following to the crontab (i.e. crontab -e)</pre><pre># 0 0 */2 * * ~/yourcurrency/clearlog.sh </pre><pre>/bin/date &gt; ~/.yourcurrency/debug.log</pre><p>3. Create a cronjob for making sure yourcurrencyd is always running</p><pre>#!/bin/bash<br># makerun.sh<br># Make sure yourcurrencyd is always running.<br># Add the following to the crontab (i.e. crontab -e)<br># */1 * * * * ~/yourcurrency/makerun.sh </pre><pre>process=yourcurrencyd<br>makerun=&quot;yourcurrencyd&quot; <br>if ps ax | grep -v grep | grep $process &gt; /dev/null<br>then<br>  exit<br>else  <br>  $makerun &amp;<br>fi</pre><p>Stay ordinary</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2206341a50ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/automation-avengers/how-to-secure-your-masternode-vps-2206341a50ce">How to Secure Your Masternode VPS!</a> was originally published in <a href="https://medium.com/automation-avengers">Automation Avengers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Your Own EC2 Machine Images with Packer & Ansible on AWS for Immutable AWS Deployments]]></title>
            <link>https://faun.pub/build-your-own-ec2-machine-images-with-packer-ansible-on-aws-for-immutable-aws-deployments-f7dbe81934a1?source=rss-aa8d6ec60a12------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7dbe81934a1</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Süha Sülün]]></dc:creator>
            <pubDate>Mon, 08 Jan 2018 18:46:25 GMT</pubDate>
            <atom:updated>2019-07-16T14:36:38.196Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Packer?</h3><p>“Packer is an open source tool for creating identical machine images for multiple platforms from a single source configuration.”</p><p>Packer is lightweight, runs on every major operating system, and is highly performant, creating machine images for multiple platforms in parallel. Packer does not replace configuration management like Ansible or Chef. In fact, when building images, Packer is able to use tools like Ansible or Chef to install software onto the image.</p><p><a href="https://www.packer.io/docs/builders/amazon.html">Packer</a> is a great tool for building machine images. Among supported platforms are also <strong>Amazon Machine Images (AMIs) for Amazon Web Services (AWS)</strong>. To install packages you need and configure everything to taste, you can use a multitude of tools, such as Chef, Puppet, Salt or simple bash scripts.</p><p>A <em>machine image</em> is a single static unit that contains a pre-configured operating system and installed software which is used to quickly create new running machines. Machine image formats change for each platform. Some examples include <a href="https://en.wikipedia.org/wiki/Amazon_Machine_Image">AMIs</a> for EC2, VMDK/VMX files for VMware, OVF exports for VirtualBox, etc.</p><p>You may find more information about Packer on <a href="https://www.packer.io/">https://www.packer.io/</a></p><h3>Why do we need Packer?</h3><p>In the world of MicroServices, <em>immutable deployments</em> is a highly recommended strategy. It demands that every release get a fresh environment, all the way down to the lowest level — or in case of AWS, the <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html">AMI</a>.</p><p>An AMI can bundle the base operating system, application server/runtime, scripts, agents, etc. along with a versioned application artifact. In the spirit of <em>Infrastructure as Code</em>, the AMI itself can be versioned as a simple json file, as we will see in this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*qsw3DB8T811BiPMQqIfbFg.png" /><figcaption><a href="https://blog.talentica.com/2017/04/20/automation-of-ami-creation-using-packer/">Automation of AMI Creation Using Packer</a></figcaption></figure><h3>Installing Packer</h3><p>You can have the packer installation on your local workstation or on a cloud instance. All you need is the cli connectivity to AWS using access keys.</p><p><strong>Note:</strong> If you are planning to setup Packer on the local workstation, make sure you have the aws access keys set on file ~/.aws/credentials. It is not mandatory to have credentials file. You can pass the AWS credentials using the packer variable declaration(not preferred for security).</p><p>1. Download the required package from here. <a href="https://www.packer.io/downloads.html">https://www.packer.io/downloads.html</a></p><p>2. Unzip the package and set the path variable in ~/.bashrc</p><pre>export PATH=$PATH:/path/<strong>to</strong>/packer</pre><p>3. Refresh terminal</p><pre>source ~/.bashrc</pre><p>4. Verify packer installation by executing the packer command.</p><pre>packer version</pre><h3>Building Image</h3><p>Packer configuration templates are written in JSON format.</p><p>A template has the following three main parts.</p><p>1. <strong>variables</strong> — Where you define custom variables.</p><p>2. <strong>builders</strong> — Where you mention all the required AMI parameters.</p><p>3. <strong>provisioners</strong> — Where you can integrate a shell script, ansible play or a chef cookbook for configuring a required application in the AMI.</p><p>An example template for packaging an AWS AMI is given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dehaG-GQl2ys6GPgu9kDhQ.jpeg" /><figcaption>Packer Template definition structure</figcaption></figure><p>We run below packer template file as packer build template.json</p><p>Here we are going to use Eu-west region and a Debian AMI with AMI id ami-6ece3f388</p><pre>{<br>  &quot;variables&quot;: {<br>    &quot;aws_access_key&quot;: &quot;&quot;,<br>    &quot;aws_secret_key&quot;: &quot;&quot;<br>  },<br>&quot;builders&quot;: [{<br>&quot;type&quot;: &quot;amazon-ebs&quot;,<br>&quot;access_key&quot;: &quot;{{user `aws_access_key`}}&quot;,<br>&quot;secret_key&quot;: &quot;{{user `aws_secret_key`}}&quot;,<br>&quot;region&quot;: &quot;eu-west-2&quot;,<br>&quot;source_ami&quot;: &quot;ami-ece3f388&quot;,<br>&quot;instance_type&quot;: &quot;t2.medium&quot;,<br>&quot;ssh_username&quot;: &quot;admin&quot;,<br>&quot;ami_name&quot;: &quot;MiddleTier-{{isotime | clean_ami_name}}&quot;,<br>     &quot;ami_description&quot;: &quot;EC2 AMI Debian 9.1&quot;, <br>     &quot;tags&quot;: {<br>       &quot;role&quot;: &quot;web_Server&quot;<br>     },<br>     &quot;run_tags&quot;: {<br>       &quot;role&quot;: &quot;production_Web&quot;<br>     }<br>    }<br>],</pre><pre>&quot;provisioners&quot;: [<br>{<br>&quot;type&quot;: &quot;shell&quot;,<br>&quot;script&quot;: &quot;provision.sh&quot;<br>}<br>]<br>}</pre><p>Lets validate and inspect our template using the following commands.</p><pre>packer validate template.json</pre><pre>packer inspect template.json</pre><pre>#!/bin/bash<br>set -e<br>#provision.sh</pre><pre> sudo apt-get update<br> echo &quot;apt-get update done.&quot;<br> sudo apt-get -y upgrade<br> sudo apt-get install -y python-dev python-pip<br> sudo pip install ansible<br> sudo timedatectl set-timezone Europe/Istanbul<br> sudo localectl set-locale LANG=en_US.utf8<br> sudo wget ‘<a href="https://s3.amazonaws.com/packeramidemo/i2_playbook.yml&#39;">https://s3.amazonaws.com/packeramidemo/i_playbook.yml&#39;</a><br> echo &quot;Running build.&quot;<br> sudo ansible-playbook i_playbook.yml</pre><p>Also, we have used shell provisioner which calls a provision.sh file.</p><p>Packer supports the following provisioners.</p><p>1. Ansible</p><p>2. Chef</p><p>3. Salt</p><p>4. Shell</p><p>5. Powershell</p><p>6. Windows cmd</p><p>7. File — For copying file from local directory to VM image.</p><h3>Ansible Playbook File</h3><pre>hosts: localhost<br> connection: local<br> sudo: yes<br> tasks:</pre><pre><br>  — name: Install list of packages<br>  apt: name={{item}} state=installed<br> with_items:<br> — htop<br> — ctop<br> — screen<br> — unzip<br> — curl<br> — sudo<br> — mtr<br> — bash-completion<br> — tree<br> — colordiff<br> — ntp<br> — bwm-ng<br> — docker-compose<br> — apt-transport-https</pre><pre>- name: install docker<br>  command: sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D</pre><pre>- name: add deb repo<br>  command: sudo touch /etc/apt/sources.list.d/docker.list</pre><pre>- lineinfile: dest=&quot;/etc/apt/sources.list.d/docker.list&quot; line=&quot;{{item}}&quot;<br>  with_items:<br>    - &quot;deb https://apt.dockerproject.org/repo ubuntu-trusty main&quot;</pre><pre>- name: apt update<br>  apt: update_cache=yes</pre><pre>- apt: name=docker-engine state=present</pre><pre>- name: add user mod<br>  command: sudo usermod -aG docker {{remote_user}}</pre><pre>- name: add user mod<br>  command: sudo usermod -aG docker {{action_user}}</pre><pre> — name: apt update<br> command: sudo apt-get update <br><br> — name: Download index.html<br> shell: sudo wget <a href="https://s3.amazonaws.com/packeramidemo/index.html">https://s3.amazonaws.com/packeramidemo/index.html</a></pre><pre><br> — name: Download Dockerfile<br> command: wget <a href="https://s3.amazonaws.com/packeramidemo/Dockerfile">https://s3.amazonaws.com/packeramidemo/Dockerfile</a> </pre><pre><br> — name: Docker build image<br> command: sudo docker build -t “simple_worx:dockerfile” .<br> ignore_errors: yes</pre><pre><br> — name: Docker run even after restart<br> command: sudo docker run -dit — restart unless-stopped -p 80:80 simple_worx:dockerfile<br> ignore_errors: yes</pre><pre><br> — name: Docker running?<br> command: curl localhost:80<br> register: out<br> — debug: var=out.stdout_lines</pre><p>There you go! Packer your AMIs for Immutable AWS Deployments</p><p>Now you can find your own custom image on AWS Images&gt;AMIs section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*a57tAgurE2s1QGWn" /></figure><p><strong>Join our community Slack and read our weekly Faun topics ⬇</strong></p><p><a href="https://www.faun.dev/join/?utm_source=medium.com%2Ffaun&amp;utm_medium=medium&amp;utm_campaign=faunmedium">Join a Community of Aspiring Developers.Get must-read articles, learn new technologies for free, chat with like-minded people, get job offers, listen to podcasts and more</a></p><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7dbe81934a1" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/build-your-own-ec2-machine-images-with-packer-ansible-on-aws-for-immutable-aws-deployments-f7dbe81934a1">Build Your Own EC2 Machine Images with Packer &amp; Ansible on AWS for Immutable AWS Deployments</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>