<?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 Samuel Addico on Medium]]></title>
        <description><![CDATA[Stories by Samuel Addico on Medium]]></description>
        <link>https://medium.com/@samaddico?source=rss-4e6b1d0c0ea5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6z1Sa3-rtpGf_cWWkQcaZA@2x.jpeg</url>
            <title>Stories by Samuel Addico on Medium</title>
            <link>https://medium.com/@samaddico?source=rss-4e6b1d0c0ea5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 10:22:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samaddico/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[Automating Golang Build Releases with GoReleaser]]></title>
            <link>https://medium.com/@samaddico/automating-golang-build-releases-with-goreleaser-80346e44afee?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/80346e44afee</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Fri, 12 Dec 2025 07:39:57 GMT</pubDate>
            <atom:updated>2025-12-12T07:39:57.898Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>Building and releasing Golang projects can be time-consuming and error-prone, especially manually. However, with the help of GoReleaser, you can automate the build and release process in your CICD pipelines, saving you time and reducing the risk of errors. In this blog post, we’ll explore how to use GoReleaser in a GitLab CI/CD pipeline to automate the release process of Golang projects. We’ll cover the basics of GoReleaser, how to configure it for your project, and how to integrate it into your GitLab CI/CD pipeline. By the end of this post, you’ll have a streamlined workflow for building and releasing your Golang projects with ease.</p><h4>Prerequisites</h4><p>Before we dive into the configuration, make sure you have the following:</p><ul><li>A Golang project with a Git repository hosted on GitLab</li><li>A basic understanding of GitLab CI/CD</li><li>GoReleaser is installed on your local machine</li></ul><h4>What is GoReleaser?</h4><p>GoReleaser is an open-source tool that automates the release process of Golang projects. It creates binary packages, archives, and release notes for your project, and publishes them to your desired release location, such as GitHub, GitLab, or S3.</p><h4>Configuring GoReleaser</h4><p>GoReleaser is configured using a YAML file named .goreleaser.yml. The configuration file defines how GoReleaser should build and release your project. Below is an example configuration file:</p><pre># .goreleaser.yml<br>project_name: goreleaser-example<br>builds:<br>  - env: [CGO_ENABLED=0]<br>    goos:<br>      - linux<br>      - windows<br>      - darwin<br>    goarch:<br>      - amd64<br>      - arm64<br>    go_version: 1.16.x<br>dockers:<br>  - image_templates: [&quot;registry.gitlab.com/samaddico/goreleaser-example:{{ .Version }}&quot;]<br>    dockerfile: Dockerfile<br>    build_flag_templates:<br>      - --label=org.opencontainers.image.title={{ .ProjectName }}<br>      - --label=org.opencontainers.image.description={{ .ProjectName }}<br>      - --label=org.opencontainers.image.url=https://gitlab.com/samaddico/goreleaser-example<br>      - --label=org.opencontainers.image.source=https://gitlab.com/samaddico/goreleaser-example<br>      - --label=org.opencontainers.image.version={{ .Version }}<br>      - --label=org.opencontainers.image.created={{ time &quot;2006-01-02T15:04:05Z07:00&quot; }}<br>      - --label=org.opencontainers.image.revision={{ .FullCommit }}<br>      - --label=org.opencontainers.image.licenses=MIT<br>nfpm:<br>  - maintainer: Sam A &lt;samaddico@gmail.com&gt;<br>    description: Goreleaser example usage.<br>    homepage: https://gitlab.com/samaddico/goreleaser-example<br>    license: MIT<br>    formats:<br>      - deb<br>      - rpm<br>      - apk</pre><p>This configuration file defines two builds, one for Linux and one for Windows and Darwin. Each build specifies the operating system and architecture to build for and any additional build options such as environment variables, binary names, and ldflags. GoReleaser will generate binary packages in the specified format (tar.gz and zip in this case) and create a release on Gitlab under the specified owner and project name. The release section defines the release targets for GoReleaser. In the example above, we&#39;re releasing to GitLab under the myorg organization and myproject repository. We also use a GitLab personal access token specified in the GITLAB_TOKEN environment variable.</p><p>The dockers section configures the Docker image release. It specifies the Docker image template (image_templates) that GoReleaser should release the image to. The template includes the registry, project name, and version. The dockerfile field specifies the path to the Dockerfile.</p><p>The build_flag_templates section contains additional build flags for the Docker image. Here, GoReleaser sets various labels using the GoReleaser template syntax ({{ .VariableName }}). These labels provide information about the image, such as title, description, URL, source, version, creation time, revision, and licenses.</p><h4>Integrating with GitLab CI/CD</h4><p>Now that we have configured GoReleaser, we can integrate it into our GitLab CI/CD pipeline. Below is an example .gitlab-ci.yml file:</p><pre># .gitlab-ci.yml<br>image: golang:1.16<br><br>stages:<br>  - build<br>  - release<br><br>variables:<br>  DOCKER_REGISTRY: $CI_REGISTRY<br>  DOCKER_USERNAME: $CI_REGISTRY_USER<br>  DOCKER_PASSWORD: $CI_REGISTRY_PASSWORD<br>  GIT_DEPTH: 0<br><br>build:<br>  stage: build<br>  script:<br>    - go build -o myproject ./cmd/myproject<br>  artifacts:<br>    paths:<br>      - myproject<br><br>release:<br>  stage: release<br>  image: docker:latest<br>  services:<br>    - docker:dind<br>  script: |<br>    docker run --rm --privileged \<br>      -v $PWD:/go/src/gitlab.com/goreleaser/example \<br>      -w /go/src/gitlab.com/goreleaser/example \<br>      -v /var/run/docker.sock:/var/run/docker.sock \<br>      -e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY  \<br>      -e GITLAB_TOKEN \<br>        goreleaser/goreleaser release --rm-dist  <br>  only:<br>    - tags</pre><p>This configuration file defines two stages, build and release. The build stage builds the project using the go build command and creates an artifact containing the binary.</p><p>In this blog post, we’ve shown you how to use GoReleaser and GitLab CI/CD to automate the build and release process of your Golang projects. By setting up a simple .gitlab-ci.yml file and configuring GoReleaser using a .goreleaser.yml file, you can save time and reduce the risk of errors in your release process. I hope this post has helped streamline your Golang build and release workflow.</p><p>If you found this blog post useful, please consider liking it and sharing it with your friends and colleagues. If you have any questions or feedback, please comment below. Thank you for reading!</p><h4><strong>References</strong></h4><ul><li><a href="https://gitlab.com/goreleaser/example/-/tree/master/">Files · master · goreleaser / example · GitLab</a></li><li><a href="https://goreleaser.com/ci/gitlab/">GoReleaser - GitLab CI</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80346e44afee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SpringBoot with Cassandra Example]]></title>
            <link>https://medium.com/@samaddico/springboot-with-cassandra-example-b42d5751ff34?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b42d5751ff34</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[cassandra]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Fri, 01 Dec 2023 09:55:25 GMT</pubDate>
            <atom:updated>2023-12-01T09:55:25.105Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>This blog post will guide you through a step-by-step example of how to build a springBoot that integrates with an Apache Cassandra database. Now, let&#39;s dive into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*wCflNJDBfgZXP2ciE3IUEw.png" /></figure><h4>Prerequisite</h4><p>This tutorial requires that you have the following setup.</p><ul><li>Your favorite IDE</li><li>Java</li><li>Maven</li><li>Apache Cassandra database.</li></ul><p>Firstly, we need to create a simple maven project and add some SpringBoot dependencies to our project as shown below. Alternatively, you can use the Spring Initializer to set up a new Spring Boot project. Include the necessary dependencies:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-data-cassandra&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br><br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;<br>    &lt;artifactId&gt;lombok&lt;/artifactId&gt;<br>    &lt;optional&gt;true&lt;/optional&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;</pre><p>Next, define a Cassandra entity class representing the data model. Then annotate the class with @Table and specify the table name. Also, annotate the id property with the@PrimaryKey to indicate that’s the primary key for the table.</p><pre>@Data<br>@Table(&quot;book&quot;)<br>public class Book {<br><br>    @PrimaryKey<br>    private UUID id;<br>    private String title;<br>    private String description;<br>    private String author;<br>    private int year;<br>    private LocalDateTime dateCreated;<br><br>}</pre><p>Next, we will set up the repository interface that will communicate with the database layer. This interface will extend theCassandraRepository generic class to perform CRUD operations.</p><pre>@Repository<br>public interface BookRepository extends CassandraRepository&lt;Book, UUID&gt; {<br>}</pre><p>Finally, we will build RESTful endpoints to expose some crud functionalities.</p><pre>@RestController<br>@RequestMapping(&quot;/book&quot;)<br>public class BookController {<br><br>    @Autowired<br>    private BookRepository bookRepository;<br><br>    @GetMapping<br>    public ResponseEntity&lt;List&lt;Book&gt;&gt; getBooks() {<br>        List&lt;Book&gt; bookList = bookRepository.findAll();<br>        return ResponseEntity.status(200).body(bookList);<br>    }<br><br>    @PostMapping<br>    public ResponseEntity&lt;Book&gt; createBook(@RequestBody CreateBookRequest bookRequest) {<br><br>        Book book = new Book();<br>        book.setId(UUID.randomUUID());<br>        book.setTitle(bookRequest.getTitle());<br>        book.setDescription(bookRequest.getDescription());<br>        book.setAuthor(bookRequest.getAuthor());<br>        book.setYear(bookRequest.getYear());<br>        book.setDateCreated(LocalDateTime.now());<br><br>        book = bookRepository.save(book);<br>        return ResponseEntity.status(201).body(book);<br>    }<br>}</pre><h3>Setting Up Apache Cassandra</h3><p>For the sake of this tutorial, we will create a small instance of the Apache Cassandra database using Docker. You can run the below command to spin up a local Cassandra server container.</p><pre>docker exec -it cassandra-server bash -c &quot;cqlsh -u cassandra -p cassandra&quot;</pre><p>Alternatively, you can use the free tier of <a href="https://dtsx.io/3i9C8t1">DataStax Astra DB</a> Cassandra-as-a-Service. In this case, you would have to add the following properties to the application.properties file.</p><pre># Credentials to Astra DB<br>astra.client-id=&lt;CLIENT_ID&gt;<br>astra.client-secret=&lt;CLIENT_SECRET&gt;<br>astra.application-token=&lt;APP_TOKEN&gt;<br><br># Select an Astra instance<br>astra.cloud-region=&lt;DB_REGION&gt;<br>astra.database-id=&lt;DB_ID&gt;<br>astra.keyspace=spring_cassandra</pre><blockquote>Note you’d have to add the astrax dependency in you pom.xml</blockquote><pre>&lt;dependency&gt;<br>   &lt;groupId&gt;com.datastax.astra&lt;/groupId&gt;<br>   &lt;artifactId&gt;astra-spring-boot-starter&lt;/artifactId&gt;<br>   &lt;version&gt;0.1.13&lt;/version&gt;<br>&lt;/dependency&gt;</pre><h3>Configuring Cassandra in Spring Boot</h3><p>In your Spring Boot project, create a application.properties file and configure the Cassandra connection properties like the below:</p><pre>spring.cassandra.schema-action=CREATE_IF_NOT_EXISTS<br>spring.cassandra.request.timeout=10s<br>spring.cassandra.connection.connect-timeout=10s<br>spring.cassandra.connection.init-query-timeout=10s<br><br><br>spring.cassandra.local-datacenter=datacenter_a<br>spring.cassandra.keyspace-name=book_schema</pre><h3>Testing</h3><p>Finally, you run your Spring Boot application and test the CRUD operations using tools like Postman or Curl.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VzJa_ksb2NWxXJ5WAqV6tQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1qfOLWnZz7JAV54ID9t-mw.png" /></figure><h3>Conclusion</h3><p>In this example, we’ve demonstrated the integration of Spring Boot with Cassandra to build a data-driven application. For production purposes, this can be extended with authentication, logging, and error handling to enhance scalability and the overall robustness of the application. Check <a href="https://github.com/samaddico/spring-boot-samples/tree/master/spring-boot-cassandra">here</a> for the code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b42d5751ff34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Dependency Control with Terraform’s HCL Lockfile]]></title>
            <link>https://medium.com/@samaddico/mastering-dependency-control-with-terraforms-hcl-lockfile-b5a75761e569?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5a75761e569</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Fri, 11 Aug 2023 15:27:43 GMT</pubDate>
            <atom:updated>2023-08-11T15:27:43.246Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>Terraform is one of the powerful tools that enable teams to provision and manage their infrastructure in a declarative and scalable manner. Central to the Terraform workflow is the HCL (HashiCorp Configuration Language) file — a script that defines the desired state of your infrastructure. In this post, we will explore the importance of the Terraform HCL lock file and why it should be versioned.</p><h4><strong>What is the Terraform lock file?</strong></h4><p>The Terraform lockfile as already mentioned is a file used by Terraform to track the desired state of your infrastructure. It’s almost equivalent to the package-lock.json file in the realm of npm as a package manager. Let&#39;s delve a bit deeper: Each Terraform project involves dependencies on code components that extend beyond its immediate codebase. These external dependencies hinge on Terraform Providers and Modules, which might reside outside of the project. Before Terraform 0.14, there was any way to manage the versions of these dependencies. But later (=&gt; 0.14) the Dependency Lock File was introduced for this purpose. This file .terraform.lock.hcl is generated by Terraform when you run the terraform init command. This file serves as a reference point across all executions, aiding in the evaluation of compatible dependencies with the current configuration. It is used to lock the versions of the provider plugins and modules being used in your Terraform configuration, ensuring that subsequent runs of terraform apply or terraform plan use the same versions. This, in turn, facilitates the meticulous selection of fitting dependency versions for seamless utilization.</p><h4>How does it work?</h4><p>Whenever the terraform init command is executed, and the Terraform Lock File is generated automatically if absent. In cases where the file already exists, the command will update it with the most current selections of dependency versions. During the initialization, Terraform installs all of the Terraform Providers needed for the project code. It considers both the specified version constraints and the version selection stored in the dependency lock file stored within the dependency lock file. In scenarios where the lock file doesn’t contain a version record for a provider, Terraform will opt for the most latest compatible version based on the defined constraints and subsequently update the lock file to reflect this chosen version.</p><p>Aside from the selected version which is persisted in the file, all of the version constraints that Terraform considered when making this selection are also stored including a number of other checksums that are all considered to be valid for packages implementing the selected version of this provider on different platforms.</p><h4>Versioning the Terraform lockfile</h4><p>It is generally a good practice to version control the .terraform.lock.hcl file especially in a CI/CD pipeline when deploying Terraform across multiple environments. As already mentioned, upon running terraform init the command, the lock file is updated with the selected version. Subsequently, when you re-run the terraform init command again, it will only go through the process of determining the compatible versions of dependencies for any new dependencies added to the project since the previous run. Uploading the Dependency Lock File (.terraform.lock.hcl) to version control will result in the enforcing installation with the specified dependency versions outlined in the file. This could potentially cause version incompatibility issues as new dependencies have been added. The way to get around this kind of situation is to force the selected dependency versions to be updated by using the -upgrade attribute flag as in the following commandterraform init -upgrade , or manually confirm all compatible versions and update the version in your provider.tf file. This ensures that anyone else who checks out your code will use the same versions of provider plugins and modules, providing a consistent and reproducible environment for managing your infrastructure with Terraform. It’s recommended not to manually edit this file as this could cause irreversible issues to your infrastructure.</p><p>Hope this mini-post helps.</p><h4>References</h4><ul><li><a href="https://stackoverflow.com/questions/67963719/should-terraform-lock-hcl-be-included-in-the-gitignore-file">Should .terraform.lock.hcl be included in the .gitignore file?</a></li><li><a href="https://build5nines.com/terraform-dependency-lock-file-terraform-lock-hcl/">Terraform: Dependency Lock File (.terraform.lock.hcl) | Build5Nines</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5a75761e569" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Metrics collection in Spring Boot Applications using Micrometer and Prometheus]]></title>
            <link>https://faun.pub/metrics-collection-in-spring-boot-applications-using-micrometer-and-prometheus-98096dda8062?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/98096dda8062</guid>
            <category><![CDATA[micrometer]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Thu, 11 May 2023 18:39:57 GMT</pubDate>
            <atom:updated>2023-06-25T17:08:45.873Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>Micrometer is a metrics collection and reporting library for Java. It provides a simple way to instrument your application and record metrics that can be used to monitor the performance and health of your system. In this blog post, we will learn how to use Micrometer in a Spring Boot application. We will also explain how to add Prometheus support to your Spring Boot application with the actuator, enabling you to expose metrics in Prometheus format and view them in a monitoring system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/0*TXhLfkcwrEgNTaBj.png" /></figure><h4>How to setup Micrometer</h4><p>To use Micrometer in your Java application, you will need to add the following dependency to your project’s build file:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.micrometer&lt;/groupId&gt;<br>    &lt;artifactId&gt;micrometer-core&lt;/artifactId&gt;<br>    &lt;version&gt;${micrometer.version}&lt;/version&gt;<br>&lt;/dependency&gt;</pre><h4>How to record metrics in Code</h4><p>Once the dependency is added, you can start using Micrometer to record metrics in your code. For example, the following code shows how to record a counter metric that counts the number of times a particular api endpoint is triggered:</p><pre>import io.micrometer.core.instrument.Counter;<br>import io.micrometer.core.instrument.MeterRegistry;<br><br>...<br>@Bean<br>public MeterRegistry meterRegistry(){<br>    return new CompositeMeterRegistry();<br>}<br>...<br><br>@Service<br>public class MicrometerService {<br><br>    @Autowired<br>    private MeterRegistry meterRegistry;<br><br>    public Counter getCounter() {<br>        return meterRegistry.counter(&quot;api_request_count&quot;);<br>    }<br>}<br><br>...<br>private final MicrometerService micrometerService;<br><br>    @Autowired<br>    public MicrometerController(MicrometerService micrometerService) {<br>        this.micrometerService = micrometerService;<br>    }<br><br>    @GetMapping(&quot;/api&quot;)<br>    public ResponseEntity someApi() {<br>        micrometerService.getCounter().increment();<br>        return  ResponseEntity.status(HttpStatus.OK).build();<br>    }<br>...<br></pre><p>In the above code, we are using the Counter class from Micrometer to create a counter metric with the name api_request_count. We then increment the counter every time the /api endpoint is fired.</p><p>Micrometer provides many other types of metrics that you can use, such as gauges, histograms, and timers. You can find the full list of available metrics in the <a href="https://micrometer.io/docs">Micrometer documentation</a>.</p><h4>Configuring Spring Boot Actuator</h4><p>Next, we need to enable the actuator endpoints so that Prometheus can scrape the metrics from our application. To do that, add the below config in the application.yml file.</p><pre># expose necessary actuator endpoints<br>management:<br>  endpoints:<br>    web:<br>      exposure:<br>        include: health,prometheus,metrics</pre><h4>Scrapping with Prometheus</h4><p>Once you have recorded some metrics in your code and have enabled actuator endpoints, you can configure Prometheus to scrape your application’s metrics. To do this, you will need to add the following dependency to your project’s build file:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.micrometer&lt;/groupId&gt;<br>    &lt;artifactId&gt;micrometer-registry-prometheus&lt;/artifactId&gt;<br>    &lt;version&gt;${micrometer.version}&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>This dependency adds support for the Prometheus format, which is a popular choice for exposing metrics over HTTP.</p><pre>global:<br>  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.<br>  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.<br>  # scrape_timeout is set to the global default (10s).<br><br>scrape_configs:<br>  - job_name: &#39;spring boot&#39;<br>    metrics_path: &#39;/actuator/prometheus&#39;<br>    scrape_interval: 5s<br>    static_configs:<br>      - targets: [&#39;localhost:8080&#39;] # Change this to your application&#39;s host and port</pre><p>This configuration tells Prometheus to scrape metrics from your application’s /actuator/prometheus endpoint.</p><p>Voila! All is set. Now let’s record some metrics and see them in Prometheus. If everything is setup correctly, then you should see a dashboard like below when you search for api_request_count in the graphs tabs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9pRDbIm7jpA2yZeuYlEDTg.png" /></figure><p>In this article, we discussed how to configure Micrometer for metrics collection in a Spring Boot application. Micrometer provides a simple, vendor-neutral API for collecting and publishing metrics to various monitoring systems. We also explained how to add Prometheus support to your Spring Boot application with Actuator, enabling you to expose metrics in Prometheus format and view them in a monitoring system.</p><p>With Micrometer and Prometheus, you can easily monitor and collect metrics from your Java applications and use the insights gained to make informed decisions to improve performance, optimize resource usage, and troubleshoot issues. Whether you are running a small application or a large-scale system, monitoring metrics is crucial for delivering high-quality software and ensuring that your applications are performing optimally.</p><p>Hope this helps. If it does, then hit the clap and share.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*4AiDCdc0vVExkk5f.png" /></figure><h4>👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇</h4><h4>🚀<a href="http://from.faun.to/r/8zxxd">Join FAUN Developer Community &amp; Get Similar Stories in your Inbox Each Week</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98096dda8062" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/metrics-collection-in-spring-boot-applications-using-micrometer-and-prometheus-98096dda8062">Metrics collection in Spring Boot Applications using Micrometer and Prometheus</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>
        <item>
            <title><![CDATA[How to use Botkube to monitor Kubernetes Cluster]]></title>
            <link>https://medium.com/swlh/how-to-use-botkube-to-monitor-kubernetes-cluster-bba41ca579a1?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/bba41ca579a1</guid>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[botkube]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Thu, 06 Apr 2023 09:54:49 GMT</pubDate>
            <atom:updated>2023-04-06T09:54:49.522Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>In this tutorial, we will learn how to use Botkube and Slack for deployment monitoring in Kubernetes. By the end of this tutorial, you will be able to receive notifications in Slack whenever a deployment or update occurs in your Kubernetes cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mCNtN7jtpProIuZXbT26DA.png" /></figure><h4>Prerequisites</h4><ul><li><a href="https://helm.sh/">Helm</a></li><li>Kubernetes cluster</li><li>Slack Account</li></ul><h4>What is Botkube?</h4><p>Botkube is an open-source chatbot that helps developers monitor and manage their Kubernetes clusters. It can be integrated with popular chat platforms like Slack, allowing you to receive notifications and perform actions directly from your chat window.</p><p>One way to use Botkube and Slack for deployment monitoring is to set up the bot to notify you when a deployment occurs in your cluster. This can be helpful for keeping track of changes to your system and ensuring that deployments are running smoothly.</p><h4>Create Slack App</h4><p>We first need to create a Slack bot and obtain the bot token.</p><ul><li>Navigate to the <a href="https://api.slack.com/apps">Slack App console</a> to create a Slack app.</li><li>Click <strong>Create New App</strong> and select <strong>From an app manifest</strong> in the popup to create an application from the manifest.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ljLwxjVQ7n3W6dLG6V7zFg.png" /></figure><ul><li>Next, select a workspace where you want to create the app and click <strong>Next</strong>.</li><li>Under the <strong>YAML</strong> tab, copy and paste the following manifests, click <strong>Next</strong>, and then <strong>Create</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSppQriUQEkRZbd8Hme1Ag.png" /></figure><pre>display_information:<br>  name: Botkube<br>  description: Botkube<br>  background_color: &quot;#a653a6&quot;<br>features:<br>  bot_user:<br>    display_name: Botkube<br>    always_online: false<br>oauth_config:<br>  scopes:<br>    bot:<br>      - channels:read<br>      - app_mentions:read<br>      - chat:write<br>      - files:write<br>settings:<br>  event_subscriptions:<br>    bot_events:<br>      - app_mention<br>  interactivity:<br>    is_enabled: true<br>  org_deploy_enabled: false<br>  socket_mode_enabled: true<br>  token_rotation_enabled: false</pre><ul><li>Assuming you’re not an administrator, send a request to install the app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*KCDsxWKaQA5V4W9fc_6nBQ.png" /></figure><ul><li>Once approval is granted and the app is created, you need to get the bot token which should be saved for later. Select <strong>OAuth &amp; Permissions</strong> section on the left sidebar. On this page, you can copy the bot token which starts with xoxb....</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*LaO0G9VJ_0GZYZ7KLPUXMg.png" /></figure><ul><li>Export Slack Bot Token as follows.</li></ul><pre>export SLACK_API_BOT_TOKEN=&quot;{botToken}&quot;</pre><ul><li>Generate and obtain App-Level Token. To establish a WebSocket connection, a Slack App that uses Socket Mode necessitates an App-Level Token. To create an App-Level Token, adhere to the instructions below:</li><li>Click on the <strong>Basic Information</strong> link on the left sidebar, and navigate to the <strong>App-Level Token</strong> section. Next, select the <strong>Generate Token</strong> <strong>and Scopes</strong> button.</li><li>Provide a name, choose the<strong> connections:write</strong> sc-ope, and then click on the <strong>Generate</strong> button.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*qPckclQOc1uPxsK7HaWyMQ.png" /></figure><h4>Install Botkube in your Kubernetes cluster</h4><p>To install Botkube, you will need to have Helm installed. You can follow this <a href="https://helm.sh/docs/intro/">guide</a> to install Helm</p><ul><li>Add Botkube chart repository:</li></ul><pre>helm repo add botkube https://charts.botkube.io<br>helm repo update</pre><ul><li>Create Environment Variable</li></ul><pre>export CLUSTER_NAME={cluster_name}<br>export ALLOW_KUBECTL={allow_kubectl}<br>export ALLOW_HELM={allow_helm}<br>export SLACK_CHANNEL_NAME={channel_name}</pre><ul><li>SLACK_CHANNEL_NAME is the channel the bot will be added.</li><li>SLACK_API_BOT_TOKEN is automatically generated when you installed the app in your workspace. You can use these to authenticate your app.</li><li>SLACK_API_APP_TOKEN allows the app to use platform features that apply to multiple (or all) installations. It can be generated from Slack after installing the app in your workspace. <strong><em>Basic Information &gt; App-Level Tokens</em></strong></li><li>CLUSTER_NAME is the cluster name.</li><li>ALLOW_KUBECTL determines whether or not to allow Botkube to run kubectl commands.</li><li>ALLOW_HELM determines whether or not to allow Botkube to run helm commands.</li></ul><p>And finally the installation 🚀</p><pre>helm install --version v0.18.0 botkube --namespace botkube --create-namespace \<br>--set communications.default-group.socketSlack.enabled=true \<br>--set communications.default-group.socketSlack.channels.default.name=${SLACK_CHANNEL_NAME} \<br>--set communications.default-group.socketSlack.appToken=${SLACK_API_APP_TOKEN} \<br>--set communications.default-group.socketSlack.botToken=${SLACK_API_BOT_TOKEN} \<br>--set settings.clusterName=${CLUSTER_NAME} \<br>--set executors.kubectl-read-only.kubectl.enabled=${ALLOW_KUBECTL} \<br>--set &#39;executors.helm.botkube/helm.enabled&#39;=${ALLOW_HELM} \<br>botkube/botkube</pre><p>Once you have completed these steps, your chatbot will be set up and ready to use. Whenever a deployment occurs in your cluster, you will receive a notification in Slack with details about the deployment.</p><p>Using Botkube and Slack for deployment monitoring is a convenient and efficient way to keep track of changes to your system. It can help you stay up-to-date with what’s happening in your cluster and quickly respond to any issues that may arise.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bba41ca579a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/how-to-use-botkube-to-monitor-kubernetes-cluster-bba41ca579a1">How to use Botkube to monitor Kubernetes Cluster</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot Cloud Centralised Config Server]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/codeops/spring-boot-cloud-centralised-config-server-bd47a85f9571?source=rss-4e6b1d0c0ea5------2"><img src="https://cdn-images-1.medium.com/max/2499/0*p0PgGLLpm0rCi1rP.png" width="2499"></a></p><p class="medium-feed-snippet">Introduction</p><p class="medium-feed-link"><a href="https://medium.com/codeops/spring-boot-cloud-centralised-config-server-bd47a85f9571?source=rss-4e6b1d0c0ea5------2">Continue reading on CodeOps »</a></p></div>]]></description>
            <link>https://medium.com/codeops/spring-boot-cloud-centralised-config-server-bd47a85f9571?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd47a85f9571</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[spring-cloud]]></category>
            <category><![CDATA[config]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Tue, 10 Jan 2023 10:50:15 GMT</pubDate>
            <atom:updated>2023-01-10T10:50:15.827Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Implement Feature Flags in SpringBoot Application]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://faun.pub/how-to-implement-feature-flags-in-springboot-application-96d61cbb53a4?source=rss-4e6b1d0c0ea5------2"><img src="https://cdn-images-1.medium.com/max/600/1*oGRCBbp1t-sizPViB79jyw.jpeg" width="600"></a></p><p class="medium-feed-snippet">Introduction</p><p class="medium-feed-link"><a href="https://faun.pub/how-to-implement-feature-flags-in-springboot-application-96d61cbb53a4?source=rss-4e6b1d0c0ea5------2">Continue reading on FAUN.dev()  »</a></p></div>]]></description>
            <link>https://faun.pub/how-to-implement-feature-flags-in-springboot-application-96d61cbb53a4?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/96d61cbb53a4</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[unleash]]></category>
            <category><![CDATA[feature-flags]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Wed, 28 Dec 2022 09:52:50 GMT</pubDate>
            <atom:updated>2023-10-04T12:25:13.820Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Kubernetes Readiness and Liveness Probe in Spring Boot Application]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/codeops/kubernetes-readiness-and-liveness-probe-in-spring-boot-application-6214274b0dfd?source=rss-4e6b1d0c0ea5------2"><img src="https://cdn-images-1.medium.com/max/1000/0*6QYFNm0RQ8Blo-Xr.png" width="1000"></a></p><p class="medium-feed-snippet">Introduction</p><p class="medium-feed-link"><a href="https://medium.com/codeops/kubernetes-readiness-and-liveness-probe-in-spring-boot-application-6214274b0dfd?source=rss-4e6b1d0c0ea5------2">Continue reading on CodeOps »</a></p></div>]]></description>
            <link>https://medium.com/codeops/kubernetes-readiness-and-liveness-probe-in-spring-boot-application-6214274b0dfd?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6214274b0dfd</guid>
            <category><![CDATA[readinessprobe]]></category>
            <category><![CDATA[livenessprobe]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Tue, 18 Oct 2022 17:34:21 GMT</pubDate>
            <atom:updated>2022-10-18T17:34:21.458Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Leveraging on Zenko CloudServer for hosting a local S3 Server]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">In this post, I&#x2019;m going to show you how to host your own s3 server locally on your machine or perhaps for development/test purposes.</p><p class="medium-feed-link"><a href="https://medium.com/codeops/leveraging-on-zenko-cloudserver-for-hosting-a-local-s3-server-6a02ee076af?source=rss-4e6b1d0c0ea5------2">Continue reading on CodeOps »</a></p></div>]]></description>
            <link>https://medium.com/codeops/leveraging-on-zenko-cloudserver-for-hosting-a-local-s3-server-6a02ee076af?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a02ee076af</guid>
            <category><![CDATA[s3-bucket]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Sun, 06 Mar 2022 20:55:19 GMT</pubDate>
            <atom:updated>2022-03-06T20:55:19.204Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Leveraging on Persistent Volumes for Storage in Kubernetes]]></title>
            <link>https://medium.com/swlh/leveraging-on-persistent-volumes-for-storage-in-kubernetes-8ba857e0ad9a?source=rss-4e6b1d0c0ea5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ba857e0ad9a</guid>
            <category><![CDATA[kubernetes-engine]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Samuel Addico]]></dc:creator>
            <pubDate>Tue, 23 Jun 2020 15:43:38 GMT</pubDate>
            <atom:updated>2020-06-24T18:26:05.202Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p><a href="https://kubernetes.io/">Kubernetes</a> is by far the most popular container orchestration tool for application service deployment and automation. However, due to the fact that pods are stateless(they don&#39;t keep track of any files or directories stored after deletion), permanent storage volumes were introduced. Today we will be looking at one of these.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*LwhkEwdmOdakP04SsgxFXw.png" /></figure><h3>What is a Persistent Volume?</h3><p>Persistent Volume is a storage volume provisioned by an administrator or dynamically provisioned by Kubernetes using a <a href="https://kubernetes.io/docs/concepts/storage/storage-classes">StorageClass</a>. They are created with a specific filesystem, size, and identifying characteristics such as volume IDs and names. An interesting thing about a PV is they are not dependent on the life cycle of a pod so they are perfect for use cases in which you need to retain data regardless of the unpredictable life process of Kubernetes pods. What this means for example is, you can host a database as a pod in Kubernetes and store its data on PVs (which are outside of a pod) without data loss when the pod is restarted, rescheduled or deleted. There are a ton of different Persistent Volumes, you can read more <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes">here</a>.</p><h3>What is a Persistent Volume Claim?</h3><p>Persist Volume Claim as the name sounds is basically a claim for Persistent Volume. In other words, a PVC is a request for storage resources that a deployment needs. This is achieved by binding the PVC to a Persistent Volume. The PVC then provides an abstraction layer to the underlying storage.</p><h3>Creating a Persistent Volume.</h3><p>We will be looking at how to create a Persistent Volume that will be used by a container. For the sake of this post, I will be using a Redis container. Create file <strong><em>create-pv.yaml</em></strong> and add below as content:</p><pre>---<br>apiVersion: v1<br>kind: PersistentVolume<br>metadata:<br>  name: pv-vol<br>spec:<br>  storageClassName: manual<br>  capacity:<br>    storage: 10Gi<br>  accessModes:<br>    - ReadWriteOnce<br>  hostPath:<br>    path: /mnt/data/redis</pre><p>Then run the script as below :</p><pre>kubectl apply -f create-pv.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r8xUFMkm-JOKrkEVcvYi3w.png" /></figure><p>As you can see from the above shot, the PV has been successfully created and is available for use.</p><blockquote>Note that you will have to create this directory /mnt/data/redis on a node in the cluster.</blockquote><h3>Creating a Persistent Volume Claim</h3><p>Next, we will need to create a Persistent Volume Claim, which will be used in the Redis deployment. This will request 5G of the 10G PV capacity. Also, note the StorageClass which enables Kubernetes to match the appropriate Persistent Volume. Create file <strong><em>create-pvc.yaml</em></strong> with below as content:</p><pre>---<br>apiVersion: v1<br>kind: PersistentVolumeClaim<br>metadata:<br>  name: redis-pv-claim<br>spec:<br>  storageClassName: manual<br>  accessModes:<br>    - ReadWriteOnce<br>  resources:<br>    requests:<br>      storage: 5Gi</pre><p>Then run the script as below :</p><pre>kubectl apply -f create-pvc.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xVKaHwxuSlhUT4Bja5lKWw.png" /></figure><p>Voila !, as you can observe the status of the previously created Persistent Volume is now Bound, meaning its in use.</p><h3>Using the Persistent Volume Claim</h3><p>Now we will be creating a Pod that will make use of the PVC we have created. Note in the script there is no mention of Persistent Volume. Rather the Persistent Volume Claim is referenced. This will inform which Persistent Volume to use based on the specified StorageClass. Create a file <strong><em>create-redis-deployment.yaml </em></strong>with below content:</p><pre>apiVersion: v1<br>kind: Deployment<br>metadata:<br>  name: redis<br>spec:<br>  selector:<br>    matchLabels:<br>      app: redis<br>  template:<br>    metadata:<br>      labels:<br>        app: redis<br>    spec:<br>      containers:<br>        - name: redis<br>          image: redis:buster<br>          resources:<br>            limits:<br>              memory: &#39;512Mi&#39;<br>              cpu: &#39;1000m&#39;<br>          ports:<br>            - containerPort: 6379<br>          volumeMounts:<br>            - mountPath: /var/lib/redis/<br>              name: redis-volume<br>      volumes:<br>        - name: redis-volume<br>          persistentVolumeClaim:<br>            claimName: redis-pv-claim</pre><pre>kubectl create -f create-redis-deployment.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGzRWyQulOXQhEcSruEYyw.png" /></figure><blockquote>It turns out that when running on Cloud (GKE, EKS, AKS) there is no need to explicitly create a persistent volume. For that you will have to remove the storageClass name and also delete the persistent volume. Also note that using hostPath is “for testing purposes only” on a single node cluster <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes">per the doc</a>.</blockquote><p>In this post, I have explained what a Persistent Volume is, I have also explained the same for a Persistent Volume Claim and their use in creating a deployment in Kubernetes. Thank for reading and feel free to hit me up for any additions or subtractions :-)</p><h4>References:</h4><ul><li><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-persistentvolume">Configure a Pod to Use a PersistentVolume for Storage</a></li><li><a href="https://portworx.com/tutorial-kubernetes-persistent-volumes/">What is Kubernetes Persistent Volumes? | Portworx</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ba857e0ad9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/leveraging-on-persistent-volumes-for-storage-in-kubernetes-8ba857e0ad9a">Leveraging on Persistent Volumes for Storage in Kubernetes</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>