{"id":986,"date":"2017-07-24T12:55:25","date_gmt":"2017-07-24T10:55:25","guid":{"rendered":"http:\/\/dety.net.ua\/?p=986"},"modified":"2017-07-24T12:55:25","modified_gmt":"2017-07-24T10:55:25","slug":"gitlab-maintenance","status":"publish","type":"post","link":"https:\/\/dety.net.ua\/?p=986","title":{"rendered":"Gitlab + maintenance"},"content":{"rendered":"<h1 id=\"maintenance-rake-tasks\">Maintenance Rake Tasks<\/h1>\n<h2 id=\"gather-information-about-gitlab-and-the-system-it-runs-on\">Gather information about GitLab and the system it runs on<\/h2>\n<p>This command gathers information about your GitLab installation and the System it runs on. These may be useful when asking for help or reporting issues.<\/p>\n<p>Source: <a href=\"https:\/\/docs.gitlab.com\/ce\/administration\/raketasks\/maintenance.html\">https:\/\/docs.gitlab.com\/ce\/administration\/raketasks\/maintenance.html<\/a><\/p>\n<p><strong>Omnibus Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>sudo gitlab-rake gitlab:env:info\r\n<\/code><\/pre>\n<\/div>\n<p><strong>Source Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>bundle exec rake gitlab:env:info RAILS_ENV=production\r\n<\/code><\/pre>\n<\/div>\n<p>Example output:<\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>System information\r\nSystem:           Debian 7.8\r\nCurrent User:     git\r\nUsing RVM:        no\r\nRuby Version:     2.1.5p273\r\nGem Version:      2.4.3\r\nBundler Version:  1.7.6\r\nRake Version:     10.3.2\r\nRedis Version:    3.2.5\r\nSidekiq Version:  2.17.8\r\n\r\nGitLab information\r\nVersion:          7.7.1\r\nRevision:         41ab9e1\r\nDirectory:        \/home\/git\/gitlab\r\nDB Adapter:       postgresql\r\nURL:              https:\/\/gitlab.example.com\r\nHTTP Clone URL:   https:\/\/gitlab.example.com\/some-project.git\r\nSSH Clone URL:    git@gitlab.example.com:some-project.git\r\nUsing LDAP:       no\r\nUsing Omniauth:   no\r\n\r\nGitLab Shell\r\nVersion:          2.4.1\r\nRepositories:     \/home\/git\/repositories\/\r\nHooks:            \/home\/git\/gitlab-shell\/hooks\/\r\nGit:              \/usr\/bin\/git\r\n<\/code><\/pre>\n<\/div>\n<h2 id=\"check-gitlab-configuration\">Check GitLab configuration<\/h2>\n<p>Runs the following rake tasks:<\/p>\n<ul>\n<li><code>gitlab:gitlab_shell:check<\/code><\/li>\n<li><code>gitlab:sidekiq:check<\/code><\/li>\n<li><code>gitlab:app:check<\/code><\/li>\n<\/ul>\n<p>It will check that each component was setup according to the installation guide and suggest fixes for issues found.<\/p>\n<p>You may also have a look at our <a href=\"https:\/\/github.com\/gitlabhq\/gitlab-public-wiki\/wiki\/Trouble-Shooting-Guide\">Trouble Shooting Guide<\/a>.<\/p>\n<p><strong>Omnibus Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>sudo gitlab-rake gitlab:check\r\n<\/code><\/pre>\n<\/div>\n<p><strong>Source Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>bundle exec rake gitlab:check RAILS_ENV=production\r\n<\/code><\/pre>\n<\/div>\n<p>NOTE: Use SANITIZE=true for gitlab:check if you want to omit project names from the output.<\/p>\n<p>Example output:<\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>Checking Environment ...\r\n\r\nGit configured for git user? ... yes\r\nHas python2? ... yes\r\npython2 is supported version? ... yes\r\n\r\nChecking Environment ... Finished\r\n\r\nChecking GitLab Shell ...\r\n\r\nGitLab Shell version? ... OK (1.2.0)\r\nRepo base directory exists? ... yes\r\nRepo base directory is a symlink? ... no\r\nRepo base owned by git:git? ... yes\r\nRepo base access is drwxrws---? ... yes\r\npost-receive hook up-to-date? ... yes\r\npost-receive hooks in repos are links: ... yes\r\n\r\nChecking GitLab Shell ... Finished\r\n\r\nChecking Sidekiq ...\r\n\r\nRunning? ... yes\r\n\r\nChecking Sidekiq ... Finished\r\n\r\nChecking GitLab ...\r\n\r\nDatabase config exists? ... yes\r\nDatabase is SQLite ... no\r\nAll migrations up? ... yes\r\nGitLab config exists? ... yes\r\nGitLab config outdated? ... no\r\nLog directory writable? ... yes\r\nTmp directory writable? ... yes\r\nInit script exists? ... yes\r\nInit script up-to-date? ... yes\r\nRedis version &gt;= 2.0.0? ... yes\r\n\r\nChecking GitLab ... Finished\r\n<\/code><\/pre>\n<\/div>\n<h2 id=\"rebuild-authorized_keys-file\">Rebuild authorized_keys file<\/h2>\n<p>In some case it is necessary to rebuild the <code>authorized_keys<\/code> file.<\/p>\n<p><strong>Omnibus Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>sudo gitlab-rake gitlab:shell:setup\r\n<\/code><\/pre>\n<\/div>\n<p><strong>Source Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>cd \/home\/git\/gitlab\r\nsudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production\r\n<\/code><\/pre>\n<\/div>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>This will rebuild an authorized_keys file.\r\nYou will lose any data stored in authorized_keys file.\r\nDo you want to continue (yes\/no)? yes\r\n<\/code><\/pre>\n<\/div>\n<h2 id=\"clear-redis-cache\">Clear redis cache<\/h2>\n<p>If for some reason the dashboard shows wrong information you might want to clear Redis&#8217; cache.<\/p>\n<p><strong>Omnibus Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>sudo gitlab-rake cache:clear\r\n<\/code><\/pre>\n<\/div>\n<p><strong>Source Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>cd \/home\/git\/gitlab\r\nsudo -u git -H bundle exec rake cache:clear RAILS_ENV=production\r\n<\/code><\/pre>\n<\/div>\n<h2 id=\"precompile-the-assets\">Precompile the assets<\/h2>\n<p>Sometimes during version upgrades you might end up with some wrong CSS or missing some icons. In that case, try to precompile the assets again.<\/p>\n<p>Note that this only applies to source installations and does NOT apply to Omnibus packages.<\/p>\n<p><strong>Source Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>cd \/home\/git\/gitlab\r\nsudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production\r\n<\/code><\/pre>\n<\/div>\n<p>For omnibus versions, the unoptimized assets (JavaScript, CSS) are frozen at the release of upstream GitLab. The omnibus version includes optimized versions of those assets. Unless you are modifying the JavaScript \/ CSS code on your production machine after installing the package, there should be no reason to redo rake gitlab:assets:compile on the production machine. If you suspect that assets have been corrupted, you should reinstall the omnibus package.<\/p>\n<h2 id=\"tracking-deployments\">Tracking Deployments<\/h2>\n<p>GitLab provides a Rake task that lets you track deployments in GitLab Performance Monitoring. This Rake task simply stores the current GitLab version in the GitLab Performance Monitoring database.<\/p>\n<p><strong>Omnibus Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>sudo gitlab-rake gitlab:track_deployment\r\n<\/code><\/pre>\n<\/div>\n<p><strong>Source Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>cd \/home\/git\/gitlab\r\nsudo -u git -H bundle exec rake gitlab:track_deployment RAILS_ENV=production\r\n<\/code><\/pre>\n<\/div>\n<h2 id=\"create-or-repair-repository-hooks-symlink\">Create or repair repository hooks symlink<\/h2>\n<p>If the GitLab shell hooks directory location changes or another circumstance leads to the hooks symlink becoming missing or invalid, run this Rake task to create or repair the symlinks.<\/p>\n<p><strong>Omnibus Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>sudo gitlab-rake gitlab:shell:create_hooks\r\n<\/code><\/pre>\n<\/div>\n<p><strong>Source Installation<\/strong><\/p>\n<div class=\"highlight\">\n<pre class=\"highlight plaintext\"><code>cd \/home\/git\/gitlab\r\nsudo -u git -H bundle exec rake gitlab:shell:create_hooks RAILS_ENV=production<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Maintenance Rake Tasks Gather information about GitLab and the system it runs on This command gathers information about your GitLab installation and the System it runs on. These may be useful when asking for help or reporting issues. Source: https:\/\/docs.gitlab.com\/ce\/administration\/raketasks\/maintenance.html Omnibus Installation sudo gitlab-rake gitlab:env:info Source Installation bundle exec rake gitlab:env:info RAILS_ENV=production Example output: System [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-986","post","type-post","status-publish","format-standard","hentry","category-novosti"],"_links":{"self":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/986","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=986"}],"version-history":[{"count":1,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/986\/revisions"}],"predecessor-version":[{"id":987,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/986\/revisions\/987"}],"wp:attachment":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}