<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Arpit</title>
    <description>The latest articles on DEV Community by Arpit (@arpit).</description>
    <link>https://dev.to/arpit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F85027%2Fa48251d6-924d-4819-8ad5-b15b6a2abc3d.jpg</url>
      <title>DEV Community: Arpit</title>
      <link>https://dev.to/arpit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arpit"/>
    <language>en</language>
    <item>
      <title>State of Spring survey 2021</title>
      <dc:creator>Arpit</dc:creator>
      <pubDate>Wed, 10 Nov 2021 11:31:20 +0000</pubDate>
      <link>https://dev.to/arpit/state-of-spring-survey-2021-2abl</link>
      <guid>https://dev.to/arpit/state-of-spring-survey-2021-2abl</guid>
      <description>&lt;p&gt;VMWare recently did a survey of over 1500 individuals who use Spring for their "State of Spring 2021", which you can view &lt;a href="https://tanzu.vmware.com/content/ebooks/the-state-of-spring-2021"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I read the survey and here are a few things that I learnt from it. &lt;/p&gt;

&lt;h3&gt;
  
  
  Spring (esp. Spring boot) positively impacts developer productivity
&lt;/h3&gt;

&lt;p&gt;Most users (95%) said that Spring boot increases the developer productivity hugely. Similarly for Spring, overall, most developers agreed that it increases the productivity, more than other Java platforms. &lt;/p&gt;

&lt;p&gt;Also, in terms of who knows most about Spring in the team, most people said, they do not have a Spring specialist (34%), which I agree with as well. I think since Spring is a framework, rather than a language, most teams leverage their developers, architects, etc. to be up to date on the new features of Spring, and related projects, rather than having someone dedicated for this role. But this also means, each company, needs to make sure, they give their developers enough space, time and resources, to keep themselves updated of the things happening in the spring community.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where do people find answers
&lt;/h3&gt;

&lt;p&gt;For a majority of developers, &lt;a href="http://stackoverflow.com"&gt;stackoverflow.com&lt;/a&gt; is the way to go for any questions about spring. Spring official documentation on &lt;a href="http://spring.io"&gt;spring.io&lt;/a&gt; is a close second. Close to 70% developers still go to the official documentation, which I think is a pretty good number. But VMware acknowledged that they need to focus more on creating demos and improving the docs. The fact that there are multiple resources apart from the official documentation and stackoverflow, it's surprising that they didn't come up as an answer in the survey. If they do publish the raw data, I'm sure we'll find many people who leverage these in their day to day.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shiny new modules
&lt;/h3&gt;

&lt;p&gt;Developers love the new shiny modules spring continues to come up with. Half of them said, that's one of the reasons they stay with spring. 39% said they would add new modules to their existing or new projects in the near future. It speaks to the fact that spring keeps up to date with new tech, and keeps adding integrations for them. And who doesn't like a new lego block in their toy box.&lt;/p&gt;

&lt;h3&gt;
  
  
  Give me more data !
&lt;/h3&gt;

&lt;p&gt;Spring data is the most popular module, which suggest a lot of database integrations, mostly relational. Although noSQL also seemed to be close behind with Mongo, Redis and Elastic.&lt;/p&gt;

&lt;p&gt;Spring security is as popular as spring data, which is good, since that means people are keeping their applications secure!&lt;/p&gt;

&lt;p&gt;About picking a new module, or Spring project, people consider documentation and maturity as the main factors. &lt;/p&gt;

&lt;p&gt;Another thing that came out, as a winner, is Kotlin ! More than 90% of the surveyors have a positive view about it and ~60% plan to learn or use it for their projects. &lt;/p&gt;

&lt;h3&gt;
  
  
  We want more APIs !
&lt;/h3&gt;

&lt;p&gt;Although REST, SOA has been around for very long, the primary use-case for Spring and Spring Boot is still creating and exposing API to internal and external consumers. &lt;/p&gt;

&lt;p&gt;Also, a large percentage of people use Modern architectures - like microservices, API management, API Gateways, observability, etc. for their application architectures. &lt;/p&gt;

&lt;p&gt;A lot of people are also considering and using GraphQL (20%) and Spring already has an &lt;a href="https://spring.io/blog/2021/07/06/introducing-spring-graphql"&gt;integration&lt;/a&gt; with it. &lt;/p&gt;

&lt;h3&gt;
  
  
  Native is the new cool kid ?
&lt;/h3&gt;

&lt;p&gt;Spring Native is the newly launched module that allows your Spring applications to start quicker, reduce memory footprint, which has been one of the bigger complaints by developers using Spring. Native solves these issues and seems like a lot of the developers are eagerly reading up on it. The adoption is not still 3%, but it's an early project, so I would not judge this yet. Also, the fact that it's still in Beta and possibly not mature enough, is holding people back for now. A third of people also have issues with the build time, but that is improving and that is essentially the cost you pay for getting a fast startup. &lt;/p&gt;

&lt;p&gt;But a lot of people (58%) plan to deploy it in the next few months to a couple of years, which is great adoption for such a new project. &lt;/p&gt;

&lt;h3&gt;
  
  
  In Summary...
&lt;/h3&gt;

&lt;p&gt;I think Spring and Spring Boot specifically, is here to stay, because of its ease of use, developer productivity, excellent and always improving documentation and a massive user group. A LinkedIn group called Spring Users, has more than 90,000 members, which speaks about the sheer number of people either using, learning or planning to use it.&lt;/p&gt;

&lt;p&gt;Article originally published &lt;a href="https://arpit.dev/State-of-Spring-survey-2021-c6c4f741abda4e248c80e2ae9f5cee75"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>vmware</category>
      <category>spring</category>
    </item>
    <item>
      <title>Dynamic health-checks with spring boot</title>
      <dc:creator>Arpit</dc:creator>
      <pubDate>Mon, 08 Nov 2021 19:28:50 +0000</pubDate>
      <link>https://dev.to/arpit/dynamic-health-checks-with-spring-boot-43g0</link>
      <guid>https://dev.to/arpit/dynamic-health-checks-with-spring-boot-43g0</guid>
      <description>&lt;p&gt;Health-check is an important part of any project that you create. You can deploy your service, and expose an endpoint that emits its health periodically. These endpoints could be called from your container, your dependent clients, your cloud deployment infrastructure, etc. As long as the service is healthy or "UP", the consumers are happy. When it goes down, the consumers can either pivot to something else, or show an error to the end user to wait till it's back up. &lt;/p&gt;

&lt;h3&gt;
  
  
  Dynamic Health-checks
&lt;/h3&gt;

&lt;p&gt;Let's imagine you have a use-case, where your spring boot application is already up, and its talking to other systems, and you want to register a new health endpoint while your application is running. Spring boot will already give something like this already out of the box -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"UP"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"components"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ping"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"UP"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, the application is up and running now, and there is a new dependency that you have identified, that you want to register. Usually, the health-checks are static - either configured in the yaml / properties file or defined as part of your code by implementing &lt;a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/actuate/health/HealthIndicator.html"&gt;HealthIndicator&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;But, there is another way to register a health indicator, while the system is running, this is using &lt;a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/actuate/health/HealthContributorRegistry.html"&gt;HealthContributorRegistry&lt;/a&gt;. Spring boot gives you this from the application context, so you can Autowire it in your bean.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@SpringBootApplication&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Application&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@Autowired&lt;/span&gt;
    &lt;span class="nc"&gt;HealthContributorRegistry&lt;/span&gt; &lt;span class="n"&gt;healthContributorRegistry&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;SpringApplication&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Application&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you get the object, there are really simple methods to invoke to &lt;code&gt;register&lt;/code&gt; or &lt;code&gt;unregister&lt;/code&gt; contributors to your application while its running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;healthContributorRegistry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;registerContributor&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"myNewService"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MyNewServiceImpl&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your &lt;a href="http://MyNewServiceImpl.java"&gt;MyNewServiceImpl.java&lt;/a&gt; should implement &lt;code&gt;HealthIndicator&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"UP"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"components"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ping"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"UP"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"myNewService"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"UP"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also unregister it, if you want to remove something at runtime.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;healthContributorRegistry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;unregisterContributor&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"myNewService"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this helps you, your application and your application's consumers stay healthy 🙂&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/actuate/health/HealthContributorRegistry.html"&gt;Spring Boot documentation&lt;/a&gt;&lt;br&gt;
Originally published &lt;a href="https://arpit.dev/Dynamic-health-checks-with-spring-boot-33faf8fad89c4697ad468cf8e610eef5"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>health</category>
      <category>springboot</category>
      <category>actuator</category>
    </item>
    <item>
      <title>Improve your APIs with Optic</title>
      <dc:creator>Arpit</dc:creator>
      <pubDate>Wed, 28 Oct 2020 23:59:14 +0000</pubDate>
      <link>https://dev.to/arpit/improve-your-apis-with-optic-3bn2</link>
      <guid>https://dev.to/arpit/improve-your-apis-with-optic-3bn2</guid>
      <description>&lt;p&gt;If you are an API Developer or an API consumer, you know how important it is to keep your contracts up-to-date all the time. If you change something and don't update the contract, someone somewhere gets mad 😡 !&lt;/p&gt;

&lt;p&gt;So here's a tool to help make friends of API consumers 👫 . &lt;/p&gt;

&lt;h3&gt;
  
  
  What?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://useoptic.com/"&gt;Optic&lt;/a&gt; is a "Git-like version control system for API contracts". It makes it easier to create API documentation and update it as you go on merrily change your API request and response. All you have to do is review the change and approve it. &lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;You can install the CLI as an npm global package or using homebrew. &lt;/p&gt;

&lt;p&gt;It works with most of the languages - Java, NodeJS, Go, Rust, etc. &lt;/p&gt;

&lt;h3&gt;
  
  
  How?
&lt;/h3&gt;

&lt;p&gt;Optic uses a proxy to monitor the API over the network. It detects any change in your API and suggests changes in your API documentation. &lt;/p&gt;

&lt;p&gt;You navigate to your Project's root and run &lt;/p&gt;

&lt;p&gt;&lt;code&gt;api init&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lfFsmUZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252Ff93ba9d8-371e-45e0-afa2-84ff092ab833%252FScreenshot_2020-10-28_at_23.28.33.png%3Ftable%3Dblock%26id%3D2128b283-6ee6-4485-973d-0ab3cb996027%26width%3D2800%26userId%3D%26cache%3Dv2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lfFsmUZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252Ff93ba9d8-371e-45e0-afa2-84ff092ab833%252FScreenshot_2020-10-28_at_23.28.33.png%3Ftable%3Dblock%26id%3D2128b283-6ee6-4485-973d-0ab3cb996027%26width%3D2800%26userId%3D%26cache%3Dv2" alt="Output on running api init"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This creates a &lt;code&gt;optic.yml&lt;/code&gt; in your project that you then navigate to and update with a couple of things&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;command - Command that runs your API Project. You also need to set the server port to be &lt;code&gt;$OPTIC_API_PORT&lt;/code&gt;. This is a sample for a Maven Java project&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;SERVER_PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$OPTIC_API_PORT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; mvn &lt;span class="nb"&gt;exec&lt;/span&gt;:java &lt;span class="nt"&gt;-Dexec&lt;/span&gt;.mainClass&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"com.test.Application"&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;inboundUrl - Your API hostname and port. Like &lt;a href="http://localhost:8080/"&gt;&lt;code&gt;http://localhost:8080&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then there is a way to check if your configuration is working ok. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;api check start&lt;/code&gt;. The &lt;code&gt;check&lt;/code&gt; prefix verifies your configuration and then &lt;code&gt;start&lt;/code&gt; starts the API. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BSqlmFxA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F13855e18-d49b-47bc-94f1-d79bc89216d2%252FUntitled.png%3Ftable%3Dblock%26id%3Dc2598069-d6aa-4f0b-8472-70ae11807391%26width%3D2800%26userId%3D%26cache%3Dv2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BSqlmFxA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F13855e18-d49b-47bc-94f1-d79bc89216d2%252FUntitled.png%3Ftable%3Dblock%26id%3Dc2598069-d6aa-4f0b-8472-70ae11807391%26width%3D2800%26userId%3D%26cache%3Dv2" alt="Output on running api check start"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are a few other commands to help API developers&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;api generate - This generates an Open API documentation that you can then use to host somewhere and have it used as a UI, like your Readme, Swagger UI, Slate etc.&lt;/li&gt;
&lt;li&gt;api spec - Opens your Optic API specification in a browser&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I created a sample Spring Boot Ping API and set it up following the documentation. I got it up and running in a few minutes and it was finding endpoints and suggesting documentation right away. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---7bSR-AE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F2f92d0c7-b2b1-4a90-9cc6-68341f63f4c8%252FScreenshot_2020-10-28_at_23.42.22.png%3Ftable%3Dblock%26id%3D589e285d-3e18-4997-b3da-56b6095a5490%26width%3D2800%26userId%3D%26cache%3Dv2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---7bSR-AE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F2f92d0c7-b2b1-4a90-9cc6-68341f63f4c8%252FScreenshot_2020-10-28_at_23.42.22.png%3Ftable%3Dblock%26id%3D589e285d-3e18-4997-b3da-56b6095a5490%26width%3D2800%26userId%3D%26cache%3Dv2" alt="Optic Generated Documentation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For all the API Developers, this solves a major pain point of documenting the APIs while they are being developed and also keeping them up to date as and when changes are made. And it does so, all by snooping into your local traffic while you code away ! &lt;/p&gt;

&lt;h3&gt;
  
  
  Why I love it !
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;GitBot&lt;/strong&gt; - Apart from doing all the documentation for you, it has a github integration that would comment on every Pull Request, Detect any changes in your API and comment that in your PR ! Right there for the reviewers to see what you have fixed (or broken). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Look Ma, no YAML ! -&lt;/strong&gt; (Well almost) There's only a few lines of yaml that it expects you to write. All other the other Open API specs to get that beautiful documentation, done for you. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API Test Coverage -&lt;/strong&gt; With integration for running the tests through Newman (you will have to define a task in your optic.yml), you can use a &lt;code&gt;--collect-coverage&lt;/code&gt; flag to ask Optic to track API testing code coverage and report that to you. It will look at your API Documentation Responses, and highlight any responses that you have not written a test for. So no more forgetting the edge case in your API Automation Testing !&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I think it's a great tool that has a lot of potential use for any company developing APIs and need to keep track of their changes. You can add it to your build pipeline and use that code coverage tool in the CI pipeline. It is definitely like source control for your APIs as they advertise. &lt;/p&gt;

&lt;p&gt;Also, it's free and open source. So you can fork the repo &lt;a href="https://github.com/opticdev/optic"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>restapi</category>
      <category>swagger</category>
      <category>openapi</category>
      <category>documentation</category>
    </item>
    <item>
      <title>Playing with the new AWS Copilot CLI</title>
      <dc:creator>Arpit</dc:creator>
      <pubDate>Tue, 06 Oct 2020 22:19:44 +0000</pubDate>
      <link>https://dev.to/arpit/playing-with-the-new-aws-copilot-cli-i43</link>
      <guid>https://dev.to/arpit/playing-with-the-new-aws-copilot-cli-i43</guid>
      <description>&lt;p&gt;AWS just launched a fresh CLI recently - copilot. AWS says this CLI is for containerised applications. So the target audience seems to be people using ECS and Fargate. I decided to try this new stuff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;The installation for Mac is quite simple. You use homebrew like -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;aws/tap/copilot-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For windows and Linux refer - &lt;a href="https://github.com/aws/copilot-cli/wiki/Installation#manually"&gt;https://github.com/aws/copilot-cli/wiki/Installation#manually&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;aws&lt;/code&gt; cli. If you do not have that you might want to install and configure that. Steps &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html"&gt;here&lt;/a&gt; and &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;docker&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Initialisation
&lt;/h3&gt;

&lt;p&gt;I am using a simple html file to deploy to in a container using a simple Dockerfile.&lt;/p&gt;

&lt;p&gt;The first command you will have to run to initialise is &lt;/p&gt;

&lt;p&gt;&lt;code&gt;copilot init&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This asks you a few questions and sets up the following things for you in the AWS account. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Virtual Private Cloud (VPC) on 2 Availability Zones (AZs), which includes

&lt;ol&gt;
&lt;li&gt;Internet Gateway&lt;/li&gt;
&lt;li&gt;Public Subnet&lt;/li&gt;
&lt;li&gt;Private Subnet&lt;/li&gt;
&lt;li&gt;Route Table&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;ECS Cluster&lt;/li&gt;
&lt;li&gt;Application Load Balancer (ALB)&lt;/li&gt;
&lt;li&gt;Elastic Container Registry (ECR)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N6e9AwWs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F18a4583d-8042-4afa-8992-c50a3f2beeb9%252FUntitled.png%3Ftable%3Dblock%26id%3Dd846c7c2-32ec-4592-9302-c61cd42c1749%26width%3D2790%26userId%3D%26cache%3Dv2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N6e9AwWs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F18a4583d-8042-4afa-8992-c50a3f2beeb9%252FUntitled.png%3Ftable%3Dblock%26id%3Dd846c7c2-32ec-4592-9302-c61cd42c1749%26width%3D2790%26userId%3D%26cache%3Dv2" alt="After running copilot init, creation of infrastructure ongoing&amp;lt;br&amp;gt;
" width="880" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After running copilot init, creation of infrastructure ongoing&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment
&lt;/h3&gt;

&lt;p&gt;Once this is complete, it will ask you  whether you want to deploy this service to a test environment. If you say yes, it will deploy the service in a test environment and provide a URL where you can access the service (if it is a Web Service that you configured).&lt;/p&gt;

&lt;p&gt;This does everything you need to deploy and access the Service through a Web URI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--axi0ppms--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F07de3260-de2d-4270-8771-9a16f5154198%252FUntitled.png%3Ftable%3Dblock%26id%3Ded923413-3402-4bc0-8dff-33e3b765b761%26width%3D1930%26userId%3D%26cache%3Dv2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--axi0ppms--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F07de3260-de2d-4270-8771-9a16f5154198%252FUntitled.png%3Ftable%3Dblock%26id%3Ded923413-3402-4bc0-8dff-33e3b765b761%26width%3D1930%26userId%3D%26cache%3Dv2" alt="Here it is deploying to a new 'test' environment. Notice how it created everything for you from VPC to ALB.👀" width="880" height="617"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Test your deployment
&lt;/h3&gt;

&lt;p&gt;Finally when the deployment is complete, it will give you a URL that you can paste in your favourite browser and test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y1nKF4kD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F7fb7e4ff-d39e-4f2d-bc0c-2156a57180d0%252FUntitled.png%3Ftable%3Dblock%26id%3D8fd7a50e-3870-41b3-91d0-c2bf7279c043%26width%3D4210%26userId%3D%26cache%3Dv2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y1nKF4kD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F7fb7e4ff-d39e-4f2d-bc0c-2156a57180d0%252FUntitled.png%3Ftable%3Dblock%26id%3D8fd7a50e-3870-41b3-91d0-c2bf7279c043%26width%3D4210%26userId%3D%26cache%3Dv2" alt="Terminal showing Deployed successfully and giving the URL" width="880" height="179"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uXYbaeqX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F34819fa9-b164-45ce-a78a-b3aca3bfdda9%252FUntitled.png%3Ftable%3Dblock%26id%3Deb028bc7-cfc4-45e4-9033-27dbf51df9d8%26width%3D4380%26userId%3D%26cache%3Dv2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uXYbaeqX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://arpit.dev/image/https%253A%252F%252Fs3-us-west-2.amazonaws.com%252Fsecure.notion-static.com%252F34819fa9-b164-45ce-a78a-b3aca3bfdda9%252FUntitled.png%3Ftable%3Dblock%26id%3Deb028bc7-cfc4-45e4-9033-27dbf51df9d8%26width%3D4380%26userId%3D%26cache%3Dv2" alt="Browser displaying Success Page" width="880" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voila!&lt;/p&gt;

&lt;h3&gt;
  
  
  Other commands
&lt;/h3&gt;

&lt;p&gt;The copilot CLI has three main command streams&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;app - You can use this to perform operations on applications that you have deployed.
&lt;/li&gt;
&lt;li&gt;env - To perform operations on the environments where your apps are deployed

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;copilot env init&lt;/code&gt; - Initialise the env&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;copilot env ls&lt;/code&gt; - List all envs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;copilot env show&lt;/code&gt; - Show Details of the env&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;copilot env delete&lt;/code&gt; - Delete the env&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;svc&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All these have a common set of commands, which are self explanatory - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;copilot {app / env / svc} init&lt;/code&gt; - Initialize&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;copilot {app / env / svc} ls&lt;/code&gt; - List&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;copilot {app / env / svc} show&lt;/code&gt; - Gives a more detailed view of the services in the application, the Environments and the URIs. In case of service, it will also display Routes, Service Discovery and other Configuration. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;copilot {app / env / svc} delete&lt;/code&gt; - To delete the app / env / service&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Apart from these, svc has some more commands for &lt;code&gt;package&lt;/code&gt;, &lt;code&gt;deploy&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt; and &lt;code&gt;logs&lt;/code&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Use cases
&lt;/h3&gt;

&lt;p&gt;I think copilot has a really wide range of command sets to cover a wide range of use cases. It can be easily used for CI/CD for most containerised apps. Just install in the pipeline of your choice and deploy from there. &lt;/p&gt;

&lt;p&gt;Anyone using ECS or Fargate could make their deployment processes easier by these commands. &lt;/p&gt;

&lt;p&gt;They also have plans to introduce provisioning of S3, Databases (SQL and NoSQL) from the command which would further widen the use cases to deploy not only services but also storage for your application using this command. &lt;/p&gt;

&lt;p&gt;Also, its open source. Check it out &lt;a href="https://github.com/aws/copilot-cli"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>githubcopilot</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
