Local builder installation

In this section there are commands to follow.

During development, it can be useful to have a short build cycle where you can build your package after modifying files. That is the goal of the redpesk “local builder”. We will use it to speed up our own developments.

Local builder

In this part, we will install and use the local builder to devel our custom binding. If you would like further information about the local builder, please follow this link

Installation

wget https://github.com/redpesk-devtools/redpesk-sdk-tools/raw/master/install-redpesk-localbuilder.sh
bash ./install-redpesk-localbuilder.sh create -c ${your_container_name}

You will be prompted for your host’s root password to perform the LXD installation.

At the end of the script, you will also be asked for an optional host directory that you want to have access to within the container.

Depending of your host’s distribution, you may need to relaunch the script after a reboot.

At the end of this script, the URL of the local builder will be given. This URL will be necessary during rp-cli configuration in the next part.

If something went wrong, the following command can be useful:

./install-redpesk-localbuilder.sh clean -c ${your_container_name}

Local builder connection with rp-cli

rp-cli is the redpesk command line interface. You can find further information about rp-cli in the chapter Concepts.

If you did not install rp-cli yet, please use the following line:

wget https://raw.githubusercontent.com/redpesk-devtools/redpesk-sdk-tools/master/install-redpesk-sdk.sh
bash install-redpesk-sdk.sh --rp-cli

Then, configure rp-cli by using the following command:

rp-cli onboard

In this case, configure the redpesk local-builder connection with the container’s URL we obtained in the last part:

rp-cli onboard
Do you want to configure the redpesk backend connection? (Y/n)
> n


Do you want to configure the redpesk local-builder connection? (Y/n)
> Y

-- Local builder link configuration requested by user --

Current available connections: [NONE]

Please enter the URL of the local builder you want to interact with, then press enter:
> http://10.231.232.228 #Give the URL you obtained before
Modification of the local builder file...   [OK]

Note that rp-cli onboard is an helper for other rp-cli commands. You can also achieve similar results with rp-cli connections to manage connections to redpesk factory and rp-cli local connections to manage connections to your local builder.

Adding the sources

In order to work correctly with the local builder, rp-cli needs to know where the gitsources/ and gitpkgs/ directories are located on the host. These directories are mounted in the local builder and contains respectively the sources and the archives of the user applications.

The following commands set the right sourcesdir and pkgsdir parameters for rp-cli if the default paths have been used during the local builder installation. If other paths have been used, please change the command lines accordingly.

# Give the path to gitsources/ on the host to rp-cli
rp-cli misc configuration set sourcesdir --value "~/my_rp_builder_dir/gitsources"

# Give the path to gitpkgs/ on the host to rp-cli
rp-cli misc configuration set pkgsdir --value "~/my_rp_builder_dir/gitpkgs"

Now that rp-cli knows where the sources are, use the following command to clone them in the right path.

The flag –repo-rev is here to precise which branch of the project we want to use.

rp-cli local package init anemometer-industrial-demo --project industrial-demo-project --repo-rev "master"

You can now work on your sources natively in the path ~/my_rp_builder_dir/gitsources.