1. Development Workflows¶
The x/rApp Development Environment described in the Quick Guide section is a great way to quickly and easily start developing x/rApps. In this section, we will explain the different workflows you can use in the development cycle. Before proceeding, you will need to deploy the x/rApp Development Environment and discover its SSH port as explained in the Quick Guide section.
1.1 [RECOMMENDED] Using Visual Studio Code for an integrated development environment¶
You can use Visual Studio Code to get an integrated development environment. Visual Studio Code has the "remote-ssh" extension which lets you connect to a remote ssh host, access the remote files in the user friendly text editor of VS Code, and have a terminal open to the remote host.
1.1.1 Install VS Code¶
You can download the VS Code from: https://code.visualstudio.com/download
1.1.2 Install Remote-SSH in VS Code¶
You need to install the remote-ssh extension in VS Code, and configure it to connect to your x/rApp Development Environment (taking into account the ssh password and port used).
In the left hand menu, select the Extensions tab. Search for Remote-SSH and install the extension.
1.1.3 Adding the xApp Dev Environment as new SSH host¶
Next, click F1 on the keyboard to open the Command Palette (or VSCode -> View -> Command Palette). Now start typing "remote-ssh add new" and select the option that appears: "Remote-SSH: Add New SSH Host…".
Follow the instruction to enter the ssh command:
ssh -p <xapp-dev-ssh> xapp@<drax-ip-address>
You will be asked to supply a ssh config file. Since we will use the password for ssh, you can just pick the default one. Or if you know what you are doing, you can create or select your ssh config file.
1.1.4 Connecting to xApp Dev Environment¶
You can now find the newly added host, your x/rApp Development Environment, in the “Remote Explorer” tab on the left. You will see the host and can click on it to connect. You will be asked for the ssh password in the process (you might be asked for the ssh password a couple of times which is normal).
1.1.5 Adding a SSH key to the xApp Dev Environment¶
You can of course add your public ssh key to the x/rApp Development Environment and then use that in the ssh config file of VS Code Remote-SSH, which makes the connection process easier. Of course you have to keep in mind that once the x/rApp Development Environment is deleted, all your data in the x/rApp Development Environment including the ssh key will be deleted. When deploying a new x/rApp Development Environment, you have to set up the ssh key again.
1.1.6 Troubleshooting¶
There is a known issue if you try to connect to the remote x/rApp Development Environment using the remote-ssh extension in VS Code. When you try to connect, you can get an error message:
“Could not establish connection to “10.8.0.1”: Downloading VS Code Server failed - please install either curl or wget on the remote”
To resolve it, you need to kill the VS Code server on the remote using the following command:
VSCode -> View -> Command Palette -> input "remote" -> Select Remote-SSH: Kill VS Code Server on Host…
You can then select the IP address of your x/rApp Development Environment, and will be required to enter the ssh password. Once the process completes, reconnect to the remote ssh again and it should work this time.
1.2 Using simple ssh to access the x/rApp Development Environment¶
As described in the Quick Guide section, you can use SSH to access your x/rApp Development Environment:
ssh -p <xapp-dev-ssh> xapp@<drax-ip-address>
Using the -p option, you can specify the SSH port, which we discovered in the previous step. The username in the x/rApp Development Environment is always xapp, and you have to connect to the IP address where your dRAX RIC, or specifically your x/rApp, is running.
1.3 Using local IDE to edit x/rApp Development Environment files¶
As an x/rApp Developer, it is often easier to develop the xApp in an IDE or user-friendly text editor. You may use a tool called sshfs to mount the files from the x/rApp Development Environment onto your local machine. This way you can edit the files locally in any text editor you want, and the changes will also take effect in the x/rApp Development Environment. Of course, you still need to access the x/rApp Development Environment using ssh to actually start or stop the x/rApp!
You can install sshfs using the following command:
sudo apt install -y sshfs
Next create a folder where you will mount the remote files:
mkdir /path/to/xapp-dev-file
Finally use the sshfs command to mount the files:
sshfs -p <xapp-dev-ssh> xapp@<drax-ip-address>:/home/xapp /path/to/xapp-dev-files
The x/rApp files will now be available in the "xapp-dev-files" folder you just created. You of course still have to SSH into the x/rApp Development Environment to start and stop your x/rApp as described in the Using simple ssh to access the x/rApp Development Environment section.