github.com/hernad/nomad@v1.6.112/ui/app/utils/default_jobs/hello-world.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 export default `job "hello-world" { 7 // Specifies the datacenter where this job should be run 8 // This can be omitted and it will default to ["*"] 9 datacenters = ["*"] 10 11 meta { 12 // User-defined key/value pairs that can be used in your jobs. 13 // You can also use this meta block within Group and Task levels. 14 foo = "bar" 15 } 16 17 // A group defines a series of tasks that should be co-located 18 // on the same client (host). All tasks within a group will be 19 // placed on the same host. 20 group "servers" { 21 22 // Specifies the number of instances of this group that should be running. 23 // Use this to scale or parallelize your job. 24 // This can be omitted and it will default to 1. 25 count = 1 26 27 network { 28 port "www" { 29 to = 8001 30 } 31 } 32 33 service { 34 provider = "nomad" 35 port = "www" 36 } 37 38 // Tasks are individual units of work that are run by Nomad. 39 task "web" { 40 // This particular task starts a simple web server within a Docker container 41 driver = "docker" 42 43 config { 44 image = "busybox:1" 45 command = "httpd" 46 args = ["-v", "-f", "-p", "\${NOMAD_PORT_www}", "-h", "/local"] 47 ports = ["www"] 48 } 49 50 template { 51 data = <<EOF 52 <h1>Hello, Nomad!</h1> 53 <ul> 54 <li>Task: {{env "NOMAD_TASK_NAME"}}</li> 55 <li>Group: {{env "NOMAD_GROUP_NAME"}}</li> 56 <li>Job: {{env "NOMAD_JOB_NAME"}}</li> 57 <li>Metadata value for foo: {{env "NOMAD_META_foo"}}</li> 58 <li>Currently running on port: {{env "NOMAD_PORT_www"}}</li> 59 </ul> 60 EOF 61 destination = "local/index.html" 62 } 63 64 // Specify the maximum resources required to run the task 65 resources { 66 cpu = 50 67 memory = 64 68 } 69 } 70 } 71 }`;