Karan Sharma

Ramblings on tech, cycling, and finance

Self Hosting using Nomad


theme: dracula paginate: true marp: true size: 4K

footer: Repo: github.com/mr-karan/hydra


Self Hosting with Nomad

My experiences of running and managing self hosted applications using Nomad.

Karan Sharma mrkaran.dev


whoami

👨‍💻 Works at Zerodha

📓 Blogs about things I find interesting

📈 Interested in Self Hosting


Why (I) Self Host


Why (I) Self Host


Why (I) Self Host


bg 45%


Why (I) Self Host


Why (I) Self Host


My Setup

Servers


Infra Tools


Ansible


Terraform


Nomad


Why Nomad


Nomad Agent


Running Nomad


Jobspec


Deploying Gitea

job "gitea" {
  datacenters = ["hydra"]
  type        = "service"
  group "app" {
    count = 1
    network {
      port "http" {
        to = 3000
      }
      port "ssh" {
        to           = 22
        static       = 4222
        host_network = "tailscale"
      }
    }

Deploying Gitea

    task "web" {
      driver = "docker"
      config {
        image = "gitea/gitea:latest"
        ports = ["http", "ssh"]
        mount {
          type   = "bind"
          source = "local/gitea.ini"
          target = "/data/gitea/conf/app.ini"
        }
      }
      resources {
        cpu    = 200
        memory = 300
      }
    }

Deploying Gitea

      service {
        provider = "nomad"
        name     = "gitea-web"
        tags     = ["gitea", "web"]
        port     = "http"
      }
      service {
        provider = "nomad"
        name     = "gitea-ssh"
        tags     = ["gitea", "ssh"]
        port     = "ssh"
      }

Exploring the UI


bg 90%


bg 90%


bg 90%


bg 90%


Networking


Networking


bg 85%


Networking

Dont expose to the world

doggo adguard.mrkaran.dev     
NAME                	TYPE	CLASS	TTL	ADDRESS       	NAMESERVER   
adguard.mrkaran.dev.	A   	IN   	23s	100.111.91.100	127.0.0.1:53

unless required

doggo doggo.mrkaran.dev
NAME              	TYPE	CLASS	TTL	ADDRESS       	NAMESERVER   
doggo.mrkaran.dev.	A   	IN   	25s	172.67.187.239	127.0.0.1:53	
doggo.mrkaran.dev.	A   	IN   	25s	104.21.7.168  	127.0.0.1:53	

Storage


Backups


Extensibility


Services I run


Monitoring


bg 90%


bg 90%


Security


Takeaways


Resources


Thank You