jjethwa / rundeck

GNU General Public License v3.0
122 stars 137 forks source link

Can't get rundeck-defaults configuration to work #22

Closed stagrlee closed 8 years ago

stagrlee commented 8 years ago

Everytime a boot up jordan/rundeck, I get

=>/etc/rundeck check OK

Which means the rundeck directory is set and the default files won't be copied into it.

   if [ "$(ls -A /etc/rundeck)" ]; then
       echo "=>/etc/rundeck check OK"
   else
       echo "=>/etc/rundeck empty...setting up defaults"
       cp -R /opt/rundeck-defaults/* /etc/rundeck
       chown -R rundeck:rundeck /etc/rundeck
   fi

Sure enough, your image has /etc/rundeck already in it even though I can't find mention of it in your dockerfile

$ docker run -i -t --entrypoint /bin/bash jordan/rundeck:latest 
root@e9453843e7cb:/# ls /etc/rundeck
admin.aclpolicy     cli-log4j.properties  jaas-loginmodule.conf  profile         realm.properties       ssl
apitoken.aclpolicy  framework.properties  log4j.properties   project.properties  rundeck-config.properties
root@e9453843e7cb:/# 

I guess there are two issues. First is that there are files in /etc/rundeck when there probably should not. Secondly, even if empty, since the /etc/rundeck directory is a volume it will always exist so the ls -A /etc/rundeck will always return true.

stagrlee commented 8 years ago

The files in /etc/rundeck probably came from the rundeck debian package

stagrlee commented 8 years ago

I got this working by mounting an empty volume. Sorry for the noise. ls -A works different on mac and linux....

jjethwa commented 8 years ago

Hi @stagrlee

No problem at all! Sorry for not responding earlier, I was away for the weekend :) Just to confirm:

  1. If a volume is not specified for /etc/rundeck, the default configs from the debian package are used.
  2. If an empty volume is specified, the container init script will copy over the configs from /opt/rundeck-defaults.
  3. If a volume with at least one file is specified, no action will be taken.

I'll keep in mind the difference in how ls -A works on MacOS and Linux if more users report the issue. Appreciate the feedback :)

stagrlee commented 8 years ago

More discussion about volumes. When I mounted /var/rundeck on my Mac, the rundeck in docker couldn't write onto the volume. I hacked up your docker container to run rundeck as root and not set all the files to rundeck:rundeck and got things working well. This is a much needed feature in upstream docker and discussed quite a bit there. This might end up in some code on a jjethwa/rundeck pull request if I can find some time to make it a generic option. Mine is hard coded to root right now.

jjethwa commented 8 years ago

Hmm, even though the daemons are running inside a container, it's still preferable that they run as a separate user. For my containers, I only spawn supervisor as root.

How are you running Docker on your Mac? Is it the new Docker for Mac beta?

stagrlee commented 8 years ago

Totally agree with the run as rundeck user. Hopefully docker will fix it up as its a framework level issue. This has a pretty good discussion of what's going on upstream.

https://github.com/docker/docker/issues/2259

I run on docker-machine. Several of us run on Docker Mac Beta. Both work well, except for not getting write access to a volume issue, which is consistent across both.