From 23833181edf39a28ae8e20d1c1a79324d2089a23 Mon Sep 17 00:00:00 2001 From: am0o0 <77095239+am0o0@users.noreply.github.com> Date: Thu, 14 Aug 2025 01:27:57 +0400 Subject: [PATCH 1/2] unauthenticated nomad instance --- hashicorp/nomad/exposed_ui/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 hashicorp/nomad/exposed_ui/README.md diff --git a/hashicorp/nomad/exposed_ui/README.md b/hashicorp/nomad/exposed_ui/README.md new file mode 100644 index 00000000..bdf1b7e9 --- /dev/null +++ b/hashicorp/nomad/exposed_ui/README.md @@ -0,0 +1,22 @@ +# setup an unauthenticated nomad ui +you can install nomad cli according to the official document: https://developer.hashicorp.com/nomad/install +OR base on ubuntu 24.04, docker should be installed. +```bash +wget https://releases.hashicorp.com/nomad/1.10.4/nomad_1.10.4_linux_amd64.zip +unzip nomad_1.10.4_linux_amd64.zip && rm nomad_1.10.4_linux_amd64.zip +sudo ./nomad agent -dev \ +-bind 0.0.0.0 \ +-network-interface='{{ GetDefaultInterfaces | attr "name" }}' + +# open another terminal +sudo ./nomad ui --show-url +``` + +# confirming the exposed ui +```bash +# replace the COMMAND_HERE with your command like `curl url` +curl 'http://localhost:4646/v1/jobs' -X POST -H 'content-type: application/json; charset=utf-8' --data-raw '{"Job":{"Affinities":null,"AllAtOnce":false,"Constraints":null,"ConsulNamespace":"","CreateIndex":0,"Datacenters":["dc1"],"DispatchIdempotencyToken":null,"Dispatched":false,"ID":"tsunami-job","JobModifyIndex":0,"Meta":null,"Migrate":null,"ModifyIndex":0,"Multiregion":null,"Name":"tsunami-job","Namespace":"default","NodePool":"","NomadTokenID":"","ParameterizedJob":null,"ParentID":"","Payload":null,"Periodic":null,"Priority":50,"Region":"global","Reschedule":null,"Spreads":null,"Stable":false,"Status":"","StatusDescription":"","Stop":false,"SubmitTime":null,"TaskGroups":[{"Affinities":null,"Constraints":null,"Consul":null,"Count":1,"Disconnect":null,"EphemeralDisk":{"Migrate":false,"SizeMB":300,"Sticky":false},"MaxClientDisconnect":null,"Meta":null,"Migrate":null,"Name":"curl","Networks":null,"PreventRescheduleOnLost":null,"ReschedulePolicy":{"Attempts":1,"Delay":5000000000,"DelayFunction":"constant","Interval":86400000000000,"MaxDelay":0,"Unlimited":false},"RestartPolicy":{"Attempts":3,"Delay":15000000000,"Interval":86400000000000,"Mode":"fail","RenderTemplates":false},"Scaling":null,"Services":null,"ShutdownDelay":null,"Spreads":null,"StopAfterClientDisconnect":null,"Tasks":[{"Actions":null,"Affinities":null,"Artifacts":null,"Config":{"args":["-lc","COMMAND_HERE"],"image":"curlimages/curl:8.8.0","command":"sh"},"Constraints":null,"Consul":null,"DispatchPayload":null,"Driver":"docker","Env":null,"Identities":null,"Identity":null,"KillSignal":"","KillTimeout":5000000000,"Kind":"","Leader":false,"Lifecycle":null,"LogConfig":{"Disabled":false,"Enabled":null,"MaxFileSizeMB":10,"MaxFiles":10},"Meta":null,"Name":"run-curl","Resources":{"CPU":100,"Cores":0,"Devices":null,"DiskMB":null,"IOPS":null,"MemoryMB":64,"MemoryMaxMB":null,"NUMA":null,"Networks":null,"SecretsMB":null},"RestartPolicy":{"Attempts":3,"Delay":15000000000,"Interval":86400000000000,"Mode":"fail","RenderTemplates":false},"ScalingPolicies":null,"Schedule":null,"Services":null,"ShutdownDelay":0,"Templates":null,"User":"","Vault":null,"VolumeMounts":null}],"Update":null,"Volumes":null}],"Type":"batch","UI":null,"Update":null,"VaultNamespace":"","Version":0,"VersionTag":null,"meta":{}},"Submission":{"Source":"job \"tsunami-job\" {\n datacenters = [\"dc1\"]\n type = \"batch\"\n\n group \"curl\" {\n count = 1\n\n task \"run-curl\" {\n driver = \"docker\"\n\n config {\n image = \"curlimages/curl:8.8.0\"\n command = \"sh\"\n args = [\n \"-lc\",\n \"\"\n ]\n }\n\n resources {\n cpu = 100\n memory = 64\n }\n }\n }\n}","Format":"hcl2"}}' + +# clean up +curl 'http://localhost:4646/v1/job/tsunami-job?purge=true' -X DELETE -H 'content-type: application/json; charset=utf-8' +``` \ No newline at end of file From fa9e28619fee1687cb427f35ed8dba40b9e61a93 Mon Sep 17 00:00:00 2001 From: am0o0 <77095239+am0o0@users.noreply.github.com> Date: Fri, 22 Aug 2025 00:25:41 +0400 Subject: [PATCH 2/2] use docker instead of install nomad in local --- hashicorp/nomad/exposed_ui/README.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/hashicorp/nomad/exposed_ui/README.md b/hashicorp/nomad/exposed_ui/README.md index bdf1b7e9..67c219ad 100644 --- a/hashicorp/nomad/exposed_ui/README.md +++ b/hashicorp/nomad/exposed_ui/README.md @@ -1,15 +1,8 @@ # setup an unauthenticated nomad ui you can install nomad cli according to the official document: https://developer.hashicorp.com/nomad/install -OR base on ubuntu 24.04, docker should be installed. +OR base on ubuntu 24.04 with docker run the following command to run nomad: ```bash -wget https://releases.hashicorp.com/nomad/1.10.4/nomad_1.10.4_linux_amd64.zip -unzip nomad_1.10.4_linux_amd64.zip && rm nomad_1.10.4_linux_amd64.zip -sudo ./nomad agent -dev \ --bind 0.0.0.0 \ --network-interface='{{ GetDefaultInterfaces | attr "name" }}' - -# open another terminal -sudo ./nomad ui --show-url +docker run --rm -it --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw -p 4646:4646 hashicorp/nomad:1.10 agent -dev -bind 0.0.0.0 -network-interface='{{ GetDefaultInterfaces | attr "name" }}' ``` # confirming the exposed ui