1 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/devguides/master/xds-docs-guides-devguides-book.yml -->
5 ## XDS agent architecture
7 The agent part is written in *Go* and the webapp / dashboard is in *typescript + Angular4*.
11 +-- bin/ where xds-server binary file will be built
13 +-- conf.d Linux configuration and startup files (systemd user service)
15 +-- glide.yaml Go package dependency file
17 +-- lib/ sources of server part (Go)
19 +-- main.go main entry point of of Web server (Go)
21 +-- Makefile makefile including
25 +-- scripts/ hold various scripts used for installation or startup
27 +-- tools/ temporary directory to hold development tools (like glide)
29 +-- vendor/ temporary directory to hold Go dependencies packages
31 +-- webapp/ source client basic webapp / dashboard
34 ## Debug xds-agent (Go code)
36 Install first [Visual Studio Code](https://code.visualstudio.com/) and
37 [Go plugin](https://marketplace.visualstudio.com/items?itemName=lukehoban.Go)
38 (`ext install lukehoban.Go`)
40 Visual Studio Code launcher settings can be found into `.vscode/launch.json`.
41 The important think is to correctly set `GOPATH` in launch.json in order to
42 build xds-agent and debug it within Visual Studio Code.
44 Here is an example of launch.json:
57 "program": "${workspaceRoot}",
59 "GOPATH": "${workspaceRoot}/../../../../../..:${env:GOPATH}",
61 "args": ["-log", "debug", "-c", "__agent-config_local_dev.json"],
68 And `__agent-config_local_dev.json` file content is as follow :
72 "webAppDir": "./webapp/dist",
73 "logsDir": "${HOME}/tmp/xds-agent/logs",
76 "url": "http://localhost:8000"
81 "home": "${HOME}/tmp/xds_local_dev/syncthing-config",
82 "gui-address": "http://localhost:8386",
87 ### Tricks to debug both xds-agent and xds-server
89 To debug both `xds-agent` and `xds-server` or common code `xds-common`, it may
90 be useful use the same local sources.
92 A trick to do that is to replace `xds-server` + `xds-common` in `vendor`
93 directory by a symlink that points to local sources.
95 So clone first `xds-server` + `xds-common` sources next to `xds-agent` directory.
97 You should have the following tree:
102 `-- gerrit.automotivelinux.org
111 Then invoke `vendor/debug` Makefile rule to create symbolic links inside vendor
115 cd src/gerrit.automotivelinux.org/gerrit/src/xds/xds-agent
119 ## Debug dashboard part (Typescript / angular code)
121 Start `xds-agent` either from command line or in debug mode (see previous
122 chapter) and in another terminal start a watcher daemon so that type typescript
123 sources of webapp / dashboard are automatically "transpiled" using following
131 Then open the XDS Dashboard page ([http://localhost:8800](http://localhost:8800))
132 and open the developer tool of web browser (for example `Ctrl+Shift+I` in Chrome).