Skip to content

homelabsz/homelabsz

Repository files navigation

gif-header

Homelabsz

Semantic Release Commitizen friendly Built with Devbox

gif-about

Setup homelab project with Terraform + Kubernetes + Gitops

Getting Started   |    Tools and Patterns   |    Layers   |    Ideas   |    References   |    Versioning   |    Troubleshooting

Getting Started

To start developing this project, you need to set up your system properly. Therefore, follow these steps:

Devbox

Devbox is a command-line tool that lets you easily create isolated shells for development. You start by defining the list of packages required for your project, and Devbox creates an isolated, reproducible environment with those packages installed.

🚨 Warning

Use this option if you don't want to install the tools at system level.

Follow these steps to configure your environment:

curl -fsSL https://get.jetpack.io/devbox | bash
  • Execute the following command to generate the temporary environment:
devbox shell

If you need more details about this configuration, check the devbox.json file. This setting is a global setting that we use. If you want to customize it, feel free.

Direnv

Direnv is a powerful tool for managing environment variables and securely handling sensitive information such as API keys or credentials within a .env file.

🚨 Warning

In the .envrc file we configure it to load data from a .env file. Therefore, when you define your .env, direnv will load the variables from .env into your shell.

Follow these steps to configure your environment:

  • Go to the direnv documentation and follow the instructions to install it.
  • After installation, create an .env file in the root of your project.
  • By default, direnv blocks itself from loading the contents of the .envrc file into your session as a security precaution when you are creating .envrc for the first time or whenever you modify the contents of the .envrc file. Run the following command to solve it.
direnv allow

By following these steps, you can utilize direnv to manage sensitive information securely and ensure that your environment variables are loaded safely whenever you work on your project.

Task

The task tool provides a convenient way to define and manage project-specific tasks, making it easier to automate common scripts and simplifying development workflows.

🚨 Warning

We will use task instead of make for this project.

Follow these steps to configure your environment:

  • Make sure you have installed the task command following the devbox configuration steps.
  • Run the task command from the root directory of the project to see all the available commands.

If you need more details about each task defined, check the [Taskfile.yaml] file.

(back to top)

Tools and Patterns

Here is what we use in this project:

Tools
Patterns

(back to top)

Layers

In this section, we discuss the structure and organization of our project into different layers, each representing a specific aspect. By dividing the system into layers, we can isolate responsibilities, facilitate maintenance, and encourage code reuse. Each layer is described in detail in the following subsections.

1 - Terraform Layer

One of the premises of this project is to build everything with IaC. So we will be working with Terraform, an Infrastructure as Code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share.

2 - Account Layer

3 - Network Layer

4 - DNS Layer

5 - EKS Layer

Cluster Components

  • ingress-nginx: Provides ingress cluster services.
  • external-dns: Creates DNS entries in Cloud Provider's DNS service.
  • cert-manager: Configured to create TLS certs for all ingress services automatically using LetsEncrypt.

6 - Rancher Layer

7 - GitOps Layer

8 - CI/CD Layer

9 - Security Layer

(back to top)

Ideas

Ideas to consider for this project:

Click here
  • [] Terraform to configure the network in Scaleway
  • [] Terraform to configure the DNS zone, DNS records, firewall rules and more in Cloudflare
  • [] Terraform to create a Scaleway Kubernetes kapsule
  • [] Terraform to configure IAM rules to integrate external secrets and secrets manager into Scaleway
  • [] Terraform to create SSH keys used to access Scaleway instances
  • [] Terraform to create a Scaleway Rancher instance
  • [] Terraform to create Rancher clusters, Rancher projects and Rancher namespaces
  • [] Terraform to configure SSH keys for the GitOps process on GitHub and GitLab
  • [] Terraform to create a GitLab group structure + approval policies
  • [] Terraform to integrate Rancher + GitHub Oauth

(back to top)

References

If you have any reference links that you think are relevant to this documentation, please post them here:

Click here

(back to top)

Versioning

To check the change history, please access the CHANGELOG.md file.

(back to top)

Troubleshooting

If you have any problems, open an issue in this project.

(back to top)

Show your support

Give me a ⭐️ if this project helped you!


gif-footer

Made with 💜 by me 👋 inspired on readme-md-generator


Copyright © 2024 Homelabsz

(back to top)