more examples, clearer names
This commit is contained in:
parent
6ab9d1b5b6
commit
a036c0e6ba
|
@ -51,3 +51,7 @@ hcloud_location = "nbg1"
|
|||
```
|
||||
|
||||
## [HCL to Nix](https://gist.github.com/KiaraGrouwstra/249ede6a7dfc00ea44d85bc6bdbcd875)
|
||||
|
||||
# todo
|
||||
|
||||
- [add nomad job types](https://github.com/input-output-hk/bitte/blob/master/schemas/nomad/types.cue)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
job "nixpkgs" {
|
||||
job "nix-nixpkgs-job" {
|
||||
datacenters = ["dc1"]
|
||||
type = "batch"
|
||||
|
||||
group "nixpkgs" {
|
||||
task "nixpkgs" {
|
||||
group "nix-nixpkgs-group" {
|
||||
task "nix-nixpkgs-task" {
|
||||
driver = "nix"
|
||||
|
||||
resources {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
job "nix2-example-service" {
|
||||
job "nix2-service-job" {
|
||||
datacenters = ["dc1"]
|
||||
type = "service"
|
||||
|
||||
group "example" {
|
||||
group "nix2-service-group" {
|
||||
# This task defines a server that runs a simple python file server on port 8080,
|
||||
# which allows to explore the contents of the filesystem namespace as visible
|
||||
# by processes that run inside the task.
|
||||
# A bunch of utilities are included as well, so that you can exec into the container
|
||||
# and explore what's inside by yourself.
|
||||
task "nix-python-serve-http" {
|
||||
task "nix2-service-task-python-serve-http" {
|
||||
driver = "nix2"
|
||||
|
||||
config {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
job "nixos-job" {
|
||||
group "nixos-group" {
|
||||
network {
|
||||
port "my-http-port" { to = 80 }
|
||||
}
|
||||
|
||||
task "nixos-task" {
|
||||
driver = "podman"
|
||||
config {
|
||||
image = "docker.io/nixos/nix:2.20.1" # -arm64
|
||||
ports = ["my-http-port"]
|
||||
command = "nix-channel"
|
||||
args = ["--update", "&&", "nix-build", "-A", "pythonFull", "'<nixpkgs>'"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
job "redis" {
|
||||
group "cache" {
|
||||
job "podman-job" {
|
||||
group "podman-group" {
|
||||
network {
|
||||
port "redis" { to = 6379 }
|
||||
}
|
||||
|
||||
task "redis" {
|
||||
task "podman-task" {
|
||||
driver = "podman"
|
||||
config {
|
||||
image = "docker.io/library/redis:7"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
job "lolcow" {
|
||||
job "singularity-job" {
|
||||
datacenters = ["dc1"]
|
||||
type = "batch"
|
||||
|
||||
group "lolcow" {
|
||||
task "lolcow" {
|
||||
group "singularity-group" {
|
||||
task "singularity-task" {
|
||||
driver = "singularity"
|
||||
|
||||
config {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
job "webapp" {
|
||||
job "docker-job" {
|
||||
datacenters = ["dc1"]
|
||||
|
||||
group "demo" {
|
||||
group "docker-group" {
|
||||
count = 3
|
||||
network {
|
||||
port "http" {
|
||||
|
@ -10,7 +10,7 @@ job "webapp" {
|
|||
}
|
||||
|
||||
service {
|
||||
name = "demo-webapp"
|
||||
name = "docker-service"
|
||||
port = "http"
|
||||
|
||||
check {
|
||||
|
@ -21,7 +21,7 @@ job "webapp" {
|
|||
}
|
||||
}
|
||||
|
||||
task "server" {
|
||||
task "docker-task" {
|
||||
env {
|
||||
PORT = "${var.NOMAD_PORT_http}"
|
||||
NODE_IP = "${var.NOMAD_IP_http}"
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
# https://github.com/tdsacilowski/hashi-demo/blob/master/shared/nomad/jobs/wordpress.hcl
|
||||
job "wordpress" {
|
||||
|
||||
update {
|
||||
stagger = "10s"
|
||||
max_parallel = 1
|
||||
}
|
||||
|
||||
group "wordpress" {
|
||||
|
||||
restart {
|
||||
interval = "5m"
|
||||
attempts = 10
|
||||
delay = "25s"
|
||||
mode = "delay"
|
||||
}
|
||||
|
||||
task "wordpress" {
|
||||
driver = "podman"
|
||||
|
||||
config {
|
||||
image = "wordpress"
|
||||
network_mode = "host"
|
||||
}
|
||||
|
||||
env {
|
||||
WORDPRESS_DB_HOST = "mysql.service.consul:3306"
|
||||
WORDPRESS_DB_PASSWORD = "my-secret-pwd"
|
||||
}
|
||||
|
||||
service {
|
||||
name = "wordpress"
|
||||
tags = ["global"]
|
||||
port = "http"
|
||||
|
||||
check {
|
||||
name = "wordpress running on port 80"
|
||||
type = "http"
|
||||
protocol = "http"
|
||||
path = "/"
|
||||
interval = "10s"
|
||||
timeout = "2s"
|
||||
}
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 500
|
||||
memory = 256
|
||||
|
||||
network {
|
||||
mbits = 10
|
||||
|
||||
port "http" {
|
||||
static = 80
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue