Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

host_volume/volume/volume_mount does not work with java driver #6709

Closed
martingms opened this issue Nov 15, 2019 · 18 comments
Closed

host_volume/volume/volume_mount does not work with java driver #6709

martingms opened this issue Nov 15, 2019 · 18 comments

Comments

@martingms
Copy link

Nomad version

Nomad v0.10.1 (0d4e5d949fe073c47a947ea36bfef31a3c49224f)

Operating system and Environment details

Ubuntu 18.04.3 LTS

Issue

host_volume/volume/volume_mount does not work with java driver. The directory is created in the allocation, but not mounted/available.

Reproduction steps

Add host_volume in client config, with corresponding volume and volume_mount in job spec, using the "java" driver. Put a file in the directory, and attempt to find it/read it from within the java program.

Job file (if appropriate)

client.hcl:

data_dir = "/var/lib/nomad"                                                         
                                                                                 
client {                                                                         
  enabled = true                                                                 
                                                                                 
  ...                                                                            
                                                                                 
  host_volume "data" {                                                           
    path      = "/data"                                                          
    read_only = false                                                            
  }                                                                              
}

my-job.nomad:

job "my-job" {                                                                      
  type = "service"                                                                  
                                                                                    
  group "my-group" {                                                                
    count = 1                                                                       
                                                                                    
    volume "data" {                                                                 
      type      = "host"                                                            
      read_only = false                                                             
      source    = "data"                                                            
    }                                                                               
                                                                                    
    task "my-task" {                                                                
      driver = "java"                                                               
                                                                                    
      config {                                                                      
        jar_path = "..."                                                            
        jvm_options = [ ... ]                                                       
        args = [ ... ]                                                              
      }                                                                             
                                                                                    
      artifact {                                                                    
        source = "..."                                                              
                                                                                    
        options = {                                                                 
          checksum = "..."                                                          
        }                                                                           
      }                                                                             
                                                                                    
      volume_mount {                                                                
        volume      = "data"                                                        
        destination = "/data"                                                       
        read_only   = false                                                         
      }                                                                             
                                                                                    
      resources { ... }                                                             
    }                                                                               
  }                                                                                 
} 

Nomad Client logs (if appropriate)

Nomad Server logs (if appropriate)

Seems like nothing about this shows up in the logs

@martingms martingms changed the title host_volume/volume/volume_mount does not work with java driver host_volume/volume/volume_mount does not work with java driver Nov 15, 2019
@martingms martingms changed the title host_volume/volume/volume_mount does not work with java driver host_volume/volume/volume_mount does not work with java driver Nov 15, 2019
@martingms
Copy link
Author

Seems like this might be an issue with the exec-driver as well, based on discussions on gitter.

@tgross
Copy link
Member

tgross commented Nov 15, 2019

Thanks for reporting this @martingms! Yeah, that definitely looks like a documentation and validation issue.

@tgross tgross added this to the near-term milestone Nov 15, 2019
@martingms
Copy link
Author

Hi @tgross thanks for the quick reply :) What do you mean with documentation and validation issue? Is host_volume/volume_mount not supposed to work with the java driver?

@tgross
Copy link
Member

tgross commented Nov 15, 2019

I did some digging and chatted with one of my colleagues and it turns out I'm wrong -- this should work. Sorry about the confusion. Going to mark this as a bug.

@rkettelerij
Copy link
Contributor

Seems like this might be an issue with the exec-driver as well, based on discussions on gitter.

I've got host-volumes working using the exec driver FWIW.

@sfs77
Copy link

sfs77 commented Dec 6, 2019

I have same issue , looking for a resolution

@endocrimes endocrimes self-assigned this Dec 9, 2019
@tgross tgross modified the milestones: near-term, unscheduled Jan 9, 2020
@tgross tgross modified the milestones: unscheduled , 0.11.1 Apr 9, 2020
@raypettersen
Copy link

This is crucial for us, excellent timing putting this into 0.11.1 👍

@raypettersen
Copy link

I just tested 0.11.1, and if I'm not totally lost (been a long day..) it seems that java_driver mount is now working?

@tgross
Copy link
Member

tgross commented Apr 22, 2020

This person reported the same: #6709 (comment). I never got a chance to actually reproduce this issue, but because two people reported it in this thread I'm hesitant to close this out until I've done so. I have this on my plate for the next patch release, so lemme take a quick look again in the next day or so to confirm.

@raypettersen
Copy link

Let me know if I can try/test anything. The puzzling thing is that I started off with the java_driver, didn't work. Tested with docker, and it worked so I just waited for 0.11.1, but I see this has been moved to 0.11.2. Either way, I just restarted the java-job I had and it seems like the storage popped up. It is not showing in the UI -> Files though. Going through the new "exec" is showing the directory content.

@tgross
Copy link
Member

tgross commented Apr 22, 2020

It is not showing in the UI -> Files though. Going through the new "exec" is showing the directory content.

The UI uses the same API as nomad alloc fs. So that sounds like a case of #7365?

@raypettersen
Copy link

Certainly does. I tested another java-job and it looks to be the same behavior.

@raypettersen
Copy link

Short follow-up, I've had my java-app write to the store successfully. The store is an EFS share that I've mounted locally on all my nomad clients. Seems to work just fine. I feel this issue should be closed (I was personally waiting for it to be resolved, pure luck that I did some extra tests and found it already working), but as you say @tgross it would be good to do some extra checks.

@tgross
Copy link
Member

tgross commented Apr 23, 2020

Ok, I was able to confirm that host volumes were working with both exec and java drivers with a few recent versions of Nomad. At this point I'm going to close this out and if anyone is running into this and can provide some more context we can always revisit. Thanks folks!

My relevant client config:

client {
  host_volume "srv" {
    path      = "/path/to/my/stuff"
    read_only = true
  }
}

My java task, using the host volume as the source of the jar we're running:

job "example" {
  datacenters = ["dc1"]

  group "group" {
    volume "srv" {
      type      = "host"
      source    = "srv"
      read_only = true
    }

    task "task" {
      driver = "java"

      config {
        jar_path    = "/local/srv/services-kotlin-0.0.1-all.jar"
        jvm_options = ["-Xmx1024m"]
      }

      volume_mount {
        volume      = "srv"
        destination = "/local/srv"
      }

      env {
        PORT = "9001"
      }

      resources {
        cpu    = 1024
        memory = 1024
      }

    }
  }
}

My exec task, which I verified had the volume mounted via nomad alloc exec :alloc_id /bin/sh

job "example" {
  datacenters = ["dc1"]

  group "group" {
    volume "srv" {
      type      = "host"
      source    = "srv"
      read_only = true
    }

    task "task" {
      driver = "exec"

      config {
        command = "sleep"
        args    = ["3600"]
      }

      volume_mount {
        volume      = "srv"
        destination = "/local/srv"
      }

    }
  }
}

@tgross tgross closed this as completed Apr 23, 2020
@raypettersen
Copy link

Thanks @tgross !

@tgross
Copy link
Member

tgross commented Apr 23, 2020

@martingms we had an internal discussion of another bug and I think the original problem you've had here isn't specific to the java driver but related to this #7796. I've got that on my plate for further investigation.

@martingms
Copy link
Author

Okay! It's been a while, but I'll test if upgrading to the latest version changes anything. Following #7796 as well.

@github-actions
Copy link

github-actions bot commented Nov 8, 2022

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants