PG::ConnectionBad: could not connect to server: No such file or directory

Hello,
I was just trying to install the latest update of gitlab-ce (8.11.7-ce.0) but I get an error saying that:

  * execute[create gitlab database user] action run
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    [execute] psql: could not connect to server: No such file or directory
                Is the server running locally and accepting
                connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    
    ================================================================================
    Error executing action `run` on resource 'execute[create gitlab database user]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '2'
    ---- Begin output of /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER gitlab" ----
    STDOUT: 
    STDERR: psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    ---- End output of /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER gitlab" ----
    Ran /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER gitlab" returned 2
    
    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/postgresql.rb
    
    152:   execute "create #{gitlab_sql_user} database user" do
    153:     command "/opt/gitlab/bin/gitlab-psql -d template1 -c \"CREATE USER #{gitlab_sql_user}\""
    154:     user postgresql_user
    155:     # Added retries to give the service time to start on slower systems
    156:     retries 20
    157:     not_if { !pg_helper.is_running? || pg_helper.user_exists?(gitlab_sql_user) }
    158:   end
    159: 
    
    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/postgresql.rb:152:in `from_file'
    
    execute("create gitlab database user") do
      action [:run]
      retries 20
      retry_delay 2
      default_guard_interpreter :execute
      command "/opt/gitlab/bin/gitlab-psql -d template1 -c \"CREATE USER gitlab\""
      backup 5
      returns 0
      user "gitlab-psql"
      declared_type :execute
      cookbook_name "gitlab"
      recipe_name "postgresql"
      not_if { #code block }
    end
    
    Platform:
    ---------
    x86_64-linux

When I try to restart gitlab via gitlab-ctl restart it says everything is fine but as soon as I check the status again it displays postgresql as down.
Now when I check the log I get:

gitlab-ctl tail postgresql                                                                                                                                                                                        /etc/gitlab
==> /var/log/gitlab/postgresql/current <==
2016-09-21_17:30:18.76955 FATAL:  could not create shared memory segment: Invalid argument
2016-09-21_17:30:18.76956 DETAIL:  Failed system call was shmget(key=5432001, size=176701440, 03600).
2016-09-21_17:30:18.76956 HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMMAX.  To reduce the request size (currently 176701440 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
2016-09-21_17:30:18.76957       If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
2016-09-21_17:30:18.76957       The PostgreSQL documentation contains more information about shared memory configuration.
2016-09-21_17:30:19.80657 FATAL:  could not create shared memory segment: Invalid argument
2016-09-21_17:30:19.80659 DETAIL:  Failed system call was shmget(key=5432001, size=176701440, 03600).
2016-09-21_17:30:19.80659 HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMMAX.  To reduce the request size (currently 176701440 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
2016-09-21_17:30:19.80660       If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
2016-09-21_17:30:19.80661       The PostgreSQL documentation contains more information about shared memory configuration.

But as far as I can tell I didn’t make any changes to these parameters. In my gitlab.rb it looks like this:

postgresql['shared_buffers'] = "150MB"
postgresql['shmmax'] = 121266176
postgresql['shmall'] = 1048575

and my SHMMAX value according to the /etc/sysctl.conf is kernel.shmmax=121266176

I googled and found many tutorials saying that I have to change this SHMḾAX value but for me it does look alright? And even if I raise it or lower the one in gitlab I get the same error after running gitlab-rake db:migrate RAILS_ENV=production.
Does anyone have an idea what might cause this and how I can fix it?