I have my own instance of GitLab running on a server. I noticed that GitLab uses Nginx as a server but our web apps run on Apache, so I set up Apache alongside it and it was running great. I changed the port on Apache to 8000 and set up my virtual hosts and everything. Yesterday I updated the MySQL from version 8.x to MariaDB. The issue comes in that the Apache server didn't log any of my errors to the error_log file so I changed the permissions, but now after doing that I got an error on GitLab that said that GitLab had a problem loading my repositories. I checked the /var/log/gitlab/gitlab-rails/production_json.log and found no issues. I tried to reconfigure and was met with more errors like
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Command execution failed. STDOUT/STDERR suppressed for sensitive resource
Now I installed a new instance on a Debian server and it works fine, but when I copy the files from the other server to this one I can't reconfigure or anything. Is there anything I can do or is it beyond repair and if it is beyond repair, is there any way I can get my backed up repositories back into a new instance? I did copy the repo files in /var/opt/gitlab/git-data/repositories over to the new instance, but to no avail. It doesn't show my repos there.
When I ran the gitlab-rake db:migrate:status command this is what I got:
Errno::EACCES: Permission denied @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/log/application_json.log
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/logger.rb:36:in `new'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/logger.rb:36:in `build'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/multi_destination_logger.rb:10:in `block in debug'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/multi_destination_logger.rb:10:in `each'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/multi_destination_logger.rb:10:in `debug'
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/active_record_lifecycle.rb:12:in `block (2 levels) in <top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/active_record_lifecycle.rb:7:in `block in <top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/cluster/lifecycle_events.rb:77:in `on_worker_start'
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/active_record_lifecycle.rb:6:in `<top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:7:in `<top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate:status => db:load_config => environment
(See full trace by running task with --trace
CodePudding user response:
I got it fixed.
1. sudo -u git mkdir -p /var/opt/gitlab/git-data/repository-import-$(date " %Y-%m-%d")
2. sudo cp -r /backup/gitlab/git-data/repositories/@hashed/ /var/opt/gitlab/git-data/repository-import-$(date " %Y-%m-%d)
3. sudo chown -R git:root /var/opt/gitlab/git-data/
4. sudo gitlab-rake gitlab:import:repos["/var/opt/gitlab/git-data/repository-import-$(date " %Y-%m-%d")/ruben/intranet"]
5. sudo rm -rf /var/opt/gitlab/git-data/repository-import-$(date " %Y-%m-%d")/
6. Repeat for as many repos as necessary
Sample output:
* Created ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d (/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d)
This just doesn't get your issues back. If anyone knows where all the data for the repositories are, please let me know.
CodePudding user response:
Most GitLab commands are executed as root, as illustrated in issues 4264.
Try
sudo gitlab-rake db:migrate:status