Ubiquity and printers included

This commit is contained in:
Greyscale 2024-06-28 12:43:20 +02:00
parent 8b112b05ff
commit 70e46005a7
8 changed files with 187 additions and 37 deletions

View file

@ -1,4 +1,4 @@
provider "ssh" {
/*provider "ssh" {
server = {
host = "california.ti"
port = 22
@ -10,12 +10,14 @@ provider "ssh" {
}
}
}
#data "ssh_tunnel" "docker" {
# connection_name = "docker_socket_tunnel_california"
# remote = {
# socket = "/var/run/docker.sock"
# }
#}
data "ssh_tunnel" "docker" {
connection_name = "docker_socket_tunnel_california"
remote = {
socket = "/var/run/docker.sock"
}
}
*/
provider "docker" {
host = "ssh://california.ti"
}

View file

@ -1,7 +1,7 @@
output "auth" {
value = {
user = docker_service.minio.task_spec[0].container_spec[0].env.MINIO_ROOT_USER
password = nonsensitive(docker_service.minio.task_spec[0].container_spec[0].env.MINIO_ROOT_PASSWORD)
user = var.admin_username
password = nonsensitive(random_password.minio_password.result)
}
}
output "domain" {

View file

@ -1,14 +1,49 @@
resource "docker_image" "octoprint" {
provider = "docker.printi"
provider = docker.printi
name = "octoprint"
build {
context = "${path.module}/printers"
target = "octoprint-mjpg-streamer"
tag = ["ti-octoprint"]
}
}
/*
resource "docker_container" "corexy" {
provider = "docker.printi"
resource "docker_volume" "ender5plus" {
provider = docker.printi
name = "ender5plus_config"
}
resource "docker_service" "ender5plus" {
provider = docker.printi
name = "ender5plus"
task_spec {
container_spec {
image = docker_image.octoprint.name
name = "corexy"
}*/
mounts {
target = "/octoprint"
source = docker_volume.ender5plus.name
type = "volume"
}
mounts {
target = "/dev/ttyACM0"
source = "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A602AFFK-if00-port0"
type = "bind"
}
env = {
#ENABLE_MJPG_STREAMER = "true"
}
}
restart_policy {
condition = "any"
delay = "20s"
window = "0s"
}
}
endpoint_spec {
ports {
target_port = 80
published_port = 3000
publish_mode = "ingress"
}
}
}

113
ubiquity.tf Normal file
View file

@ -0,0 +1,113 @@
data "docker_registry_image" "unifi_controller" {
name = "jacobalberty/unifi"
}
resource "docker_service" "unifi_controller" {
name = "unifi_controller"
provider = docker.unifi
task_spec {
container_spec {
image = "${data.docker_registry_image.unifi_controller.name}@${data.docker_registry_image.unifi_controller.sha256_digest}"
env = {
TZ = "Europe/Amsterdam"
}
mounts {
target = "/unifi"
source = "/home/techinc/unifi"
type = "bind"
}
}
restart_policy {
condition = "any"
delay = "0s"
window = "0s"
}
}
endpoint_spec {
ports {
target_port = 8443
published_port = 443
publish_mode = "ingress"
}
ports {
target_port = 8443
published_port = 8443
publish_mode = "ingress"
}
ports {
target_port = 3478
published_port = 3478
publish_mode = "ingress"
protocol = "udp"
}
ports {
target_port = 10001
published_port = 10001
publish_mode = "ingress"
protocol = "udp"
}
ports {
target_port = 8080
published_port = 8080
publish_mode = "ingress"
}
}
}
data "docker_registry_image" "http2https" {
name = "articulate/http-to-https"
}
resource "docker_service" "unifi_http2https" {
name = "http2https"
provider = docker.unifi
task_spec {
container_spec {
image = "${data.docker_registry_image.http2https.name}@${data.docker_registry_image.http2https.sha256_digest}"
}
restart_policy {
condition = "any"
delay = "0s"
window = "0s"
}
}
endpoint_spec {
ports {
target_port = 80
published_port = 80
publish_mode = "ingress"
}
}
}
data "docker_registry_image" "iperf" {
name = "loganmarchione/docker-iperf3:latest"
provider = docker.unifi
}
resource "docker_service" "unifi_iperf" {
name = "iperf"
provider = docker.unifi
task_spec {
container_spec {
image = "${data.docker_registry_image.iperf.name}@${data.docker_registry_image.iperf.sha256_digest}"
}
restart_policy {
condition = "any"
delay = "0s"
window = "0s"
}
}
endpoint_spec {
ports {
target_port = 5201
published_port = 5201
publish_mode = "ingress"
protocol = "tcp"
}
ports {
target_port = 5201
published_port = 5201
publish_mode = "ingress"
protocol = "udp"
}
}
}