The best kind of documentation is automation. Check out the Ansible Playbooks that build my server(s) and the Nomad Jobs that deploy applications.
Go to file
2024-02-26 20:19:56 -08:00
host_config Add Host Config Files and Update Utility Playbooks 2024-02-06 12:38:01 -08:00
host_init Removed Failed Comment Prompt 2024-02-06 17:15:17 -08:00
nomad_jobs Change Domain Configuration To Better Support Host Domain Declaration 2024-02-26 20:19:56 -08:00
utils Add Host Config Files and Update Utility Playbooks 2024-02-06 12:38:01 -08:00
.gitignore Ammend rule to ignore .DS_Store files 2024-02-06 12:57:14 -08:00
README.md Fix Hyperlinks in Markdown Documenation 2024-02-06 18:10:40 -08:00

Welcome to my Lab 👻

What is this?

This is a repo that contains all the code and documentation for my homelab/server(s)

My servers run Alpine Linux, chosen for it's small and lightweight footprint leaving more resources for my applications. ZFS acts as the storage layer for my applications and data and provides various protections against data loss. (Backups are still important! Don't store anything in one spot unless you're willing to lose it.) New hosts can be configured with Ansible and joined at the application layer.

Docker is used to containerize applications and they are deployed using Nomad. This repo has those job specs for you to build off of or utilize yourself. Consul is used for service discovery and service mesh. I use Traefik as a reverse proxy to register and route traffic to the applications through tags in the nomad specs to expose the consul services to the outside world.

Getting Started Yourself

Host Init

The host_init directory contains the ansible playbooks to configure a new host as well as a readme to guide you through how. You will need to make sure you have installed Ansible if you want to use the playbooks.

On MacOS, you can install Ansible with Homebrew:

brew install ansible

Once all the playbooks complete, you should be able to access the following web interfaces:

Service URL
Consul http://<host>:8500
Nomad http://<host>:4646
Traefik http://<host>:8080

host_config

This directory contains the configuration files for the nodes in your compute cluster. These files are copied to the host during the host init process. You can learn more about bootstrapping a host in the host_init readme.

These configs should be good starting points for you to build off of but you may need to make some changes to meet your requirements. (such as security policies, storage, etc.)

You should definitely verify the following fields are what you want:

  • node_name in consul.hcl
  • bind_addr in consul.hcl
  • client_addr in consul.hcl
  • host_volumes in nomad.hcl

utils

Rather than update the configuration files on the remote host, you can write your changes to the files directly and use the utils directory to copy them to the remote host and restart the services with the new configuration. This is useful for making changes to the configuration files without having to run the host init process again or connecting to the host to make the changes manually.

To run the utils, you will need to have Ansible installed. When you have ansible installed you can run the utils with the following generic command:

ansible-playbook -i root@<ipaddress>, ./utils/update<service>Config.yml

Be aware, that if you have an error it could cause the service to fail to start and you may need to connect to the host to look at the log files and fix the issue.

Nomad Jobs

This is where the nomad job specs are stored. You can learn more about the job specs in the nomad_jobs readme.