troubleshooting.md 2.52 KB
Newer Older
1 2 3 4 5 6
# Troubleshooting

This is to troubleshoot https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/245
But it might contain useful commands for other cases as well.

The configuration to add the postgres log in vim is:
7
postgresql['log_directory'] = '/var/log/gitlab/postgresql'
8 9 10

# Commands

11 12 13
```bash
sudo docker build --tag gitlab_image docker/

14
sudo docker rm -f gitlab_app
15 16 17 18
sudo docker rm -f gitlab_data

sudo docker run --name gitlab_data gitlab_image /bin/true

Sytse Sijbrandij's avatar
Sytse Sijbrandij committed
19
sudo docker run -ti --rm --volumes-from gitlab_data ubuntu apt-get update && sudo apt-get install -y vim && sudo vim /etc/gitlab/gitlab.rb
20

21
sudo docker run --detach --name gitlab_app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab_image
22 23 24

sudo docker run -t --rm --volumes-from gitlab_data ubuntu tail -f /var/log/gitlab/reconfigure.log

25
sudo docker run -t --rm --volumes-from gitlab_data ubuntu tail -f /var/log/gitlab/postgresql/current
26

27 28 29
sudo docker run -t --rm --volumes-from gitlab_data ubuntu cat /var/opt/gitlab/postgresql/data/postgresql.conf | grep shared_buffers

sudo docker run -t --rm --volumes-from gitlab_data ubuntu cat /etc/gitlab/gitlab.rb
30 31 32 33 34 35 36 37 38 39
```

# Interactively

```bash
# First start a GitLab container without starting GitLab
# This is almost the same as starting the GitLab container except:
# - we run interactively (-t -i)
# - we define TERM=linux because it allows to use arrow keys in vi (!!!)
# - we choose another startup command (bash)
40
sudo docker run -ti -e TERM=linux --name gitlab_app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab_image bash
41 42 43 44

# Configure GitLab to redirect PostgreSQL logs
echo "postgresql['log_directory'] = '/var/log/gitlab/postgresql'" >> /etc/gitlab/gitlab.rb

45
# Prevent Postgres from allocating 25% of total memory
46
echo "postgresql['shared_buffers'] = '1MB'" >> /etc/gitlab/gitlab.rb
47

48
# You can now start GitLab manually from Bash (in the background)
49
# Maybe the command below is still missing something to run in the background
50 51
gitlab-ctl reconfigure > /var/log/gitlab/reconfigure.log & /opt/gitlab/embedded/bin/runsvdir-start &

52 53 54
# Inspect PostgreSQL config
cat /var/opt/gitlab/postgresql/data/postgresql.conf | grep shared_buffers

55 56 57 58 59
# And tail the logs (PostgreSQL log may not exist immediately)
tail -f /var/log/gitlab/reconfigure.log /var/log/gitlab/postgresql/current

# And get the memory
cat /proc/meminfo
60 61 62
head /proc/sys/kernel/shmmax /proc/sys/kernel/shmall
free -m

63
```
64

65 66
# Cleanup

67 68 69 70 71 72 73
Remove ALL docker containers and images (also non GitLab ones):

```
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
```