Herramientas de usuario

Herramientas del sitio


gentoo:gitlab-ce

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
gentoo:gitlab-ce [2019/10/05 09:37] – [Restore] barrachigentoo:gitlab-ce [2024/05/01 16:57] (actual) – [Upgrade the container] barrachi
Línea 54: Línea 54:
 </code> </code>
  
-To see the logs of the gitlab docker:+To see the logs of a container while it is starting: 
 +<code bash> 
 +docker logs -f CONTAINER_ID 
 +</code> 
 + 
 +To see the logs of the gitlab container:
 <code bash> <code bash>
 docker exec gitlab gitlab-ctl tail docker exec gitlab gitlab-ctl tail
 </code> </code>
  
-To execute a bash inside the gitlab docker:+To execute a bash inside the gitlab container:
 <code bash> <code bash>
 docker exec -it gitlab /bin/bash docker exec -it gitlab /bin/bash
 </code> </code>
  
- +To enter the gitlab-rails console:
-===== NFS caveats ===== +
- +
-The NFS server and client can be fine tuned following the [[https://docs.gitlab.com/ee/administration/high_availability/nfs.html | GitLab NFS documentation]]. +
- +
-If '''/var/opt/gitlab' is not writable'' errors occur (which can be checked with ''docker exec gitlab gitlab-ctl tail''), these can be avoided after starting the gitlab docker by changing the owner of ''/var/opt/gitlab'' to ''git''. Also, the ''noac'' nfs4 mount option should be used on the NFS client to prevent attributes to be cached and, therefore, to allow the previous change to be accounted for as soon as possible. +
- +
-This change can be made permanent, patching ''/opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb'' as follows:: +
- +
-<code diff> +
---- /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb.orig     2019-10-03 13:39:21.826524552 +0000 +
-+++ /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb    2019-10-03 13:41:03.499281744 +0000 +
-@@ -45,6 +45,11 @@ +
-   action :create +
- end +
- +
-+directory "/var/opt/gitlab" do +
-+  owner "git" +
-+  action :create +
-+end +
-+
- directory "Create /var/log/gitlab" do +
-   path "/var/log/gitlab" +
-   owner "root" +
-</code> +
- +
-The '''/var/opt/gitlab' is not writable'' errors are caused when testing if the directory ''/var/opt/gitlab/.bundle'' is writable by the user ''git''. The ''stats()'' function says that is not writable unless its parent is also writable by that user. This can be tested with the following command:+
 <code bash> <code bash>
-docker exec gitlab su git -c "[ -w /var/opt/gitlab/.bundle ] || echo 'no writable'"+docker exec -it gitlab gitlab-rails console
 </code> </code>
  
  
 +More GitLab maintenance options in https://docs.gitlab.com/omnibus/maintenance/
 ===== Upgrade the container ===== ===== Upgrade the container =====
  
-1. Check the digest number of the current version with:+1. Check the current GitLab version x.y.z in the Administration dashboard.
  
-<code bash> 
-docker images --digests | grep gitlab-ce | grep latest | grep sha256: 
-</code> 
  
-2Compare the first digits of the digest number with those of the lastes version in: <https://hub.docker.com/r/gitlab/gitlab-ce/tags>.+2aIf it says that there is an update available, go to https://hub.docker.com/r/gitlab/gitlab-ce/tags and search the latest tag with the next subversion: x.y+1. 
 + 
 +2b. Instead of going by one, check the migration path in https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/?current=14.6.6&distro=docker&edition=ce 
  
-3. If there is a newer version, then pull the new version and continue with the next steps:+3. Copy the pull command an execute it:
  
 <code bash> <code bash>
-docker pull gitlab/gitlab-ce+docker pull gitlab/gitlab-ce:x.y+1.z-ce.0
 </code> </code>
  
-4. If an NFS mount point is used and the '''/var/opt/gitlab' is not writable'' error occurs, then apply the previously shown patch:+4. Optionally, tag the retrieved image as 'my-gitlab-cewith:
  
 <code bash> <code bash>
-# Run the image once using bash as entry point: +docker tag gitlab/gitlab-ce:x.y+1.z-ce.my-gitlab-ce
-docker run -it --entrypoint bash gitlab/gitlab-ce +
-# Apply the previous patch on default.rb: +
-nano /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb +
-# Create new image from ID (it appears in the prompt, e.groot@9ffa2bafe2bb:/#), +
-docker commit 9ffa2bafe2bb my-gitlab-ce+
 </code> </code>
  
-5. Stop and delete the current image, then create and start a new container from the newer image+ 
 +5. Stop and delete the current gitlab container, then create and start a new gitlab container from the newer image:
  
 <code bash> <code bash>
Línea 135: Línea 111:
   --volume /srv/gitlab/logs:/var/log/gitlab \   --volume /srv/gitlab/logs:/var/log/gitlab \
   --volume /srv/gitlab/data:/var/opt/gitlab \   --volume /srv/gitlab/data:/var/opt/gitlab \
-  my-gitlab-ce # or gitlab/gitlab-ce:latest if there are no NFS problems+  my-gitlab-ce # or gitlab/gitlab-ce:x.y+1.z-ce.0
 </code> </code>
  
-6. Cleanup previous images:+6. Check that everything went Ok and monitor on the web interface the background migrations. **When all the background migrations have finished**, go to the Dashboard and check if there is a newer version available. If this is the caso, go again to the second step. 
 + 
 + 
 +7. Cleanup docker unused images, containers, networks and volumes:
  
 <code bash> <code bash>
-docker rmi $(docker images -f "dangling=true" -q)+docker system prune --volumes
 </code> </code>
  
-7. Check that the backup procedure is working with the new version an delete previous versions backups.+7. Check that the backup procedure is working with the new version an delete the previous versions backups. 
 + 
 + 
 +===== PostgreSQL update ===== 
 + 
 +The PostgreSQL version is updated only on some versions of Gitlab. To check which version should be used to perform the PostgreSQL update, please check: https://docs.gitlab.com/omnibus/package-information/postgresql_versions.html 
 + 
 +The tagged docker Gitlab versions can be seen in: https://registry.hub.docker.com/r/gitlab/gitlab-ce/tags 
 + 
 ===== Backup ===== ===== Backup =====
  
Línea 201: Línea 189:
 gitlab-ctl restart gitlab-ctl restart
 gitlab-rake gitlab:check SANITIZE=true gitlab-rake gitlab:check SANITIZE=true
 +</code>
 +
 +
 +
 +===== NFS caveats =====
 +
 +**DO NOT USE NFS WITH GITLAB-CE CONTAINER**
 +
 +If there are permission problems with your NFS configuration, it is better to no use it. What follows show how to avoid one of the problems, but another one raised when migrating from PostgreSQL 11 to 12.
 +
 +**DO NOT USE NFS WITH GITLAB-CE CONTAINER**
 +
 +The NFS server and client can be fine tuned following the [[https://docs.gitlab.com/ee/administration/high_availability/nfs.html | GitLab NFS documentation]].
 +
 +If '''/var/opt/gitlab' is not writable'' errors occur (which can be checked with ''docker exec gitlab gitlab-ctl tail''), these can be avoided after starting the gitlab docker by changing the owner of ''/var/opt/gitlab'' to ''git''. Also, the ''noac'' nfs4 mount option should be used on the NFS client to prevent attributes to be cached and, therefore, to allow the previous change to be accounted for as soon as possible.
 +
 +This change can be made permanent, patching ''/opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb'' as follows::
 +
 +<code diff>
 +--- /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb.orig     2019-10-03 13:39:21.826524552 +0000
 ++++ /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb    2019-10-03 13:41:03.499281744 +0000
 +@@ -45,6 +45,11 @@
 +   action :create
 + end
 +
 ++directory "/var/opt/gitlab" do
 ++  owner "git"
 ++  action :create
 ++end
 ++
 + directory "Create /var/log/gitlab" do
 +   path "/var/log/gitlab"
 +   owner "root"
 +</code>
 +
 +The '''/var/opt/gitlab' is not writable'' errors are caused when testing if the directory ''/var/opt/gitlab/.bundle'' is writable by the user ''git''. The ''stats()'' function says that is not writable unless its parent is also writable by that user. This can be tested with the following command:
 +<code bash>
 +docker exec gitlab su - git -c "[ -w /var/opt/gitlab/.bundle ] || echo 'no writable'"
 +</code>
 +
 +If an NFS mount point is used and the '''/var/opt/gitlab' is not writable'' error occurs, then apply the previously shown patch with:
 +
 +<code bash>
 +# Run the image once using bash as entry point:
 +docker run -it --entrypoint bash gitlab/gitlab-ce
 +# Apply the previous patch on default.rb:
 +nano /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb
 +# Exit the image
 +exit
 +# Create new image from ID (it appears in the prompt, e.g. root@9ffa2bafe2bb:/#),
 +docker commit 9ffa2bafe2bb my-gitlab-ce
 </code> </code>
  
gentoo/gitlab-ce.1570268230.txt.gz · Última modificación: 2019/10/05 09:37 por barrachi