JosefJezek
12/23/2015 - 10:08 AM

Temporary fix for Gitlab sockets not working inside a LXC container on Proxmox 4.1

Temporary fix for Gitlab sockets not working inside a LXC container on Proxmox 4.1

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/usr/local/sbin/fix_gitlab.sh 2>&1 | logger &

exit 0
#!/bin/bash

while true
do
    /usr/bin/inotifywait -e create /var/opt/gitlab/gitlab-rails/sockets /var/opt/gitlab/redis /var/opt/gitlab/gitlab-workhorse
    chmod 777 /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket
    chmod 777 /var/opt/gitlab/redis/redis.socket
    chmod 777 /var/opt/gitlab/gitlab-workhorse/socket
done

This is a temporary fix for a problem running Gitlab on Proxmox 4.1 inside a LXC container. Symptom: UNIX sockets created inside containers get wrong permissions. This seems to be related to AppArmor and the Debian kernel used by Proxmox. See this thread on the Proxmox forum for details.

Run apt-get install inotify-tools if you haven't installed inotifywait yet.

Place the first file in /usr/local/sbin/fix_gitlab.sh and make it executable: chmod 755 /usr/local/sbin/fix_gitlab.sh. Edit etc/rc.local to include it during boot.