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

Add ability to specify custom directories in chroot #347

Closed
dancannon opened this issue Oct 26, 2015 · 10 comments
Closed

Add ability to specify custom directories in chroot #347

dancannon opened this issue Oct 26, 2015 · 10 comments

Comments

@dancannon
Copy link

Unfortunately we have services that have a dependency on files in an external directory and to get our services to run in Nomad I have had to fork nomad and add out directory to the list of chroot directories manually (dancannon@8b6a394)

It would be nice to specify a list of environments in the driver config which are mounted when the service starts. I imagine this could also be useful for stateful services but I am interested to hear what other people think.

@dadgar
Copy link
Contributor

dadgar commented Oct 26, 2015

Thanks for filing this! Definitely something we want to expose. I just want to clarify one thing. The way the chroot is created is that it creates hard links to files inside those directories and when that fails it copies the data. So if you including a folder that was a NFS mount for your persistent data you would not have the expected behavior (it would just copy everything). We need a separate notion for mounts to accomplish that use case (something we are planning for future versions)

@dancannon
Copy link
Author

Thanks thats great to hear. Ill be honest my version was just a hack to get something working. Our services currently require some config files in a certain directory so having read only (or at least non-permanent) access is not an issue.

Slightly unrelated but I had a quick look into this issue and noticed that driver config has the type map[string]string, how would you see setting config for something like this mapping of directories? Would you have the directory mapping in a string, for example dir:mapping dir2:mappingand then parse this string when loading the config?

@cbednarski
Copy link
Contributor

Slightly unrelated but I had a quick look into this issue and noticed that driver config has the type map[string]string, how would you see setting config for something like this mapping of directories?

@dancannon This is in design phase for us and is not in the current dev cycle so I don't want to get into specifics that may change, but I think we will pass this into the driver via a specialized data structure, not as key-value pairs -- similar to what you might see now for networking.

@dancannon
Copy link
Author

@cbednarski Ok sounds good, I am just trying to understand how the internals work as I am really interested in the project.

@cbednarski
Copy link
Contributor

@bsoutham
Copy link

Another example -- a simple Spring Boot app needs to find a "/tmp" directory in order to startup. Currently it fails with

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to create Tomcat tempdir. java.io.tmpdir is set to /tmp

So just the simple ability to specify a directory that is created is useful.

@dadgar
Copy link
Contributor

dadgar commented Oct 29, 2015

@bsoutham: Is it possible to create the temp folder? The directory structure in the chroot is a starting point. The application should be able to create anything it needs

@bsoutham
Copy link

bsoutham commented Nov 3, 2015

@dadgar With the Spring Boot -- no. It is starting tomcat to handle connections to the app, which occurs automatically, before the actual app is started. The app doesn't have a chance to create a directory, because it fails prior to even running any code that I've written. It fails in the Spring bootstrapping, over which I don't have control. The directory needs to exist prior to being executed.

@diptanu
Copy link
Contributor

diptanu commented Aug 11, 2016

This was fixed via #1518

@diptanu diptanu closed this as completed Aug 11, 2016
benbuzbee pushed a commit to benbuzbee/nomad that referenced this issue Jul 21, 2022
benbuzbee pushed a commit to benbuzbee/nomad that referenced this issue Jul 21, 2022
@github-actions
Copy link

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 Dec 20, 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

5 participants