aboutsummaryrefslogtreecommitdiffstats
path: root/docs/part-2/2_xds-agent.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/part-2/2_xds-agent.md')
-rw-r--r--docs/part-2/2_xds-agent.md112
1 files changed, 100 insertions, 12 deletions
diff --git a/docs/part-2/2_xds-agent.md b/docs/part-2/2_xds-agent.md
index 0ece136..7ff271d 100644
--- a/docs/part-2/2_xds-agent.md
+++ b/docs/part-2/2_xds-agent.md
@@ -24,23 +24,30 @@ Supported fields in configuration file are (all fields are optional and example
below corresponds to the default values):
- **httpPort** : http port of agent REST interface
+- **webAppDir** : location of client webapp / dashboard (default: webapp/dist)
- **logsDir** : directory to store logs (eg. syncthing output)
-- **xds-apikey** : xds-agent api-key to use (always set value to "1234abcezam")
-- **syncthing.binDir** : syncthing binaries directory (default: executable directory)
-- **syncthing.home"** : syncthing home directory (usually .../syncthing-config)
-- **syncthing.gui-address** : syncthing gui url (default <http://localhost:8386>)
-- **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated)
+- **xdsServers** : an array of xds-server object
+ - **xdsServers.url**: url of xds-server to connect to
+- **syncthing**: a object defining syncthing settings
+ - **syncthing.binDir** : syncthing binaries directory (default: executable directory)
+ - **syncthing.home"** : syncthing home directory (usually .../syncthing-config)
+ - **syncthing.gui-address** : syncthing gui url (default <http://localhost:8386>)
+ - **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated)
```json
{
- "httpPort": "8010",
- "logsDir": "/tmp/logs",
- "xds-apikey": "1234abcezam",
+ "httpPort": "8800",
+ "webAppDir": "./www",
+ "logsDir": "${HOME}/.xds/agent/logs",
+ "xdsServers": [
+ {
+ "url": "http://localhost:8000"
+ }
+ ],
"syncthing": {
- "binDir": ".",
"home": "${HOME}/.xds/agent/syncthing-config",
"gui-address": "http://localhost:8386",
- "gui-apikey": "1234abcezam",
+ "gui-apikey": "1234abcezam"
}
}
```
@@ -65,11 +72,33 @@ You can now use XDS dashboard and check that connection with `xds-agent` is up.
### Dependencies
-Install and setup [Go](https://golang.org/doc/install) version 1.8 or
-higher to compile this tool.
+Install and setup [Go](https://golang.org/doc/install) version 1.8.1 or higher to compile this tool.
>**Note:** for Ubuntu, you can use a PPA, see [https://github.com/golang/go/wiki/Ubuntu](https://github.com/golang/go/wiki/Ubuntu)
+Install [npm](https://www.npmjs.com/), [nodejs](https://nodejs.org/en/) and
+some other tools
+
+Ubuntu:
+
+```bash
+ sudo apt-get install golang npm curl git zip unzip
+ sudo npm install --global @angular/cli # Angular Command Line Interface
+ # Install LTS version of nodejs
+ sudo n lts
+```
+
+openSUSE:
+
+```bash
+ sudo zypper install go npm git curl zip unzip
+ sudo npm install --global @angular/cli # Angular Command Line Interface
+ # Install LTS version of nodejs
+ sudo n lts
+```
+
+Don't forget to open new user session after installing the packages.
+
### Building
Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile:
@@ -116,3 +145,62 @@ export GOARCH=amd64
make all
make package
```
+
+## Debugging
+
+### XDS agent architecture
+
+The agent part is written in *Go* and the webapp / dashboard is in *typescript + Angular4*.
+
+```bash
+|
++-- bin/ where xds-server binary file will be built
+|
++-- conf.d Linux configuration and startup files (systemd user service)
+|
++-- glide.yaml Go package dependency file
+|
++-- lib/ sources of server part (Go)
+|
++-- main.go main entry point of of Web server (Go)
+|
++-- Makefile makefile including
+|
++-- README.md this readme
+|
++-- scripts/ hold various scripts used for installation or startup
+|
++-- tools/ temporary directory to hold development tools (like glide)
+|
++-- vendor/ temporary directory to hold Go dependencies packages
+|
++-- webapp/ source client basic webapp / dashboard
+```
+
+### Debug
+
+Visual Studio Code launcher settings can be found into `.vscode/launch.json`.
+
+>**Tricks:** To debug both `xds-agent` and `xds-server` or common code
+`xds-common`, it may be useful use the same local sources.
+So you should replace `xds-server` + `xds-common` in `vendor` directory by a symlink.
+So clone first `xds-server` + `xds-common` sources next to `xds-agent` directory.
+You should have the following tree:
+
+```bash
+> tree -L 3 src
+src
+|-- github.com
+ |-- iotbzh
+ |-- xds-agent
+ |-- xds-common
+ |-- xds-server
+```
+
+Then invoke `vendor/debug` Makefile rule to create a symlink inside vendor
+directory :
+
+```bash
+cd src/github.com/iotbzh/xds-agent
+make vendor/debug
+```