🏡 index : github.com/captn3m0/nebula.git

author Nemo <commits@captnemo.in> 2022-12-26 12:49:52.0 +05:30:00
committer Nemo <commits@captnemo.in> 2022-12-26 12:49:52.0 +05:30:00
commit
48b93bf25deb82085718fe67dfbc0532d080588b [patch]
tree
dfda9652c65ca5a3f06da07fb26dfce66fefa025
parent
8a894175a92441bf9bf3b3d7cc65df8c6f00f50c
download
48b93bf25deb82085718fe67dfbc0532d080588b.tar.gz

GPU and provider upgrades.

Applied to jupyter container

Diff

 jupyter.tf                     | 28 ++++++++++++++++++++--------
 providers.tf                   |  2 ++
 modules/container/main.tf      |  2 ++
 modules/container/providers.tf |  2 --
 modules/container/vars.tf      |  5 +++++
 5 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/jupyter.tf b/jupyter.tf
index 3deceed..05dc6bf 100644
--- a/jupyter.tf
+++ a/jupyter.tf
@@ -1,12 +1,16 @@
# module "jupyter" {
#   name   = "jupyter"
#   source = "modules/container"
#   image  = "jupyter/tensorflow-notebook"
#   ports = [
#     {
#       internal = 8888
#       external = 1112
#       ip       = "${var.ips["tun0"]}"
#     },
#   ]
# }
module "jupyter" {

  name   = "jupyter"
  source = "./modules/container"
  image  = "jupyter/scipy-notebook"
  resource = {

    memory      = 1024
    memory_swap = 4096
  }
  web = {

    expose = "true"
    host   = "j.${var.root-domain}"
    port = 8888
  }
  networks = ["bridge"]
  gpu = true
}
diff --git a/providers.tf b/providers.tf
index baa3523..65488cf 100644
--- a/providers.tf
+++ a/providers.tf
@@ -31,6 +31,7 @@


terraform {

  required_version = ">= 1.3.0"
  required_providers {

    pass = {

      source = "camptocamp/pass"
@@ -46,6 +47,7 @@
    }
    docker = {

      source = "kreuzwerker/docker"
      version = "~> 2.23"
    }
  }
}
diff --git a/modules/container/main.tf b/modules/container/main.tf
index 19c7c93..aa4c4ad 100644
--- a/modules/container/main.tf
+++ a/modules/container/main.tf
@@ -19,6 +19,8 @@

  network_mode = var.network_mode

  gpus = var.gpu ? "all" : ""

  dynamic "capabilities" {

    for_each = [var.capabilities]
    content {

diff --git a/modules/container/providers.tf b/modules/container/providers.tf
index c8e3cc2..ed370db 100644
--- a/modules/container/providers.tf
+++ a/modules/container/providers.tf
@@ -1,9 +1,7 @@
terraform {

  experiments = [module_variable_optional_attrs]
  required_providers {

    docker = {

      source  = "kreuzwerker/docker"
      version = "2.15.0"
    }
  }
}
diff --git a/modules/container/vars.tf b/modules/container/vars.tf
index 82c0239..978ad29 100644
--- a/modules/container/vars.tf
+++ a/modules/container/vars.tf
@@ -135,3 +135,8 @@

  default = []
}

variable "gpu" {

  type = bool
  default  = false
}