hubspotdevops / puppet-nexus

Puppet module for Sonatype Nexus
MIT License
24 stars 93 forks source link

home directory not writable by default #63

Open williamtsoi1 opened 8 years ago

williamtsoi1 commented 8 years ago

Hi,

Using this module and the defaults for the home directory (ie. /srv), the ownership of this directory chowned to the nexus user, and so nexus isn't able to create the /srv/.java folder in order to store preferences. Leading to errors similar to:

https://issues.sonatype.org/browse/NEXUS-3671

kenbreeman commented 8 years ago

Not sure I understand the issue correctly.

The permissions for the home directory should be set in a way that allows the nexus user to write to that directory: https://github.com/hubspotdevops/puppet-nexus/blob/master/manifests/package.pp#L84-L91

Why isn't the .java folder able to be created? Would it make sense to include creation of that .java folder in this puppet module?

peterabbott commented 7 years ago

I found that I had to override the home directory variable in hiera to something nested like /opt/nexus for it to properly work. The issue I found was that setting the root path for nexus to /srv (or in my case /opt) set the service users' home dir to that. It was created as root instead of the user so when the service ran it did not have permissions to write to the directory.

williamtsoi1 commented 7 years ago

maybe then setting the default in the module to /srv/nexus or even /opt/nexus would be a better choice?

kenbreeman commented 7 years ago

The default is currently /srv/nexus

We set the root here: https://github.com/hubspotdevops/puppet-nexus/blob/master/manifests/params.pp#L29-L30 We set the home here: https://github.com/hubspotdevops/puppet-nexus/blob/master/manifests/package.pp#L47

Are you using the latest version? Am I missing something?

tmclaugh commented 7 years ago

The module extracts the nexus package to $nexus_root, creating a directory with the nexus version number in it. That directory is represented by $nexus_home_real

$nexus_home is created at the end as a symlink to the currently running version under $nexus_home_real.

It's confusing but was the best idea I could come up with at the time. Not sure of a better way to handle that version number.

peterabbott commented 7 years ago

The issue is not necessarily with the location /srv/nexus (although /opt/nexus would be a more standard install location), it is the user that gets created to run the service.

If you look at /etc/passwd you will see that it is set to /srv (using all defaults from params.pp). So when the service is started there is something inside the application that is trying to write to the users' home directory (assuming java property 'user.home').

My working around was to set the nexus_root to /opt/nexus and the service would start without any intervention.

tmclaugh commented 7 years ago

It's just a minor fix to the user resource in init.pp.

Sent from my iPhone

On Sep 3, 2016, at 2:25 AM, Peter Abbott notifications@github.com wrote:

The issue is not necessarily with the location /srv/nexus (although /opt/nexus would be a more standard install location), it is the user that gets created to run the service.

If you look at /etc/passwd you will see that it is set to /srv (using all defaults from params.pp). So when the service is started there is something inside the application that is trying to write to the users' home directory (assuming java property 'user.home').

My working around was to set the nexus_root to /opt/nexus and the service would start without any intervention.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.