Skip to content
Snippets Groups Projects

Add local project uploads cleanup task

Merged Michael Kozono requested to merge mk/add-local-project-uploads-cleanup-task into master
Files
4
+ 27
0
@@ -22,3 +22,30 @@ sudo gitlab-rake gitlab:cleanup:repos
@@ -22,3 +22,30 @@ sudo gitlab-rake gitlab:cleanup:repos
# installation from source
# installation from source
bundle exec rake gitlab:cleanup:repos RAILS_ENV=production
bundle exec rake gitlab:cleanup:repos RAILS_ENV=production
```
```
 
 
Remove local project upload files if they don't exist in GitLab database.
 
 
```
 
# omnibus-gitlab
 
sudo gitlab-rake gitlab:cleanup:project_uploads
 
 
# installation from source
 
bundle exec rake gitlab:cleanup:project_uploads RAILS_ENV=production
 
```
 
 
Example output:
 
 
```
 
$ sudo gitlab-rake gitlab:cleanup:project_uploads
 
I, [2018-07-27T12:08:28.671559 #89817] INFO -- : Looking for orphaned project uploads to remove. Dry run...
 
E, [2018-07-27T12:08:28.689869 #89817] ERROR -- : Skipping... Unable to parse project upload path: "/opt/gitlab/embedded/service/gitlab-rails/public/uploads/test.out"
 
I, [2018-07-27T12:08:28.755624 #89817] INFO -- : Can be removed: /opt/gitlab/embedded/service/gitlab-rails/public/uploads/foo/bar/89a0f7b0b97008a4a18cedccfdcd93fb/foo.txt
 
I, [2018-07-27T12:08:28.760257 #89817] INFO -- : Can be removed: /opt/gitlab/embedded/service/gitlab-rails/public/uploads/foo/bar/1dd6f0f7eefd2acc4c2233f89a0f7b0b/image.png
 
I, [2018-07-27T12:08:28.764470 #89817] INFO -- : To cleanup these files run this command with REMOVE=true
 
 
$ sudo gitlab-rake gitlab:cleanup:project_uploads REMOVE=true
 
I, [2018-07-27T12:09:24.944414 #89936] INFO -- : Looking for orphaned project uploads to remove...
 
E, [2018-07-27T12:09:24.962321 #89936] ERROR -- : Skipping... Unable to parse project upload path: "/opt/gitlab/embedded/service/gitlab-rails/public/uploads/test.out"
 
I, [2018-07-27T12:09:25.040912 #89936] INFO -- : Removed: /opt/gitlab/embedded/service/gitlab-rails/public/uploads/foo/bar/89a0f7b0b97008a4a18cedccfdcd93fb/foo.txt
 
I, [2018-07-27T12:09:25.044637 #89936] INFO -- : Removed: /opt/gitlab/embedded/service/gitlab-rails/public/uploads/foo/bar/1dd6f0f7eefd2acc4c2233f89a0f7b0b/image.png
 
```
 
\ No newline at end of file
Loading