-
Notifications
You must be signed in to change notification settings - Fork 181
Uyuni development in no time
While we generally advise developers to use sumaform to create development infrastructure (Server, clients, etc), it is not a must and can be a bit difficult to understand at the beginning.
Here is how to get started developing without sumaform, just by manually creating your infrastructure. It's written in an informal tone because it was originally written in answer to a user in Gitter.
What we are going to do is the following:
- Install Uyuni Stable to make sure all the dependencies, database, etc are set up correctly
- Deploy a development version of Uyuni on top of Uyuni Stable
The reason to "prepare" the system first with Uyuni Stable is some of the pattern packages are not built by default for Uyuni development versions. Instead of trying to get those packages built, it's just easier to do this in two steps.
Whenever you make changes in the code and want to try them, you can go directly to step 2 (deploy Uyuni development version), you only need step 1 (deploy Uyuni Stable) once.
The easiest way to install the Uyuni server is to install it in a virtual machine. Here we'll do it with KVM and libvirt... you can do it with another virtualization stack if you know what you are doing.
First thing is to prepare the virtual network. Uyuni server requires a proper DNS setup. Here we will use libvirt's dnsmasq
for this: it will automatically get the DNS entries for all VMs in the virtual network.
Save the following as default-net.xml
:
<network>
<name>default</name>
<forward mode='nat'/>
<bridge name='virbr0' stp='on' delay='0'/>
<domain name='uyuni.lab' localOnly='yes'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
<host mac='2A:C3:A7:A6:00:10' name='dev-srv' ip='192.168.122.10'/>
<bootp file='pxelinux.0' server='192.168.122.10'/>
</dhcp>
</ip>
</network>
Then run the following commands to define and start the network. If the network is already present on your machine, you can edit it and replace the content of it using virsh net-edit default
.
virsh net-define default-net.xml
virsh net-autostart default
virsh net-start default
Since libvirt doesn't allow connections to its dnsmasq from the virtual host, you need to add entries for each host
defined in the network definition in your /etc/hosts
file to resolve the FQDN from your machine.
Something like 192.168.122.10 dev-srv.uyuni.lab dev-srv
would fit the above snippet.
More details can also be found in the specific page: https://github.com/uyuni-project/uyuni/wiki/Libvirt-DNS-and-DHCP-without-Avahi
Sumaform is a developer's tool helping to install the server and optional client virtual machines. It leverages terraform and Salt to create and configure them.
Walk through the sumaform project https://github.com/uyuni-project/sumaform/ to install and use it.
If you didn't install using sumaform, you can install an Uyuni container manually. For this, deploy a virtual machine and follow the instructions on: https://github.com/uyuni-project/uyuni/blob/master/containers/doc/README.md#installing-uyuni
- Fork the Uyuni source code (https://github.com/uyuni-project/uyuni/) into your own repo (e.g. https://github.com//uyuni).
- Clone the Uyuni upstream repository:
git clone [email protected]:uyuni-project/uyuni.git
- Add your own fork as a remote:
git remote add USER [email protected]:<USER>/uyuni.git
- Follow the instructions in http://bosdonnat.fr/slides/openSUSEAsiaSummit19/ to develop.
What I typically do is I always develop locally, submit code to OBS for packages to be created, and then zypper dup --allow-vendor-change --allow-arch-change --allow-name-change --allow-downgrade
on the Uyuni Server. It's a bit slower (I need to wait for OBS to finish) than deploying code directly to the Uyuni Server via SSH but that way I am sure I am always updating all the packages that might have been affected by my changes.