# Ultimate Go: Software Design with Kubernetes

- URL: https://www.ardanlabs.com/self-paced-courses/ultimate_service/

### Course Introduction

---

From the beginning of the course, you will pair-program with your instructor Bill Kennedy as he walks you through the design philosophies, architectural decisions, and best practices as they apply to engineering a production-ready Go service.

With each new feature that is added to the service, you will learn how to deploy and manage the Kubernetes environment used to run the service. Throughout the class, the code being worked on is pushed to a repository for personal access and review.

This course is part of the Ultimate Go Track. Not sold separately.

<b>Note:</b> All of our bundles are for a one-year subscription.

At the end of the subscription period, your membership does <b>not automatically renew</b>.

**Requirements:**

You need to know how to program and core concepts of working with computers (such as files, HTTP, memory management…)

- Studied CS in school or has a minimum of two years of experience programming full time professionally.
- Familiar with structural and object-oriented programming styles.
- Has worked with arrays, lists, queues and stacks.
- Understands processes, threads and synchronization at a high level.

**Operating Systems:**

- Has worked with a command shell.
- Knows how to maneuver around the file system.
- Understands what environment variables are.

You should have the following installed on your computer prior to the workshop:

- Go SDK from <a href="https://go.dev/tour/welcome/1">golang.org/dl/</a>
- An IDE, either VSCode with Go extension or GoLand
- Git

### Course Outline

---
<div class="grid grid-cols-1 md:grid-cols-2 gap-1">
<div class="flex flex-col gap-2">
<details>
  <summary>Introduction:</summary>

  <p class="desc">Introduction to the class and all the engineering that you will learn.</p>

  * 1.1: Design Philosophy, Guidelines, What to Expect
  * 1.2: Tooling and Images to Install
</details>

<details>
  <summary>Deploy First Mentality:</summary>

  <p class="desc">We begin to build the service with a focus on the ability to deploy the service in Kubernetes.</p>

* 2.1: Project Layers, Policies, and Guidelines
* 2.2: Prepare Project
* 2.3: Build Service with Logging
</details>

<details>
  <summary>Kubernetes:</summary>

  <p class="desc">We introduce Kubernetes and get a K8s environment up and running. At this point, everything we do runs in the K8s environment.</p>

* 3.1: Clusters, Nodes and Pods
* 3.2: Start the Kubernetes Cluster
* 3.3: Create/Build Dockerfile for the Service
* 3.4: Create/Apply K8s Deployment for the Service
</details>

<details>
  <summary>Kubernetes Quotas:</summary>

  <p class="desc">We introduce applying Quotas to the deployment and discuss the problems that can result.</p>

* 4.1: Understanding the Go Scheduler
* 4.2: Understanding CPU Quotas
* 4.3: Adding Quotas and Adjusting GOMAXPROCS
</details>

<details>
  <summary>Finish Initial Service Startup/Shutdown:</summary>

  <p class="desc">We finish the initial startup and shutdown of the service.</p>

* 5.1: Configuration
* 5.2: Debugging / Metrics
* 5.3: Shutdown Signaling and Load Shedding
</details>

<details>
  <summary>Web Framework:</summary>

  <p class="desc">We build out our own router by extending an existing one. This gives us a framework for injecting business logic into the processing of requests. It also allows for more consistency in the handling of requests.</p>

* 6.1: Basic Structure of an HTTP Router
* 6.2: Liveness and Readiness Handlers
* 6.3: Customize the Router
* 6.4: Middleware Support
* 6.5: Sending Responses
</details>

<details>
  <summary>Middleware:</summary>

  <p class="desc">We add middleware functions for business-level logic that needs to be injected into the processing of requests.</p>

* 7.1: Logging
* 7.2: Error Handling
  * Understanding What Error Handling Means
  * Declaring Custom Error Types
  * Consistent Handling and Response
* 7.3: Panic Handling
* 7.4: Metrics
</details>

<details>
  <summary>JSON Web Tokens (JWT):</summary>

  <p class="desc">We gain an understanding of how JWT's work and their shortcomings. We also learn about OPA and how we will use it to perform the actual authentication and authorization.</p>

* 8.1: Understanding JWT
* 8.2: Private/Public Key Generation
* 8.3: Token Generation
* 8.4: Token Signature Validation with OPA
</details>

<details>
  <summary>Key Store:</summary>

  <p class="desc">We create a simple key store for the project to store and retrieve the private key.</p>

* 9.1: Key Store Package
</details>

</div>
<div class="flex flex-col gap-2">

<details>
  <summary>Authentication / Authorization:</summary>

  <p class="desc">We integrate authentication and authorization support into the project by developing a package to generate and validate tokens. Then we integrate the packages into the application and test that things are working.</p>

* 10.1: Auth Package
* 10.2: Auth Unit Test
* 10.3: Add Middleware
* 10.4: Auth Service
* 10.5: Auth Client
</details>

<details>
  <summary>Domain Driven, Data-Oriented Architecture:</summary>

  <p class="desc">We talk about the data-driven data oriented architecture that is implemented in the project. We discuss the design philosophy, guidelines, and semantics of how the three layers of App, Business, and Storage work together.</p>

* 11.1: Architecture Review
* 11.2: Data Flow Trust vs Non-Trust
</details>

<details>
  <summary>Database Support:</summary>

  <p class="desc">We add a Postgres database to our K8s environment. Then we write a small database package that provides more effective support for using the SQLx package. Finally, integrate the database package on application startup.</p>

* 12.1: Kubernetes Support for Postgres
* 12.2: Create Database Package
* 12.3: Update Readiness Handler to Perform DB Checks
</details>

<details>
  <summary>Database Migrations and Seeding:</summary>

  <p class="desc">We define our schema and provide support for migration schema changes over time. We also provide support for seeding the database. Finally, we added support in Kubernetes to run the migration and seeding on POD startup.</p>

* 13.1: Maintaining Database Schemas and Seeds
* 13.2: Admin Tooling and Init Containers to Automate Migrations
</details>

<details>
  <summary>API, App, Business, and Storage Implementation:</summary>

  <p class="desc">We implement the Create domain inside the App, Business, and Storage layers.</p>

* 14.1: User Business Domain Support
* 14.2: User Storage Domain Support
* 14.3: User App Domain Support
* 14.4: User API Domain Support
</details>

<details>
  <summary>Testing:</summary>

  <p class="desc">We add docker and unit testing support for writing tests against a real database and write the actual user package tests.</p>

* 15.1: Starting and Stopping Containers
* 15.2: Database Testing Support
* 15.3: Unit and API Testing Support
* 15.4: Write User Business Test
* 15.5: Write User API Tests
</details>

<details>
  <summary>Delegate and Transactions:</summary>

  <p class="desc">We talk about how the delegate and transaction systems work.</p>

* 16.1: Delegate System
* 16.2: Transaction System
</details>

<details>
  <summary>Observability:</summary>

  <p class="desc">We add tracing to the project by integrating Open Telemetry and Zipkin.</p>

* 17.1: Integrate OTEL into the Project
</details>

<details>
  <summary>Review Service Project:</summary>

  <p class="desc">Review service project and get it running.</p>

* 18.1: Check For Dependency Upgrades, Rebuild, Run
</details>
</div>
</div>
