GitLab – Site looks funky – CSS Issue

| | | | | |

It’s rare with the latest updates but sometimes the CSS doesn’t seem to load, this code may help if/when you run into the problem

#!/bin/sh

#  FixGitLabCSS.sh
#
#  This script will fix CSS and GUI related issues.
#
#  Created by David Kittell on 11/2/16.
#

clear

if [ -z ${1+x} ]; then
    echo -e "NOTE: Running this script will temporarily disable GitLab and boot all users out.\nAre you sure you want to do this? [y/n]"
    read sAcceptResponsibility
else
    declare sAcceptResponsibility=$1
fi

case $sAcceptResponsibility in
    'y')
        echo 'Running Initial GitLab CSS Fix'
        sudo gitlab-ctl reconfigure

        echo 'Done running Initial GitLab CSS Fix, did that fix the problem? [y/n]'
        read sFixedStatus

        case $sFixedStatus in
            'y')
                echo 'Closing shell script'
                ;;
            'n')
                echo 'Running Secondary GitLab CSS Fix'
                sudo gitlab-rake cache:clear
                sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads
                sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
                sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
                sudo chown -R git:git /var/opt/gitlab/git-data/repositories
                sudo gitlab-ctl restart
                sudo gitlab-ctl reconfigure

                echo 'Done running Secondary GitLab CSS Fix, did that fix the problem? [y/n]'
                read sFixedStatus1

                case $sFixedStatus1 in
                    'y')
                        echo 'Closing shell script'
                        ;;
                    'n')
                        echo 'Restarting Server'
                        sudo shutdown -r now
                        ;;
                    esac
                ;;
        esac
        ;;
    *)
        echo 'Closing shell script without running GitLab CSS Fix'
        ;;
esac
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.