Browse Source

feat: Add more monitoring stuff

pull/3/head
Karan Sharma 1 year ago
parent
commit
06657410fd
No known key found for this signature in database GPG Key ID: 64822F00FCCDCA4
  1. 12
      floyd/terraform/digitalocean-infra/firewalls.tf
  2. 2
      floyd/terraform/firefly/container.tf
  3. 32
      floyd/terraform/main.tf
  4. 5
      floyd/terraform/monitoring/conf/prometheus.yml
  5. 8
      floyd/terraform/providers.tf
  6. 26
      floyd/terraform/ripe-atlas/container.tf
  7. 8
      floyd/terraform/ripe-atlas/image.tf
  8. 5
      floyd/terraform/ripe-atlas/network.tf
  9. 3
      floyd/terraform/ripe-atlas/variables.tf
  10. 8
      floyd/terraform/ripe-atlas/versions.tf
  11. 5
      floyd/terraform/variables.tf

12
floyd/terraform/digitalocean-infra/firewalls.tf

@ -13,6 +13,18 @@ resource "digitalocean_firewall" "web" {
port_range = "443"
source_addresses = ["100.64.0.0/10"]
}
}
resource "digitalocean_firewall" "icmp" {
name = "allow-icmp-all"
droplet_ids = [digitalocean_droplet.floyd.id]
inbound_rule {
protocol = "icmp"
source_addresses = ["0.0.0.0/0", "::/0"]
}
}
resource "digitalocean_firewall" "vpn" {

2
floyd/terraform/firefly/container.tf

@ -31,6 +31,8 @@ resource "docker_container" "firefly" {
"DB_DATABASE=firefly",
"TZ=Asia/Kolkata",
"APP_URL=https://firefly.mrkaran.dev",
"APP_LOG_LEVEL=debug",
"MAIL_MAILER=log",
"TRUSTED_PROXIES=**",
"APP_KEY=${var.firefly_app_key}",
]

32
floyd/terraform/main.tf

@ -1,37 +1,58 @@
module "hydra-infra" {
source = "./digitalocean-infra"
providers = {
docker = docker.floyd
}
}
module "pihole" {
source = "./pihole"
ips = var.ips
providers = {
docker = docker.floyd
}
}
module "unbound" {
source = "./unbound"
ips = var.ips
providers = {
docker = docker.floyd
}
}
module "gitea" {
source = "./gitea"
ips = var.ips
providers = {
docker = docker.floyd
}
}
module "bookstack" {
source = "./bookstack"
ips = var.ips
bookstack_mariadb_password = var.bookstack_mariadb_password
providers = {
docker = docker.floyd
}
}
module "caddy" {
source = "./caddy"
ips = var.ips
cloudflare_api_token = var.cloudflare_api_token
providers = {
docker = docker.floyd
}
}
module "monitoring" {
source = "./monitoring"
ips = var.ips
providers = {
docker = docker.floyd
}
}
module "firefly" {
@ -39,4 +60,15 @@ module "firefly" {
ips = var.ips
firefly_postgres_password = var.firefly_postgres_password
firefly_app_key = var.firefly_app_key
providers = {
docker = docker.floyd
}
}
module "ripe-atlas" {
source = "./ripe-atlas"
ips = var.ips
providers = {
docker = docker.parvaaz
}
}

5
floyd/terraform/monitoring/conf/prometheus.yml

@ -17,3 +17,8 @@ scrape_configs:
scrape_interval: 5s
static_configs:
- targets: ["cadvisor:8080"]
- job_name: "ispmonitor"
scrape_interval: 60s
static_configs:
- targets: ["100.94.241.54:9283"] # RPi telegraf Agent

8
floyd/terraform/providers.tf

@ -1,5 +1,11 @@
provider "docker" {
host = "ssh://floyd:22"
alias = "floyd"
host = "ssh://floyd:22"
}
provider "docker" {
alias = "parvaaz"
host = "ssh://parvaaz:22"
}
provider "digitalocean" {

26
floyd/terraform/ripe-atlas/container.tf

@ -0,0 +1,26 @@
# Referred to https://github.com/pi-hole/docker-pi-hole#quick-start
# for config.
resource "docker_container" "gitea" {
name = "gitea"
image = docker_image.gitea.latest
mounts {
target = "/var/atlasdata"
type = "tmpfs"
}
log_opts {
"max-size" = "10m"
}
capabilities {
add = ["SYS_ADMIN","NET_RAW","CHOWN"]
}
tmpfs {
/var/atlasdata
}
restart = "unless-stopped"
destroy_grace_seconds = 30
must_run = true
}

8
floyd/terraform/ripe-atlas/image.tf

@ -0,0 +1,8 @@
data "docker_registry_image" "gitea" {
name = "gitea/gitea:1.12.3"
}
resource "docker_image" "gitea" {
name = data.docker_registry_image.gitea.name
pull_triggers = [data.docker_registry_image.gitea.sha256_digest]
}

5
floyd/terraform/ripe-atlas/network.tf

@ -0,0 +1,5 @@
resource "docker_network" "gitea" {
name = "gitea"
driver = "bridge"
internal = "false"
}

3
floyd/terraform/ripe-atlas/variables.tf

@ -0,0 +1,3 @@
variable "ips" {
type = map
}

8
floyd/terraform/ripe-atlas/versions.tf

@ -0,0 +1,8 @@
terraform {
required_providers {
docker = {
source = "terraform-providers/docker"
}
}
required_version = ">= 0.13"
}

5
floyd/terraform/variables.tf

@ -2,8 +2,9 @@ variable "ips" {
type = map
default = {
tailscale_floyd = "100.101.134.59"
eth1 = "10.139.120.134"
tailscale_floyd = "100.101.134.59"
tailscale_parvaaz = "100.94.241.54"
eth1 = "10.139.120.134"
}
}

Loading…
Cancel
Save