Local jar artifact

565 views
Skip to first unread message

Chka

unread,
Oct 9, 2017, 3:55:48 PM10/9/17
to Nomad
Hi,

I'm trying to run a java app in nomad locally. But I can't get around `artifact.source` config. hello.jar is located in /tmp directory.

If I set `artifact.source = "./tmp/hello.jar"`, I get the following error.  

2017/10/09 15:51:29.642245 [DEBUG] client: failed to download artifact "./tmp/hello.jar": relative paths require a module with a pwd


Running `go-getter /tmp/hello.jar local` gives a success. Any idea what maybe wrong with the nomad config?


Here is the full config file.


job "local" {

  datacenters = ["dc1"]

  type = "service"

  update {
    stagger      = "10s"
    max_parallel = 1
  }

  group "java" {
    count = 1

    task "api" {

      driver = "java"

      config {
        jar_path = "hello.jar"
        jvm_options = ["-Xmx1024m", "-Xms256m"]
      }

      artifact {
        source = "./tmp/hello.jar"
      }

      resources {
        cpu    = 500 # MHz
        memory = 128 # MB

        network {
          mbits = 100

          port "http" {
            static = 9000
          }
        }
      }

    }
  }
}



Thanks

Laurent Commarieu

unread,
Oct 10, 2017, 1:13:07 AM10/10/17
to Nomad
Try to remove the dot in your source directive.
Nomad's error message is about relative path.

You should have:

source = "/tmp/hello.jar"

Chka

unread,
Oct 10, 2017, 12:52:05 PM10/10/17
to Nomad
Yea tried that as well. It turned out nomad doesn't support `file` artifact.

Workaround would be either dockerize the jar or host the jar on a http server.

Michael Schurter

unread,
Oct 10, 2017, 7:53:12 PM10/10/17
to Chka, Nomad
This is the issue to follow for supporting file artifacts: https://github.com/hashicorp/nomad/issues/1897

We don't want to give unlimited filesystem access to tasks, so we need to add a list of whitelisted paths to the client's config.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/nomad/issues
IRC: #nomad-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Nomad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomad-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nomad-tool/04408236-8a78-4e69-bf77-646884cddfd0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages