aboutsummaryrefslogtreecommitdiffstats
path: root/docs/part-2/2_xds-agent
diff options
context:
space:
mode:
Diffstat (limited to 'docs/part-2/2_xds-agent')
-rw-r--r--docs/part-2/2_xds-agent/0_abstract.md19
-rw-r--r--docs/part-2/2_xds-agent/1_config.md47
-rw-r--r--docs/part-2/2_xds-agent/2_start.md14
-rw-r--r--docs/part-2/2_xds-agent/3_build.md58
-rw-r--r--docs/part-2/2_xds-agent/4_debug.md69
5 files changed, 207 insertions, 0 deletions
diff --git a/docs/part-2/2_xds-agent/0_abstract.md b/docs/part-2/2_xds-agent/0_abstract.md
new file mode 100644
index 0000000..d73bdb9
--- /dev/null
+++ b/docs/part-2/2_xds-agent/0_abstract.md
@@ -0,0 +1,19 @@
+# XDS - X(cross) Development System Agent
+
+XDS-agent is a client that should run on your local / user development machine when you use XDS.
+
+This agent takes care, among others, of starting [Syncthing](https://syncthing.net/)
+tool to synchronize your project files from your local host to XDS build server
+machine or container (where `xds-server` is running).
+
+> **SEE ALSO**: [xds-server](https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git), a web server
+used to remotely cross build applications.
+
+---
+
+Links to subchapters :
+
+- [Configuration](./1_config.html)
+- [Start-up](./2_start.html)
+- [Build from scratch](./3_build.html)
+- [Debugging](./4_debug.html)
diff --git a/docs/part-2/2_xds-agent/1_config.md b/docs/part-2/2_xds-agent/1_config.md
new file mode 100644
index 0000000..9e912cb
--- /dev/null
+++ b/docs/part-2/2_xds-agent/1_config.md
@@ -0,0 +1,47 @@
+# Configuration
+
+xds-agent configuration is driven by a JSON config file.
+
+The tarball mentioned in previous section includes this file with default settings.
+
+Here is the logic to determine which conf file will be used:
+
+1. from command line option: `--config myConfig.json`
+1. `$HOME/.xds/agent/agent-config.json` file
+1. `/etc/xds/agent/agent-config.json` file
+
+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)
+- **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": "8800",
+ "webAppDir": "./www",
+ "logsDir": "${HOME}/.xds/agent/logs",
+ "xdsServers": [
+ {
+ "url": "http://localhost:8000"
+ }
+ ],
+ "syncthing": {
+ "home": "${HOME}/.xds/agent/syncthing-config",
+ "gui-address": "http://localhost:8386",
+ "gui-apikey": "1234abcezam"
+ }
+}
+```
+
+>**Note:**
+>
+>environment variables are supported by using `${MY_VAR}` syntax.
diff --git a/docs/part-2/2_xds-agent/2_start.md b/docs/part-2/2_xds-agent/2_start.md
new file mode 100644
index 0000000..8ff0b1d
--- /dev/null
+++ b/docs/part-2/2_xds-agent/2_start.md
@@ -0,0 +1,14 @@
+# Start-up
+
+Simply to start `xds-agent` executable
+
+```bash
+./xds-agent &
+```
+
+>**Note:**
+>
+>If need be, you can increase log level by setting option
+`--log <level>`, supported *level* are: panic, fatal, error, warn, info, debug.
+
+You can now use XDS dashboard and check that connection with `xds-agent` is up.
diff --git a/docs/part-2/2_xds-agent/3_build.md b/docs/part-2/2_xds-agent/3_build.md
new file mode 100644
index 0000000..ce1407d
--- /dev/null
+++ b/docs/part-2/2_xds-agent/3_build.md
@@ -0,0 +1,58 @@
+# Build xds-agent from scratch
+
+## Dependencies
+
+Install [Go](https://golang.org/doc/install), [npm](https://www.npmjs.com/),
+[nodejs](https://nodejs.org/en/) and some other tools.
+
+Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details.
+
+## Building
+
+Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile:
+
+```bash
+ mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds
+ cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds
+ git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-agent
+ # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-agent
+ cd xds-agent
+ make all
+```
+
+And to install xds-agent (by default in `/usr/local/bin`):
+
+```bash
+make install
+```
+
+>**Note:**
+>
+>Used `DESTDIR` to specify another install directory
+>```bash
+>make install DESTDIR=$HOME/opt/xds-agent
+>```
+
+### Cross build
+
+For example on a Linux machine to cross-build for Windows, just follow these steps.
+
+The first time you need to install all the windows-amd64 standard packages on
+your system with
+
+```bash
+# List all supported OS / ARCH
+go tool dist list
+
+# Install all standard packages for another OS/ARCH (eg. windows amd64)
+GOOS=windows GOARCH=amd64 go install -v -a std
+```
+
+Then compile and package xds-agent using provided makefile
+
+```bash
+export GOOS=windows
+export GOARCH=amd64
+make all
+make package
+```
diff --git a/docs/part-2/2_xds-agent/4_debug.md b/docs/part-2/2_xds-agent/4_debug.md
new file mode 100644
index 0000000..9490c4b
--- /dev/null
+++ b/docs/part-2/2_xds-agent/4_debug.md
@@ -0,0 +1,69 @@
+# 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 5 --charset=ascii src/
+src/
+`-- gerrit.automotivelinux.org
+ `-- gerrit
+ `-- src
+ `-- xds
+ |-- backup.sh
+ |-- xds-agent
+ |-- xds-cli
+ |-- xds-common
+ |-- xds-docs
+ |-- xds-gdb
+ `-- xds-server
+```
+
+Then invoke `vendor/debug` Makefile rule to create a symlink inside vendor
+directory :
+
+```bash
+cd src/gerrit.automotivelinux.org/gerrit/src/xds/xds-agent
+make vendor/debug
+```