Skip to content

Instantly share code, notes, and snippets.

@mlovci
Created December 16, 2014 17:35
Show Gist options
  • Save mlovci/5ee6b4d98838238433b1 to your computer and use it in GitHub Desktop.
Save mlovci/5ee6b4d98838238433b1 to your computer and use it in GitHub Desktop.
minimal galaxy + ipython /docker (v2)
#!/bin/bash
#this is to address this issue: https://github.com/jpetazzo/dind/issues/19
ensure_loop(){
num="$1"
dev="/dev/loop$num"
if test -b "$dev"; then
echo "$dev is a usable loop device."
return 0
fi
echo "Attempting to create $dev for docker ..."
if ! mknod -m660 $dev b 7 $num; then
echo "Failed to create $dev!" 1>&2
return 3
fi
return 0
}
LOOP_A=$(losetup -f)
LOOP_A=${LOOP_A#/dev/loop}
LOOP_B=$(expr $LOOP_A + 1)
ensure_loop $LOOP_A
ensure_loop $LOOP_B
sudo service docker stop
dmsetup mknodes
sudo service docker start
FROM bgruening/galaxy-stable:dev
ADD ./startup /usr/bin/startup
ADD ./clean.sh /usr/bin/clean.sh
RUN chmod 755 /usr/bin/startup && chmod 755 /usr/bin/clean.sh
#!/bin/sh
sudo ifconfig eth0 mtu 1500
cd /galaxy-central/
# If /export/ is mounted, export_user_files file moving all data to /export/
# symlinks will point from the original location to the new path under /export/
# If /export/ is not given, nothing will happen in that step
umount /var/lib/docker
python ./export_user_files.py $PG_DATA_DIR_DEFAULT
/usr/bin/clean.sh
# Configure SLURM with runtime hostname.
/home/galaxy/venv/bin/python /usr/sbin/configure_slurm.py
# Try to guess if we are running under --privileged mode
if mount | grep "/proc/kcore"; then
echo "Disable Galaxy Interactive Environments. Start with --privileged to enable IE's."
export GALAXY_CONFIG_INTERACTIVE_ENVIRONMENT_PLUGINS_DIRECTORY=""
/usr/bin/supervisord
sleep 5
else
echo "Enable Galaxy Interactive Environments."
export GALAXY_CONFIG_INTERACTIVE_ENVIRONMENT_PLUGINS_DIRECTORY="config/plugins/interactive_environments"
# if [ x$DOCKER_PARENT == "x" ]; then
#build the docker in docker environment
bash /root/cgroupfs_mount.sh
/usr/bin/supervisord
sleep 5
sudo service docker stop
supervisorctl start docker
# else
# #inheriting /var/run/docker.sock from parent, assume that you need to
# #run docker with sudo to validate
# echo "galaxy ALL = NOPASSWD : ALL" >> /etc/sudoers
# /usr/bin/supervisord
# sleep 5
# fi
fi
#if [ `echo ${GALAXY_LOGGING:-'no'} | tr [:upper:] [:lower:]` = "full" ]
# then
# tail -f /var/log/supervisor/* /var/log/nginx/* /home/galaxy/*.log
# else
# tail -f /home/galaxy/*.log
#fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment