aboutsummaryrefslogtreecommitdiff
path: root/example/example-service.hcl
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-11-29 13:01:46 +0100
committerAlex Auvolat <alex@adnab.me>2022-11-29 13:01:46 +0100
commitfa49c13513ae5ab66157c634de244fdcf0a6cc1d (patch)
tree32508ecd16e0183767ecb7dd4bbeca82eccfdb0a /example/example-service.hcl
parentec3eba576a1a9574c6a2be8d90d973badb34f455 (diff)
downloadnomad-driver-nix2-fa49c13513ae5ab66157c634de244fdcf0a6cc1d.tar.gz
nomad-driver-nix2-fa49c13513ae5ab66157c634de244fdcf0a6cc1d.zip
Works better and better, write some examples
Diffstat (limited to 'example/example-service.hcl')
-rw-r--r--example/example-service.hcl35
1 files changed, 35 insertions, 0 deletions
diff --git a/example/example-service.hcl b/example/example-service.hcl
new file mode 100644
index 0000000..18dde44
--- /dev/null
+++ b/example/example-service.hcl
@@ -0,0 +1,35 @@
+job "nix2-example-service" {
+ datacenters = ["dc1"]
+ type = "service"
+
+ group "example" {
+ # 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" {
+ driver = "nix2"
+
+ config {
+ packages = [
+ "python3",
+ "bash",
+ "coreutils",
+ "curl",
+ "nix",
+ "git",
+ "cacert",
+ "strace",
+ "gnugrep",
+ "mount",
+ ]
+ command = "python3"
+ args = [ "-m", "http.server", "8080" ]
+ }
+ env = {
+ SSL_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt"
+ }
+ }
+ }
+}