{"id":1133,"date":"2021-07-25T06:51:02","date_gmt":"2021-07-25T13:51:02","guid":{"rendered":"https:\/\/bullyrooks.com\/?p=1133"},"modified":"2021-07-25T08:07:06","modified_gmt":"2021-07-25T15:07:06","slug":"confirming-the-continuous-deployment-pipeline","status":"publish","type":"post","link":"https:\/\/bullyrooks.com\/index.php\/2021\/07\/25\/confirming-the-continuous-deployment-pipeline\/","title":{"rendered":"Confirming the Continuous Deployment Pipeline"},"content":{"rendered":"\n<p>Lets verify that changes to our application will be automatically available when they&#8217;re pushed up.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update the Application<\/h2>\n\n\n\n<p>Let&#8217;s start a new branch<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git checkout -b \"greeting-change\"<\/code><\/pre>\n\n\n\n<p>Now update our service to return a different greeting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Component\npublic class HelloWorldService {\n\n    public HelloWorld helloWorld(String name) {\n        return HelloWorld.builder()\n                .response(\"G'Day, \" + name)\n                .build();\n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Commit and Merge<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git status\n$ git add .\n$ git commit -m \"changed greeting\"\n$ git push --set-upstream origin greeting-change\n$ git checkout main\n$ git merge greeting-change\n$ git push<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Review the Actions <\/h2>\n\n\n\n<p>This should have kicked off a workflow<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"529\" src=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-48-1024x564.png?resize=960%2C529&#038;ssl=1\" alt=\"\" class=\"wp-image-1135\" srcset=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-48.png?resize=1024%2C564&amp;ssl=1 1024w, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-48.png?resize=300%2C165&amp;ssl=1 300w, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-48.png?resize=768%2C423&amp;ssl=1 768w, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-48.png?w=1337&amp;ssl=1 1337w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Now execute your postman request again (you shouldn&#8217;t need to change anything)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"316\" src=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-47-1024x337.png?resize=960%2C316&#038;ssl=1\" alt=\"\" class=\"wp-image-1134\" srcset=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-47.png?resize=1024%2C337&amp;ssl=1 1024w, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-47.png?resize=300%2C99&amp;ssl=1 300w, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-47.png?resize=768%2C253&amp;ssl=1 768w, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-47.png?w=1206&amp;ssl=1 1206w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" data-recalc-dims=\"1\" \/><figcaption>Responds with the new greeting!<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Final Thoughts<\/h2>\n\n\n\n<p>Lambdas are kind of cool, but this implementation has a bunch of drawbacks<\/p>\n\n\n\n<p><strong>Large File Size<\/strong> &#8211; This is directly related to the fact that I am &#8216;cheating&#8217; and using spring framework to abstract a lot of the implementation.  The shaded jar doesn&#8217;t know what I&#8217;m using so it packs up everything.  There are ways to make the artifact smaller by eliminating unused classes and libraries(by using Proguard, for example).  However, because I&#8217;m using the built in spring handlers outside of the code, proguard won&#8217;t know to include it.  There are ways around that (i.e. explicitly including the library), but then this just becomes more problematic code maintenance and tribal knowledge.<\/p>\n\n\n\n<p><strong>Lambda Interfaces<\/strong> &#8211; This isn&#8217;t necessarily a lambda problem because if I was going to construct a well built REST interface using spring boot I would probably have to spend the same amount of effort applying best practices.  This implementation is hiding a <em>ton<\/em> of behind the scenes effort.  For example, transforming an api structure to a message structure (and mapping the headers correctly) is about 3 lines in my code, but that&#8217;s because spring is doing a lot of that work for me.  However, if I was doing anything even a little more complicated I might not be able to use the &#8216;out of the box&#8217; solution.  <a href=\"https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/java-handler.html\">Take a look at the aws documentation on building a java based api gateway request handler<\/a>.  There&#8217;s json serialization happening, streams, etc&#8230; that if I had to implement by hand might become a problematic maintenance problem quickly.<\/p>\n\n\n\n<p><strong>Testing<\/strong> &#8211; There&#8217;s no way (that I can see) to build a component test outside of the deployment.  Most of the work that we did was to convert the service into a function and that code is untestable (or difficult to test) outside of the deployment.  If we write spring boot microservices using the traditional Controller structure we can write tests that execute as part of the build pipeline and we would be able to catch breaking changes earlier.  In this implementation, I have to deploy to test which can add minutes to the feedback loop.  <\/p>\n\n\n\n<p>There&#8217;s probably better ways to implement lambda and this was my initial experiment.  This is extremely cheap to run and was fairly easy to stand up, but if we wanted to build an entire system or application based on this, it could become problematic very quickly.  <\/p>\n\n\n\n<p>If you have suggestions on how to implement java based lambdas, please give me feedback in the comments.  I would be willing to try other implementations.  However, for me, the effort to build docker based microservices deployed into kubernetes is about the same (or easier) and I have more faith in the code because I have better testing.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"entry-summary\">\nLets verify that changes to our application will be automatically available when&hellip;\n<\/div>\n<div class=\"link-more\"><a href=\"https:\/\/bullyrooks.com\/index.php\/2021\/07\/25\/confirming-the-continuous-deployment-pipeline\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &ldquo;Confirming the Continuous Deployment Pipeline&rdquo;<\/span>&hellip;<\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[142,146,77,148,44,147,144,143,50,42,43,145],"course":[141],"class_list":["post-1133","post","type-post","status-publish","format-standard","hentry","category-software-development","tag-aws","tag-aws-gateway","tag-cicd","tag-functions","tag-github","tag-github-actions","tag-java","tag-lambda","tag-maven","tag-spring","tag-spring-boot","tag-terraform","course-spring-boot-lambda-on-aws","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":1102,"url":"https:\/\/bullyrooks.com\/index.php\/2021\/07\/24\/terraform-centralized-state-management\/","url_meta":{"origin":1133,"position":0},"title":"Terraform Centralized State Management","author":"Bullyrook","date":"July 24, 2021","format":false,"excerpt":"As we saw in the last course Terraform will manage the state of your application, but by default it stores this locally. This is not ideal for us and will cause problems when we try to work with others or create a continuous deployment pipeline. Now we'll create a way\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-23.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-23.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-23.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-23.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-23.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1115,"url":"https:\/\/bullyrooks.com\/index.php\/2021\/07\/24\/automated-terraform-deploy-using-github-actions\/","url_meta":{"origin":1133,"position":1},"title":"Automated Terraform Deploy Using Github Actions","author":"Bullyrook","date":"July 24, 2021","format":false,"excerpt":"Now we just need to build and deploy our application automatically so that whenever we push changes to the main branch, they'll automatically become available through our endpoint. Create Our Artifact Storage We're going to use a 'poor man's artifactory' to store our compiled .jar files. With our current build\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-34.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1065,"url":"https:\/\/bullyrooks.com\/index.php\/2021\/07\/23\/spring-boot-lambda-prerequisites\/","url_meta":{"origin":1133,"position":2},"title":"Spring Boot Lambda Prerequisites","author":"Bullyrook","date":"July 23, 2021","format":false,"excerpt":"In this course we're going to build a very simple spring boot lambda, deploy it manually to AWS to make sure that it works and then automate the deployment using Terraform and github actions. This will allow us to automatically build and deploy changes from a commit to the main\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1081,"url":"https:\/\/bullyrooks.com\/index.php\/2021\/07\/24\/spring-boot-lambda-api-implementation\/","url_meta":{"origin":1133,"position":3},"title":"Spring Boot Lambda API Implementation","author":"Bullyrook","date":"July 24, 2021","format":false,"excerpt":"We've got a 'working' lambda now, but we can't actually use it anywhere. The easiest thing to do at this point is add an API Gateway trigger to our function as a new lambda. This will require a little bit of work to make an API Gateway adapter to our\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-10.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-10.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-10.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1069,"url":"https:\/\/bullyrooks.com\/index.php\/2021\/07\/23\/spring-boot-lambda-implementation\/","url_meta":{"origin":1133,"position":4},"title":"Spring Boot Lambda Implementation","author":"Bullyrook","date":"July 23, 2021","format":false,"excerpt":"Now we're going to add some code. I'm going to follow my ports and adapters method of building a DTO and value object that I've used previously. Yes, its a bit of overkill for this project (especially a hello world example), but if you're using this course as a springboard\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-4.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1094,"url":"https:\/\/bullyrooks.com\/index.php\/2021\/07\/24\/terraform-setup-and-first-install\/","url_meta":{"origin":1133,"position":5},"title":"Terraform Setup and First Install","author":"Bullyrook","date":"July 24, 2021","format":false,"excerpt":"Terraform is a system that allows you to define your infrastructure in a series of configuration files. These configuration files are linked to a provider library which will execute the infrastructure create, update and teardown commands on the platform you want to deploy to. This is called \"Infrastructure as Code\"\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-19.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-19.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-19.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/07\/image-19.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/1133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/comments?post=1133"}],"version-history":[{"count":3,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/1133\/revisions"}],"predecessor-version":[{"id":1138,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/1133\/revisions\/1138"}],"wp:attachment":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/media?parent=1133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/categories?post=1133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/tags?post=1133"},{"taxonomy":"course","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/course?post=1133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}