Reload kernel parameters to prevent PostgreSQL start failure on Debian Jessie caused by to low shmmax
I try to install GiLab CE 7.10.1~omnibus.3-1 on Debian Jessie (in a LXC container) but i get this error:
==> /var/log/gitlab/postgresql/current <==
2015-05-05_10:34:15.28106 FATAL: could not create shared memory segment: Invalid argument
2015-05-05_10:34:15.28108 DETAIL: Failed system call was shmget(key=5432001, size=4299137024, 03600).
2015-05-05_10:34:15.28108 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 4299137024 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
2015-05-05_10:34:15.28108 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.
2015-05-05_10:34:15.28109 The PostgreSQL documentation contains more information about shared memory configuration.
2015-05-05_10:34:16.39890 FATAL: could not create shared memory segment: Invalid argument
2015-05-05_10:34:16.39892 DETAIL: Failed system call was shmget(key=5432001, size=4299137024, 03600).
2015-05-05_10:34:16.39892 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 4299137024 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
2015-05-05_10:34:16.39892 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.
2015-05-05_10:34:16.39892 The PostgreSQL documentation contains more information about shared memory configuration.
A kernel parameters configuration /etc/sysctl.d/90-postgresql.conf are created during the installation process but not loaded.
cat /proc/sys/kernel/shmmax
33554432
Since PostgreSQL is configured to use 1/4 of memory the start will fail: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/attributes/default.rb#L233
A solution for this issue should be to load the new configuration by adding
command "/sbin/sysctl -p /etc/sysctl.d/90-postgresql.conf"
to postgresql.rb on line 66, similar as in line 79: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/recipes/postgresql.rb#L66