Using live code reload and debug mode - reanahub/reana GitHub Wiki
Contents
- About
- Create cluster in debug mode
- Build cluster in debug mode
- Using debug mode
- Next steps
About
We know how to build and deploy REANA cluster from unreleased sources locally. This page shows how to deploy cluster with source code "mounted" in the cluster itself, so that we can perform code changes "live" and see the effects immediately inside the cluster.
Create cluster in debug mode
The reana-dev cluster-create helper command contains a mode option that
allows to deploy the cluster in various modes. We are concerned with --mode debug option here:
(reana) $ reana-dev cluster-create -m /var/reana:/var/reana --mode debug
This will mount the source code directory into the cluster.
Build cluster in debug mode
Similarly, you can build the cluster with -b DEBUG=1 argument to switch
debugging on. This variable is checked in the Dockerfile of cluster
components, and, when switched on, will install component source in editable
mode. This is basically doing pip install -e . behind the scenes, which
allows for live code modifications.
(reana) $ reana-dev cluster-build --mode debug
As for the production-like mode, it is possible to build multiple Docker images in parallel:
(reana) $ reana-dev cluster-build --mode debug --parallel 8
Most of the time, you do not need the following 3 images during development: r-a-krb5,r-a-vomsproxy,r-a-rucio. Therefore, you can exclude them when building the cluster.
(reana) $ reana-dev cluster-build --exclude-components=r-a-krb5,r-a-vomsproxy,r-a-rucio --mode debug --parallel 8
Deploy REANA in debug mode
After the cluster is built, we can deploy REANA as follows:
(reana) $ reana-dev cluster-deploy --admin-email [email protected] --admin-password mysecretpassword --mode debug
If you are making changes to components that do not run in the cluster but are executed locally on your computer, such as reana-client, you can enable live code reload by installing them in editable mode:
(reana) $ pip install -e ./reana-client
Using debug mode
That's all! If you'd like to start stepping through the code to confirm whether you can live-reload and debug code, please see the dedicated Debugging page.
Next steps
Congratulations! You have successfully installed REANA from sources, be it in production mode or in debug mode. You may now start your REANA developer journey.
If you are part of REANA CERN team, dedicated person from the team will help you with your first task.
If you are an external contributor, check one of the "good first issues".