Categories
OpenStack Tech

OpenStack local git mirror

If you are an OpenStack developer, you will know about devstack1. This deployment tool, used only for testing and development, will retrieve all needed OpenStack projects from a defined git server; by default https://opendev.org2.

The “stacking” process (collect all needed projects, install all dependencies and start the projects as configured) usually takes around 10 minutes. During this process devstack will update the local git repositories, using the default git server as reference. Although you can have a fast network connection, this is even faster if those remote git repositories are in your local network.

And how can we have all needed OpenStack projects locally mirrored? With this: https://github.com/ralonsoh/openstack_git_mirror

This script3 will create a mirror of the repositories listed in git_repos.txt. The repositories will be stored in the same directory of the script and the list file. If a repository is present in the filesystem, it will be updated; if not, I’ll we be downloaded.

The last step is to change the devstack local.conf file to point to your local git mirror:

[local|localrc]] 
GIT_BASE=ssh://(user)@(server_ip):(git_mirror_directory)

Of course you’ll need to update regularly your local mirrors, but this will take less time and bandwidth than downloading the whole repository. You can add a crontab entry in your local server to execute the script periodically:

# Update git repos
30 2 * * * root python /opt/git_mirror/update_git_repos.py

My git mirror server, a brand new Raspberry Pi 4 B with 4 GB4, is pretty fast (1 Gbps connectivity), but the older Raspberry Pi 3 B is enough for this purpose.

Leave a Reply

Your email address will not be published.