diff --git a/doc/development_guide.md b/doc/development_guide.md index 4a4fd8f47508247c797c31f71bf9ecb23f79b656..1bf0f091005498a06149f4f78e0abe61da83cf71 100644 --- a/doc/development_guide.md +++ b/doc/development_guide.md @@ -27,8 +27,7 @@ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev li <h3><u>Install PyEnv</h3></u> -We recommend installing PyEnv through -[PyEnv Installer](https://github.com/pyenv/pyenv-installer). +We recommend installing PyEnv through [PyEnv Installer](https://github.com/pyenv/pyenv-installer). Below you can find the instructions, but we refer you to the link for updated instructions. @@ -196,7 +195,7 @@ In the root directory of the existing Java components you will find an executabl <h3><u>VS Code Quarkus plugin</h3></u> In case you are using [VS Code](https://code.visualstudio.com/) for development, we suggest to install the [official Quarkus extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-quarkus). The extension should be able to automatically find the current open project and integrate with the above `mvnw` maven wrapper, making it easier to control the [maven lifecycle](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html). -Make sure that you open the specific component directory (i.e., `src/ztp` or `src/policy`) and not the general controller one (i.e., `src`. +Make sure that you open the specific component directory (i.e., `src/ztp` or `src/policy`) and not the general controller one (i.e., `src`.) <h3><u>New Java TFS component</h3></u> @@ -239,65 +238,65 @@ First we need to install Erlang. There is multiple way, for development we will using [ASDF](https://asdf-vm.com/), a tool that allows the installation of multiple version of Erlang at the same time, and switch from one version to the other at will. -- First, install any missing dependencies: -```bash -sudo apt install curl git autoconf libncurses-dev build-essential m4 libssl-dev -``` + - First, install any missing dependencies: + ```bash + sudo apt install curl git autoconf libncurses-dev build-essential m4 libssl-dev + ``` -- Download *ASDF* tool to the local account: -```bash -git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2 -``` + - Download *ASDF* tool to the local account: + ```bash + git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2 + ``` -- Make *ASDF* activate on login by adding these lines at the end of the `~/.bashrc` file: -```bash -. $HOME/.asdf/asdf.sh -. $HOME/.asdf/completions/asdf.bash -``` + - Make *ASDF* activate on login by adding these lines at the end of the `~/.bashrc` file: + ```bash + . $HOME/.asdf/asdf.sh + . $HOME/.asdf/completions/asdf.bash + ``` -- Logout and log back in to activate *ASDF*. + - Logout and log back in to activate *ASDF*. *ASDF* supports multiple tools by installing there corresponding plugins. -- Install *ASDF* plugin for Erlang: -```bash -asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git -``` + - Install *ASDF* plugin for Erlang: + ```bash + asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git + ``` -- Install a version of Erlang: -```bash -asdf install erlang 24.3.4.2 -``` + - Install a version of Erlang: + ```bash + asdf install erlang 24.3.4.2 + ``` -- Activate Erlang locally for TFS controller. This will create a local file -called `.tool-versions` defining which version of the tools to use when -running under the current directory: -```bash -cd tfs-ctrl/ -asdf local erlang 24.3.4.2 -``` + - Activate Erlang locally for TFS controller. This will create a local file + called `.tool-versions` defining which version of the tools to use when + running under the current directory: + ```bash + cd tfs-ctrl/ + asdf local erlang 24.3.4.2 + ``` Erlang projects uses a build tool called [rebar3](https://github.com/erlang/rebar3). It is used to manager project dependenecies, compile a project and generate project releases. -- Install rebar3 localy from source: -```bash -cd ~ -git clone https://github.com/erlang/rebar3.git -cd rebar3 -asdf local erlang 24.3.4.2 -./bootstrap -./rebar3 local install -``` + - Install rebar3 localy from source: + ```bash + cd ~ + git clone https://github.com/erlang/rebar3.git + cd rebar3 + asdf local erlang 24.3.4.2 + ./bootstrap + ./rebar3 local install + ``` -- Update `~/.bashrc` to use rebar3 by adding this line at the end: -```bash -export PATH=$HOME/.cache/rebar3/bin:$PATH -``` + - Update `~/.bashrc` to use rebar3 by adding this line at the end: + ```bash + export PATH=$HOME/.cache/rebar3/bin:$PATH + ``` -- Logout and log back in. + - Logout and log back in. ### **2.1.6. Kotlin** @@ -441,13 +440,13 @@ Host TFS-VM <h3><u>Connect VSCode to the VM through "Remote SSH" extension</h3></u> -- Right-click on "TFS-VM" -- Select "Connect to Host in Current Window" -- Reply to the questions asked - - Platform of the remote host "TFS-VM": Linux - - "TFS-VM" has fingerprint "<fingerprint>". Do you want to continue?: Continue - - Type tfs user's password: tfs123 -- You should be now connected to the TFS-VM. + - Right-click on "TFS-VM" + - Select "Connect to Host in Current Window" + - Reply to the questions asked + - Platform of the remote host "TFS-VM": Linux + - "TFS-VM" has fingerprint "<fingerprint>". Do you want to continue?: Continue + - Type tfs user's password: tfs123 + - You should be now connected to the TFS-VM. __Note__: if you get a connection error message, the reason might be due to wrong SSH server fingerprint. Edit file "<...>/.ssh/known_hosts" on your local user account, check if there is a line starting with @@ -456,56 +455,59 @@ __Note__: if you get a connection error message, the reason might be due to wron <h3><u>Add SSH key to prevent typing the password every time</h3></u> + This step creates an SSH key in the VM and installs it on the VSCode to prevent having to type the password every time. -- In VSCode (connected to the VM), click menu "Terminal > New Terminal" -- Run the following commands on the VM's terminal through VSCode -```bash -ssh-keygen -t rsa -b 4096 -f ~/.ssh/tfs-vm.key - # leave password empty -ssh-copy-id -i ~/.ssh/tfs-vm.key.pub tfs@10.0.2.10 - # tfs@10.0.2.10's password: <type tfs user's password: tfs123> -rm .ssh/known_hosts -``` - -- In VSCode, click left "Explorer" panel to expand, if not expanded, and click "Open Folder" button. - - Choose "/home/tfs/" - - Type tfs user's password when asked - - Trust authors of the "/home/tfs [SSH: TFS-VM]" folder when asked -- Right click on the file "tfs-vm.key" in the file explorer - - Select "Download..." option - - Download the file into your user's accout ".ssh" folder -- Delete files "tfs-vm.key" and "tfs-vm.key.pub" on the TFS-VM. - -- In VSCode, click left "Remote Explorer" panel to expand - - Click the "gear" icon next to "SSH TARGETS" on top of "Remote Explorer" bar - - Choose to edit "<...>/.ssh/config" file (or equivalent) - - Find entry "Host TFS-VM" and update it as follows: -``` -Host TFS-VM - HostName 127.0.0.1 - Port 2200 - ForwardX11 no - User tfs - IdentityFile "<path to the downloaded identity private key file>" -``` - - Save the file -- From now, VSCode will use the identity file to connect to the TFS-VM instead of the user's password. + - In VSCode (connected to the VM), click menu "Terminal > New Terminal" + - Run the following commands on the VM's terminal through VSCode + ```bash + ssh-keygen -t rsa -b 4096 -f ~/.ssh/tfs-vm.key + # leave password empty + ssh-copy-id -i ~/.ssh/tfs-vm.key.pub tfs@10.0.2.10 + # tfs@10.0.2.10's password: <type tfs user's password: tfs123> + rm .ssh/known_hosts + ``` + + - In VSCode, click left "Explorer" panel to expand, if not expanded, and click "Open Folder" button. + - Choose "/home/tfs/" + - Type tfs user's password when asked + - Trust authors of the "/home/tfs [SSH: TFS-VM]" folder when asked + - Right click on the file "tfs-vm.key" in the file explorer + - Select "Download..." option + - Download the file into your user's accout ".ssh" folder + - Delete files "tfs-vm.key" and "tfs-vm.key.pub" on the TFS-VM. + + - In VSCode, click left "Remote Explorer" panel to expand + - Click the "gear" icon next to "SSH TARGETS" on top of "Remote Explorer" bar + - Choose to edit "<...>/.ssh/config" file (or equivalent) + - Find entry "Host TFS-VM" and update it as follows: + ``` + Host TFS-VM + HostName 127.0.0.1 + Port 2200 + ForwardX11 no + User tfs + IdentityFile "<path to the downloaded identity private key file>" + ``` + - Save the file + - From now, VSCode will use the identity file to connect to the TFS-VM instead of the user's password. <h3><u>Install VSCode Python Extension (in VSCode server)</h3></u> + This step installs Python extensions in VSCode server running in the VM. -- In VSCode (connected to the VM), click left button "Extensions" -- Search "Python" extension in the extension Marketplace. -- Install official "Python" extension released by Microsoft. - - By default, since you're connected to the VM, it will be installed in the VSCode server running in the VM. + - In VSCode (connected to the VM), click left button "Extensions" + - Search "Python" extension in the extension Marketplace. + - Install official "Python" extension released by Microsoft. + - By default, since you're connected to the VM, it will be installed in the VSCode server running in the VM. -- In VSCode (connected to the VM), click left button "Explorer" -- Click "Ctrl+Alt+P" and type "Python: Select Interpreter". Select option "Python: 3.9.13 64-bit ('tfs')" + - In VSCode (connected to the VM), click left button "Explorer" + - Click "Ctrl+Alt+P" and type "Python: Select Interpreter". Select option "Python: 3.9.13 64-bit ('tfs')" <h3><u>Define environment variables for VSCode</h3></u> + The source code in the TFS controller project is hosted in folder `src/`. To help VSCode find the Python modules and packages, add the following file into your working space root folder: