Skip to content

aakash-rajur/homelab

Repository files navigation

HomeLab

Personal homelab setup

Prerequisites

  • Docker
  • Docker Compose
  • SSH
  • Ansible on the host machine
  • Direnv (optional, issue source .envrc otherwise)
  • Cloudflare account
  • Domain name

Environment Variables

Variable Name Description
HOMELAB_IP IP address of the homelab
HOMELAB_PORT Port for SSH access
HOMELAB_USER SSH user for the homelab
HOMELAB_PASSWORD SSH password for the homelab
HOMELAB_BECOME_USER User to become for elevated privileges
HOMELAB_BECOME_PASSWORD Password for the become user
PROJECT_DIR Directory of the project on host machine
PG_ADDITIONAL_USERS Additional users for the PostgreSQL database
CLOUDFLARE_ACCOUNT_ID Cloudflare account ID
CLOUDFLARE_ACCOUNT_EMAIL_ADDRESS Cloudflare account email address
CLOUDFLARE_API_TOKEN Cloudflare DNS API token
CLOUDFLARE_TUNNEL_ID Cloudflare tunnel ID
CLOUDFLARE_TUNNEL_TOKEN Cloudflare tunnel token
LETSENCRYPT_CA_SERVER Let's Encrypt CA server URL (default is production)
LETSENCRYPT_EMAIL_ADDRESS Email address for Let's Encrypt
ROOT_DOMAIN Root domain for the services
GRAFANA_USER Grafana user
GRAFANA_PASSWORD Grafana password
GOOGLE_OAUTH_CLIENT_ID Google OAuth client ID
GOOGLE_OAUTH_CLIENT_SECRET Google OAuth client secret
TRANSMISSION_DOWNLOAD_DIR Transmission download directory
SONARR_MEDIA_DIR Sonarr save directory
RADARR_MEDIA_DIR Radarr save directory
READARR_MEDIA_DIR Readarr save directory
JELLYFIN_DATA_DIR Jellyfin data directory
JELLYFIN_CACHE_DIR Jellyfin cache directory
JELLYFIN_MEDIA_DIR Jellyfin media directory

Usage

  1. Setup nameservers for the domain:

    • Add Cloudflare nameservers to the domain registrar.
    • Add the domain to Cloudflare.
  2. Setup Cloudflare Tunnel:

    • Create a tunnel for the domain.
    • Copy the tunnel ID and token.
  3. Clone the repository:

    git clone [email protected]:aakash-rajur/homelab.git
    cd homelab
  4. you can skip certain services by commenting them out in compose.yml

  5. Setup users configuration in services/authelia/users.yml with content following, passwords will be generated for each user in credentials folder:

    users:
      johndoe:
        disabled: false
        displayname: "John Doe"
        password: ""
        email: "[email protected]"
        groups:
          - admin
          - guest
      janedoe:
        disabled: false
        displayname: "Jane Doe"
        password: ""
        email: "[email protected]"
        groups:
          - guest
  6. Set up environment variables:

    • Create a .envrc.local file in the project root and populate it with the necessary values. Refer to the .envrc file for the required variables.
    • Load the environment variables using direnv allow or source .envrc.local.
  7. Tweak docker service for cadvisor from here, if you wish to avoid a non-root setup, update cgroup service in compose.yml to run in priviled: true mode

  8. Start services:

     make deploy
  9. Stop services:

    make teardown

Services

Service Name Description Access URL
watchtower Monitors and updates running Docker containers.
nodeexporter Exports hardware and OS metrics.
cadvisor Analyzes resource usage and performance characteristics of running containers.
prometheus Monitoring and alerting toolkit. https://prometheus.<root_domain>
grafana Analytics and monitoring platform. https://grafana.<root_domain>
pg PostgreSQL database.
authelia Authentication and authorization server. https://authelia.<root_domain>
traefik Reverse proxy and load balancer. https://traefik.<root_domain>
transmission Torrent download client. https://transmission.<root_domain>
prowlarr Torrent indexer. https://prowlarr.<root_domain>
radarr Movie download manager. https://radarr.<root_domain>
sonarr TV show download manager. https://sonarr.<root_domain>
readarr E-book download manager. https://readarr.<root_domain>
bazarr Subtitle download manager. https://bazarr.<root_domain>
jellyseerr Request manager for content in Jellyfin. https://jellyseerr.<root_domain>
jellyfin Media server. https://jellyfin.<root_domain>

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

personal homelab setup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published