Skip to content

Can't connect to remote gitaly

Overview

I was trying to connect to a remote instance of gitaly from my dev environment. I have some very large repos I'm hosting and I didn't want to replicate them locally if I can avoid it. I was able to make it work by editing gitlab.yml manually.

gdk.yml:

gdk:
  protected_config_files:
    - 'gitlab/config/database.yml'
object_store:                                                                                                                                                                                                                                                  
  connection:                                                                                                                                                                                                                                                  
    provider: AWS                                                                                                                                                                                                                                              
    aws_access_key_id: XXXX                                                                                                                                                                                                                                    
    aws_secret_access_key: ZZZZ                                                                                                                                                                                                                                
    region: xxxx                                                                                                                                                                                                                                               
  enabled: true                                                                                                                                                                                                                                                
  host: 127.0.0.1                                                                                                                                                                                                                                              
  port: 9000                                                                                                                                                                                                                                                   
  uploads:                                                                                                                                                                                                                                                     
    bucket: uploads                                                                                                                                                                                                                                            
  lfs:                                                                                                                                                                                                                                                         
    bucket: lfs                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                               
gitaly:                                                                                                                                                                                                                                                        
  enabled: true                                                                                                                                                                                                                                                
  address: tcp://remote_ip                                                                                                                                                                                                                                     
  port: 8075                                                                                                                                                                                                                                                   
  auth_token: mytoken                                                                                                                                                                                                                                          
praefect:                                                                                                                                                                                                                                                      
  enabled: false 

After running gdk reconfigure

The resulting gitlab.yml didn't have the correct setting for gitlay

  • The repositories.storages.default.gitaly_address was prefixed with unix: - unix:tcp://remote_ip
  • port was not appended to the remote address
  • gitaly.token was empty
  • repositories.storages.default.auth_token was empty
  • manually setting repositories.storages.default.auth_token, doesn't seem to work, I had to use global gitaly.token

generated gitlab.yml:

  gitaly:                                                                                                                                                                                                                                                      
    # Path to the directory containing Gitaly client executables.                                                                                                                                                                                              
    client_path: /vagrant/gitaly/bin                                                                                                                                                                                                                           
    # Default Gitaly authentication token. Can be overridden per storage. Can                                                                                                                                                                                  
    # be left blank when Gitaly is running locally on a Unix socket, which                                                                                                                                                                                     
    # is the normal way to deploy Gitaly.                                                                                                                                                                                                                      
    token:                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                               
  #                                                                                                                                                                                                                                                            
  # 4. Advanced settings                                                                                                                                                                                                                                       
  # ==========================                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                               
  ## Repositories settings                                                                                                                                                                                                                                     
  repositories:                                                                                                                                                                                                                                                
    # Paths where repositories can be stored. Give the canonicalized absolute pathname.                                                                                                                                                                        
    # IMPORTANT: None of the path components may be symlink, because                                                                                                                                                                                           
    # gitlab-shell invokes Dir.pwd inside the repository path and that results                                                                                                                                                                                 
    # real path not the symlink.                                                                                                                                                                                                                               
    storages: # You must have at least a `default` storage path.                                                                                                                                                                                               
    ⦙ default:                                                                                                                                                                                                                                                 
    ⦙   ## Path should be local                                                                                                                                                                                                                                
    ⦙   path: /vagrant/repositories                                                                                                                                                                                                                            
    ⦙   gitaly_address: unix:tcp://remote_ip                                                                                                                                                                                                                   
    ⦙   auth_token:      

Steps to replicate (optional)

Try to point a local development environment to remote gitaly server.

Environment (optional)

  • Operating system: Linux running gdk under vagrant
  • The contents of your gdk.yml
  • Ruby version: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
  • GDK version: 5eb92e2da3c