aboutsummaryrefslogtreecommitdiff
path: root/example/example-service.hcl
diff options
context:
space:
mode:
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"
+ }
+ }
+ }
+}