diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-09-22 23:28:42 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-09-22 23:28:42 +0200 |
commit | c199811f473ba084c0605c4beb77c69a60c44e72 (patch) | |
tree | 7b721c2a76871645259fc8da0237c0ee734c7abd | |
parent | 6d9730e07de41736b1e18aed06268834592103e9 (diff) | |
download | gitlab-ce-docker-updates.tar.gz |
Update documentation and update-permissions scriptdocker-updates
-rw-r--r-- | docker/README.md | 11 | ||||
-rwxr-xr-x | docker/assets/update-permissions | 15 | ||||
-rwxr-xr-x | docker/assets/wrapper | 2 | ||||
-rw-r--r-- | docker/troubleshooting.md | 84 |
4 files changed, 25 insertions, 87 deletions
diff --git a/docker/README.md b/docker/README.md index e4d56cdb336..f7486c4b372 100644 --- a/docker/README.md +++ b/docker/README.md @@ -162,7 +162,16 @@ sudo docker push gitlab/gitlab-ce:latest ## Troubleshooting -Please see the [troubleshooting](troubleshooting.md) file in this directory. +### Permission problems + +When updating from older GitLab Docker images you can get permission problems. +This can happen due to fact that users created by docker image are pinned. +There's script that fixes permissions for all files. + +To fix your container, simply execute `update-permissions` script: +``` +sudo docker exec gitlab update-permissions +``` Note: We use `fig.yml` to have compatibility with fig and because docker-compose also supports it. diff --git a/docker/assets/update-permissions b/docker/assets/update-permissions index f0a2d839c95..bbf51134cc3 100755 --- a/docker/assets/update-permissions +++ b/docker/assets/update-permissions @@ -1,8 +1,12 @@ #!/bin/bash +set -x + # Fix GitLab permissions if id -u git; then # Fix data storage + chown -R git:git /var/opt/gitlab/.ssh + chown -R git:git /var/opt/gitlab/.gitconfig chown -R git:git /var/opt/gitlab/git-data chown -R git:git /var/opt/gitlab/gitlab-ci/builds chown -R git:git /var/opt/gitlab/gitlab-git-http-server @@ -10,6 +14,15 @@ if id -u git; then chown -R git:git /var/opt/gitlab/gitlab-shell # Fix log storage + chown git /var/log/gitlab/gitlab-git-http-server + chown git /var/log/gitlab/gitlab-rails + chown git /var/log/gitlab/gitlab-shell + chown git /var/log/gitlab/sidekiq + chown git /var/log/gitlab/unicorn + chown gitlab-psql /var/log/gitlab/postgresql + chown gitlab-redis /var/log/gitlab/redis + + # Update log files chown -R git:git /var/log/gitlab/gitlab-rails/*.log chown -R git:git /var/log/gitlab/gitlab-shell/*.log chown -R git:git /var/log/gitlab/unicorn/*.log @@ -22,7 +35,7 @@ fi # Fix database storage if id -u gitlab-psql; then - chown -R gitlab-psql:gitlab-psql /var/opt/gitlab/gitlab-redis + chown -R gitlab-psql:gitlab-psql /var/opt/gitlab/postgresql fi # Fix redis storage diff --git a/docker/assets/wrapper b/docker/assets/wrapper index de1a1285b39..b141470b25e 100755 --- a/docker/assets/wrapper +++ b/docker/assets/wrapper @@ -16,7 +16,7 @@ if [[ ! -e /etc/gitlab/gitlab.rb ]]; then fi # Remove all services, the reconfigure will create them -rm /opt/gitlab/service/* +rm -f /opt/gitlab/service/* ln -s /opt/gitlab/sv/sshd /opt/gitlab/service # Start service manager diff --git a/docker/troubleshooting.md b/docker/troubleshooting.md deleted file mode 100644 index 63482547daa..00000000000 --- a/docker/troubleshooting.md +++ /dev/null @@ -1,84 +0,0 @@ -# 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: -postgresql['log_directory'] = '/var/log/gitlab/postgresql' - -# Commands - -```bash -sudo docker build --tag gitlab/gitlab-ce:latest docker/ - -sudo docker rm -f gitlab - -sudo docker exec -it gitlab vim /etc/gitlab/gitlab.rb - -sudo docker exec gitlab tail -f /var/log/gitlab/reconfigure.log - -sudo docker exec gitlab tail -f /var/log/gitlab/postgresql/current - -sudo docker exec gitlab cat /var/opt/gitlab/postgresql/data/postgresql.conf | grep shared_buffers - -sudo docker exec gitlab cat /etc/gitlab/gitlab.rb -``` - -# 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) -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 - -# Configure GitLab to redirect PostgreSQL logs -echo "postgresql['log_directory'] = '/var/log/gitlab/postgresql'" >> /etc/gitlab/gitlab.rb - -# Prevent Postgres from allocating 25% of total memory -echo "postgresql['shared_buffers'] = '1MB'" >> /etc/gitlab/gitlab.rb - -# You can now start GitLab manually from Bash (in the background) -# Maybe the command below is still missing something to run in the background -gitlab-ctl reconfigure > /var/log/gitlab/reconfigure.log & /opt/gitlab/embedded/bin/runsvdir-start & - -# Inspect PostgreSQL config -cat /var/opt/gitlab/postgresql/data/postgresql.conf | grep shared_buffers - -# 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 -head /proc/sys/kernel/shmmax /proc/sys/kernel/shmall -free -m - -``` - -# Cleanup - -Remove ALL docker containers and images (also non GitLab ones). -**Be careful, because the `-v` also removes volumes attached to the images.** - -```bash -# Remove all containers with attached volumes -docker rm -v $(docker ps -a -q) - -# Remove all images -docker rmi $(docker images -q) - -# Remove GitLab persistent data -rm -rf /srv/gitlab -``` - |