hepsw / docks

a set of Dockerfiles defining docker containers for HEP software and appliances.
BSD 3-Clause "New" or "Revised" License
17 stars 13 forks source link

cvmfs-atlas bashrc fails to setup ATLAS environment. #9

Closed cshimmin closed 9 years ago

cshimmin commented 9 years ago

The cvmfs-atlas image is supposed to auto-run atlasLocalSetup.sh; however, the following check in cvmfs-atlas/dot-bashrc will always fail:

## setup ATLAS environment
if [ -e "$ATLAS_LOCAL_ROOT_BASE/user/atlasLocalSetup.sh" ] ; then
  # ...

Apparently this is because the .bashrc is invoked by cubie before run-cvmfs.sh. Hence, the cvmfs mounts have not been brought up yet, and $ATLAS_LOCAL_ROOT_BASE does not exist at the time this script runs.

It's unclear to me whether this is simply a restriction of cubie or if there's some way to ensure run-cvmfs.sh runs first. I don't know about cubie and can't find any documentation (is it something @sbinet wrote?) In any case, I think the standard way to handle this in docker is to just have a docker-entrypoint.sh script that sets this up, before invoking any commands specified by the user. E.g. something like:

#!/bin/bash
set -e

/etc/cvmfs/run-cvmfs.sh
exec "$@"
sbinet commented 9 years ago

yes, cubied is something I wrote to allow for long running "daemonized" processes: https://github.com/hepsw/cubie/blob/master/cubied/main.go

a very loose implementation of supervisord, if you want.

could you show what you get when running:

sh> docker run -h dev --privileged -i -t hepsw/cvmfs-atlas

thanks, -s

sbinet commented 9 years ago

ah! rebuilding with my latest version of docker (1.8.2) I do see the behaviour you (rightfully) complain about.

cshimmin commented 9 years ago

Sure, using the images from dockerhub:

hypatia:tmp cshimmin$ docker run -h dev --privileged -i -t hepsw/cvmfs-atlas
2015/10/05 11:16:54 ::: starting cubie-daemon [0.1.20150512]...
2015/10/05 11:16:54 running [/etc/cvmfs/run-cvmfs.sh]...
::: cvmfs-config...
::: mounting FUSE...
CernVM-FS: running with credentials 499:497
CernVM-FS: loading Fuse module... done
CernVM-FS: mounted cvmfs on /cvmfs/cernvm-prod.cern.ch
CernVM-FS: running with credentials 499:497
CernVM-FS: loading Fuse module... done
CernVM-FS: mounted cvmfs on /cvmfs/sft.cern.ch
Failed to grab mountpoint (2)
Failed to grab mountpoint (2)
::: mounting FUSE... [done]
2015/10/05 11:16:59 running [/etc/cvmfs/run-cvmfs.sh]... [done]
2015/10/05 11:16:59 running [bash]...
[root@dev ~]#

However note that the "Failed to grab mountpoint (2)" errors are related to #8. With that PR applied, I get:

hypatia:tmp cshimmin$ docker run -h dev --privileged -i -t hepsw/cvmfs-atlas
2015/10/05 11:20:28 ::: starting cubie-daemon [0.1.20150512]...
2015/10/05 11:20:28 running [bash]...
2015/10/05 11:20:28 running [/etc/cvmfs/run-cvmfs.sh]...
::: cvmfs-config...
[root@dev ~]# ::: mounting FUSE...
CernVM-FS: running with credentials 499:497
CernVM-FS: loading Fuse module... done
CernVM-FS: mounted cvmfs on /cvmfs/cernvm-prod.cern.ch
CernVM-FS: running with credentials 499:497
CernVM-FS: loading Fuse module... done
CernVM-FS: mounted cvmfs on /cvmfs/sft.cern.ch
CernVM-FS: running with credentials 499:497
CernVM-FS: loading Fuse module... done
CernVM-FS: mounted cvmfs on /cvmfs/atlas.cern.ch
CernVM-FS: running with credentials 499:497
CernVM-FS: loading Fuse module... done
CernVM-FS: mounted cvmfs on /cvmfs/atlas-condb.cern.ch
::: mounting FUSE... [done]
2015/10/05 11:20:36 running [/etc/cvmfs/run-cvmfs.sh]... [done]

[root@dev ~]# asetup
bash: asetup: command not found
cshimmin commented 9 years ago

Right, should have specified I'm on v1.8.2. I'm guessing the behavior of the VOLUME directive has changed from underneath you. However, as you can see above it still doesn't fix the fact that cubie runs run-cvmfs.sh after the bash shell (and .bashrc) starts.

sbinet commented 9 years ago

shoudl be fixed now. feel free to re-open otherwise (and thanks for the report!)

cshimmin commented 9 years ago

Looks good over here! Maybe push to dockerhub when you get a chance?

sbinet commented 9 years ago

sure thing (I just had to duck to catch my ride)

sbinet commented 9 years ago

done.