2014-12-02 09:19:43 -05:00
|
|
|
# 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:
|
2014-12-02 10:57:52 -05:00
|
|
|
postgresql['log_directory'] = '/var/log/gitlab/postgresql'
|
2014-12-02 09:19:43 -05:00
|
|
|
|
|
|
|
# Commands
|
|
|
|
|
2014-12-02 11:16:46 -05:00
|
|
|
```bash
|
2015-06-29 11:56:34 -04:00
|
|
|
sudo docker build --tag gitlab/gitlab-ce:latest docker/
|
2014-12-02 11:16:46 -05:00
|
|
|
|
2015-06-29 11:56:34 -04:00
|
|
|
sudo docker rm -f gitlab
|
2014-12-02 09:19:43 -05:00
|
|
|
|
2015-06-29 11:56:34 -04:00
|
|
|
sudo docker exec -it gitlab vim /etc/gitlab/gitlab.rb
|
2014-12-02 09:19:43 -05:00
|
|
|
|
2015-06-29 11:56:34 -04:00
|
|
|
sudo docker exec gitlab tail -f /var/log/gitlab/reconfigure.log
|
2014-12-02 09:19:43 -05:00
|
|
|
|
2015-06-29 11:56:34 -04:00
|
|
|
sudo docker exec gitlab tail -f /var/log/gitlab/postgresql/current
|
2014-12-02 09:19:43 -05:00
|
|
|
|
2015-06-29 11:56:34 -04:00
|
|
|
sudo docker exec gitlab cat /var/opt/gitlab/postgresql/data/postgresql.conf | grep shared_buffers
|
2014-12-02 09:19:43 -05:00
|
|
|
|
2015-06-29 11:56:34 -04:00
|
|
|
sudo docker exec gitlab cat /etc/gitlab/gitlab.rb
|
2014-12-02 11:16:46 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
# 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)
|
2015-06-29 11:56:34 -04:00
|
|
|
sudo docker run --ti \
|
|
|
|
-e TERM=linux
|
|
|
|
--publish 80443:443 --publish 8080:80 --publish 2222:22 \
|
|
|
|
--name gitlab \
|
|
|
|
--restart always \
|
|
|
|
--volume /srv/gitlab/config:/etc/gitlab \
|
|
|
|
--volume /srv/gitlab/logs:/var/log/gitlab \
|
|
|
|
--volume /srv/gitlab/data:/var/opt/gitlab \
|
|
|
|
gitlab/gitlab-ce:latest \
|
|
|
|
bash
|
2014-12-02 11:16:46 -05:00
|
|
|
|
|
|
|
# Configure GitLab to redirect PostgreSQL logs
|
|
|
|
echo "postgresql['log_directory'] = '/var/log/gitlab/postgresql'" >> /etc/gitlab/gitlab.rb
|
|
|
|
|
2014-12-02 13:25:04 -05:00
|
|
|
# Prevent Postgres from allocating 25% of total memory
|
2014-12-03 06:41:47 -05:00
|
|
|
echo "postgresql['shared_buffers'] = '1MB'" >> /etc/gitlab/gitlab.rb
|
2014-12-02 13:25:04 -05:00
|
|
|
|
2014-12-02 11:16:46 -05:00
|
|
|
# You can now start GitLab manually from Bash (in the background)
|
2014-12-02 13:25:04 -05:00
|
|
|
# Maybe the command below is still missing something to run in the background
|
2014-12-02 11:16:46 -05:00
|
|
|
gitlab-ctl reconfigure > /var/log/gitlab/reconfigure.log & /opt/gitlab/embedded/bin/runsvdir-start &
|
|
|
|
|
2014-12-03 06:41:47 -05:00
|
|
|
# Inspect PostgreSQL config
|
|
|
|
cat /var/opt/gitlab/postgresql/data/postgresql.conf | grep shared_buffers
|
|
|
|
|
2014-12-02 11:16:46 -05:00
|
|
|
# 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
|
2014-12-03 06:41:47 -05:00
|
|
|
head /proc/sys/kernel/shmmax /proc/sys/kernel/shmall
|
|
|
|
free -m
|
|
|
|
|
2014-12-02 11:16:46 -05:00
|
|
|
```
|
2015-05-06 09:32:29 -04:00
|
|
|
|
2015-05-06 10:39:30 -04:00
|
|
|
# Cleanup
|
|
|
|
|
2015-06-29 11:56:34 -04:00
|
|
|
Remove ALL docker containers and images (also non GitLab ones).
|
|
|
|
**Be careful, because the `-v` also removes volumes attached to the images.**
|
2015-05-06 09:32:29 -04:00
|
|
|
|
2015-06-29 11:56:34 -04:00
|
|
|
```bash
|
|
|
|
# Remove all containers with attached volumes
|
|
|
|
docker rm -v $(docker ps -a -q)
|
|
|
|
|
|
|
|
# Remove all images
|
2015-05-06 09:32:29 -04:00
|
|
|
docker rmi $(docker images -q)
|
2015-06-29 11:56:34 -04:00
|
|
|
|
|
|
|
# Remove GitLab persistent data
|
|
|
|
rm -rf /srv/gitlab
|
2015-05-06 09:32:29 -04:00
|
|
|
```
|
|
|
|
|