Add blocky dns
This commit is contained in:
parent
449a5061bc
commit
6110e78edf
74
nomad/blocky/blocky.nomad
Normal file
74
nomad/blocky/blocky.nomad
Normal file
@ -0,0 +1,74 @@
|
||||
variable "config_data" {
|
||||
type = string
|
||||
description = "Plain text config file for blocky"
|
||||
}
|
||||
|
||||
variable "base_hostname" {
|
||||
type = string
|
||||
description = "Base hostname to serve content from"
|
||||
default = "dev.homelab"
|
||||
}
|
||||
|
||||
job "blocky" {
|
||||
datacenters = ["dc1"]
|
||||
type = "service"
|
||||
|
||||
group "blocky" {
|
||||
count = 1
|
||||
|
||||
network {
|
||||
mode = "bridge"
|
||||
|
||||
port "dns" {
|
||||
static = "53"
|
||||
}
|
||||
|
||||
port "web" {
|
||||
to = "4000"
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
name = "dns"
|
||||
port = "dns"
|
||||
}
|
||||
|
||||
service {
|
||||
name = "web"
|
||||
port = "web"
|
||||
|
||||
tags = [
|
||||
"traefik.enable=true",
|
||||
"traefik.consulcatalog.connect=false",
|
||||
"traefik.http.routers.blocky.entrypoints=web,websecure",
|
||||
"traefik.http.routers.blocky.rule=Host(`blocky.${var.base_hostname}`)",
|
||||
"traefik.http.routers.blocky.tls=true",
|
||||
]
|
||||
}
|
||||
|
||||
task "main" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "ghcr.io/0xerr0r/blocky"
|
||||
ports = ["dns", "web"]
|
||||
|
||||
mount {
|
||||
type = "bind"
|
||||
target = "/app/config.yml"
|
||||
source = "app/config.yml"
|
||||
}
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 50
|
||||
memory = 100
|
||||
}
|
||||
|
||||
template {
|
||||
data = var.config_data
|
||||
destination = "app/config.yml"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
nomad/blocky/blocky.tf
Normal file
21
nomad/blocky/blocky.tf
Normal file
@ -0,0 +1,21 @@
|
||||
variable "base_hostname" {
|
||||
type = string
|
||||
description = "Base hostname to serve content from"
|
||||
default = "dev.homelab"
|
||||
}
|
||||
|
||||
locals {
|
||||
config_data = file("${path.module}/config.yml")
|
||||
}
|
||||
|
||||
resource "nomad_job" "blocky" {
|
||||
hcl2 {
|
||||
enabled = true
|
||||
vars = {
|
||||
"config_data" = "${local.config_data}",
|
||||
"base_hostname" = "${var.base_hostname}",
|
||||
}
|
||||
}
|
||||
|
||||
jobspec = file("${path.module}/blocky.nomad")
|
||||
}
|
21
nomad/blocky/config.yml
Normal file
21
nomad/blocky/config.yml
Normal file
@ -0,0 +1,21 @@
|
||||
upstream:
|
||||
default:
|
||||
- 1.1.1.1
|
||||
- 1.0.0.1
|
||||
blocking:
|
||||
blackLists:
|
||||
ads:
|
||||
- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
|
||||
clientGroupsBlock:
|
||||
default:
|
||||
- ads
|
||||
|
||||
customDNS:
|
||||
customTTL: 1h
|
||||
mapping:
|
||||
# TODO: Use a variable for this
|
||||
dev.homelab: 192.168.2.41
|
||||
|
||||
port: 53
|
||||
httpPort: 4000
|
||||
|
@ -38,6 +38,12 @@ module "mysql-server" {
|
||||
base_hostname = var.base_hostname
|
||||
}
|
||||
|
||||
module "blocky" {
|
||||
source = "./blocky"
|
||||
|
||||
base_hostname = var.base_hostname
|
||||
}
|
||||
|
||||
module "traefik" {
|
||||
source = "./traefik"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user