Nomad exec/raw_exec job for service

Hello all. I started to use nomad now for all the container based services. I have some other services like apache nifi that i will not use docker. I need to make something clear, cause i am a little confused.
Installation and setup of nifi comes from saltstack. So the server already have everything that need to start it. What is the correct job to make to start nifi service?
I tried with raw_exec like that

job "nifi" {
   datacenters = ["dc1"]
   type = "service"
   group "nifi" {
      count = 1
    network {
      port "nifi" {
        static = 9443

      task "nifi"{
         driver = "raw_exec"
         user = "nifi"
         config {
	   command = "/bin/bash"
	   args = ["/opt/nifi/1.15/bin/", "start"]

          service {
            name = "nifi"
            port = "nifi"



The job failed and keep restarting.
The user that nomad running is root. So the service should run like root? Unfortunately the logs from the allocation don’t give any clue. JAVA_HOME not set; results may vary

Java home: 
NiFi home: /opt/nifi/1.15

Bootstrap Config File: /opt/nifi/1.15/conf/bootstrap.conf

Is the same stdout that i have when i run manually the
/opt/nifi/1.15/bin/ start
and it start as expected.

Do i miss something of how the non containered job service should be? Maybe its better to exec with systemctl start nifi ?

Maybe is something to do with https and not trusted certs ? Nifi by default it create some certs that are not trusted from the browser. And start on 9443 https.
All other services that i start with raw_exec do not have the same problem.

Hi @dimitris.tzampanakis. Thanks for using Nomad!

If you log in as the user that Nomad is running as, and do echo $JAVA_HOME what do you see?

Hello Derek. I do not think is JAVA_HOME issue. I tried it with

      task "nifi"{
         driver = "raw_exec"
         env {
           JAVA_HOME = "/usr/lib/jvm/java-11-openjdk"
           NIFI_HOME = "/opt/nifi/current"

Again the only log that i have is this

Java home: /usr/lib/jvm/java-11-openjdk
NiFi home: /tmp/nifi/nifi-1.15.3

Bootstrap Config File: /tmp/nifi/nifi-1.15.3/conf/bootstrap.conf

The only thing i see in the nomad web ui is that it start for 2 seconds failed and then being on pending again. And that repeat.
The exactly same job run for the apache druid. It started the service and register it to consul too.

Ok so that looks like progress. Now I’m wondering if you’ve configured host_volumes on the client.

This tutorial can show you how in case you haven’t.