Skip to content

Development Environment

Getting Started

Clone the repository and checkout the development branch

git clone https://github.com/mbund/homelab
git checkout dev

Dependencies

A development shell is available using nix with all dependencies installed. Use by running nix develop to enter the shell.

direnv

For a more comfortable developer experience, many nix users use direnv to integrate with their shell. After you have direnv installed, create a .envrc file in the root of the git repository with the following contents:

.envrc
export KUBECONFIG=/full/path/to/mbund/homelab/dev/kubeconfig-dev.yaml
use flake

Note that by convention the .envrc file should not be checked into git.

Develop

Bootstrap

Run the task dev to fully bootstrap the development environment.

task dev

After waiting ~15 minutes you should be able to reach the hosted services at https://*.127-0-0-1.nip.io, for example at https://home.127-0-0-1.nip.io.

Caveats

  • SSL certs are invalid because there is no domain name
  • Does not help in testing external networking (e.g. Cloudflare)
  • No persistent storage

Git

Run the task dev:git-configuration to add the local gitea instance in the sandbox environment in the cluster as a remote in git. When you push to it, the local ArgoCD will detect the change and apply the configuration changes.

task dev:git-configuration

Now when you need to commit, push to the sandbox remote.

git add -A
git commit -m "changes"
git push sandbox

Explore

Get access to secrets by using some task scripts:

task scripts:argocd-admin-password
task scripts:vault-root-token

Newlines

Some terminals might show a newline character in the password like nZ6hzMpShZvf5AVS⏎, but simply ignore it when using the password.

Clean up

Run the task dev:cleanup to clean up (delete the local test Kubernetes cluster)

task dev:cleanup