Fix Gitlab won’t start, database system is shut down, failed to load.

When you have issues with GitLab you will want to check the status to see which component of gitlab is not working as expected. Do this using the following command:

sudo gitlab-ctl status

Verify the log files of the component to obtain details about the failure. Log files for Omnibus installation of gitlab are located under.

/var/log/gitlab/

Within this location there are several subfolders that container log files.

You will can to examine the file that is named current for the component.

Example, suppose we are fixing database is shutdown error.

sudo nano /var/log/gitlab/postgresql/current

When we examine this log file we discover there is an issue with reading the cacert.pem file. This is causing the database to be unable to startup.

 FATAL: could not load root certificate file "/opt/gitlab/embedded/ssl/certs/cacert.pem": No such file or directory
 LOG: database system is shut down

If the file is missing then you need to restore it from your backups.

If the file is there the error could be caused by a permission error.

Change the files permission  using the commands below and restart gitlab.

sudo chmod 644 /opt/gitlab/embedded/ssl/certs/cacert.pem
sudo gitlab-ctl restart

Verify that gitlab is started correctly

sudo gitlab-ctl status

 

 

References:

https://forum.gitlab.com/t/postgresql-ssl-certificate-issues/16606

https://about.gitlab.com/2015/04/23/gitlab-7-dot-10-dot-0-omnibus-patch-release/

 

Eclipse Che Get SSH Workspace Public Key

If you are working with a source code versioning system such as github.com or Gitlab you may need to create a private and public keypair in order to clone your repositories within your workspaces.

To achieve this you may use the following command substituting the [CONTAINER ID] for your Eclipse Che workspace instance ID.

First within the Terminal pane of your workspace generate a keypair if one doesn’t already exists using the ‘ssh-keygen’ command.

Once the keypair is created run this command from your docker host.

`$ docker exec [CONTAINER ID] cat /home/user/.ssh/id_rsa.pub`

GitLab Disable Gravatar

You can disable Gravatar in GitLab using the following two methods.

Open the configuration file and add

 

nano /var/opt/gitlab/gitlab-shell/config.yml

 

Add

gravatar.enabled: false

Edit your hosts file

nano /etc/hosts

Add line

127.0.0.1 gravatar.com

Save changes, reboot

 

GitLab 7.x HTTPS Configuration


nano /var/opt/gitlab/nginx/etc/gitlab-http.conf


BEFORE

 

server {

 

   listen *:80;

 

   server_name host.com;

 

   server_tokens off;     # don’t show the version number, a security best practice

 

   root /opt/gitlab/embedded/service/gitlab-rails/public;

 

 

 

 


AFTER

 

server {

 

  listen *:443 ssl;

 

  server_name host.com;

 

  server_tokens off;     # don’t show the version number, a security best practice

 

  root /opt/gitlab/embedded/service/gitlab-rails/public;

 

  ssl_certificate /var/opt/gitlab/nginx/ssl/server.crt;

 

  ssl_certificate_key /var/opt/gitlab/nginx/ssl/server.key;