diff options
Diffstat (limited to 'docs/part-2')
-rw-r--r-- | docs/part-2/1_xds-server.md | 200 | ||||
-rw-r--r-- | docs/part-2/2_xds-agent.md | 26 | ||||
-rw-r--r-- | docs/part-2/3_xds-cli.md | 56 | ||||
-rw-r--r-- | docs/part-2/4_xds-gdb.md | 31 |
4 files changed, 124 insertions, 189 deletions
diff --git a/docs/part-2/1_xds-server.md b/docs/part-2/1_xds-server.md index 2c31b1e..a45a8f0 100644 --- a/docs/part-2/1_xds-server.md +++ b/docs/part-2/1_xds-server.md @@ -40,135 +40,10 @@ been integrated into AGL SDK docker container. >**Note:** For more info about AGL SDK docker container, please refer to [AGL SDK Quick Setup](http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/setup-sdk-environment.html) -### Get the container - -Load the pre-build AGL SDK docker image including `xds-server`: - -```bash -wget -O - http://iot.bzh/download/public/XDS/docker/docker_agl_worker-xds-latest.tar.xz | docker load -``` - -### List container - -You should get `docker.automotivelinux.org/agl/worker-xds:X.Y` image - -```bash -# List image that we just built -docker images | grep worker-xds - -docker.automotivelinux.org/agl/worker-xds 5.0 02616f565535 5 hours ago 640MB -``` - ### Start xds-server within the container -Use provided script to create a new docker image and start a new container: - -```bash -# Get script -wget -O xds-docker-create-container.sh 'https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git;a=blob_plain;f=scripts/xds-docker-create-container.sh;hb=master' - -# Create new XDS worker container -bash ./xds-docker-create-container.sh - -# Check that new container is running -docker ps | grep worker-xds -f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 0.0.0.0:8000->8000/tcp, 0.0.0.0:69->69/udp, 0.0.0.0:10809->10809/tcp, 0.0.0.0:2222->22/tcp agl-xds-HOSTNAME-0-USERNAME -``` - -This container exposes following ports: - -- 8000 : `xds-server` to serve XDS webapp -- 69 : TFTP -- 2222 : ssh - -<!-- note --> -**Note:** - -You can add a new shared directory using `--volume` option in order -to use for example with Path-Mapping folder type. - -```bash -# Create new XDS worker container and share extra '$HOME/my-workspace' directory -bash ./xds-docker-create-container.sh --volume /my-workspace:$HOME/my-workspace -``` - -You can change docker used port with `-id` option - -```bash -# Create new XDS worker container with a different port number -bash ./xds-docker-create-container.sh -id ${ID} - -# Check that new container is running -docker ps | grep worker-xds -f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 0.0.0.0:(2222+ID)->22/tcp, 0.0.0.0:(69+ID)->69/udp, 0.0.0.0:(8000+ID)->8000/tcp, 0.0.0.0:(10809+ID)->10809/tcp agl-xds-HOSTNAME-ID-USERNAME -``` - -<!-- endnote --> - -#### Manually setup docker user id - -<!-- note --> -**Note:** - -If you used `xds-docker-create-container.sh` script to create XDS -docker container, user uid/gid inside docker has already been changed by this script. -<!-- endnote --> - -If you plan to use **path-mapping sharing type for your projects**, you need to -have the same user id and group id inside and outside docker. - -By default user and group name inside docker is set `devel` (id `1664`). - -Use following commands to replace id `1664` with your user/group id: - -```bash -# Set docker container name to use (usually agl-xds-xxx where xxx is USERNAME@MACHINENAME-IDX-NAME) -export CONTAINER_NAME=agl-xds-seb@laptop-0-seb -docker ps | grep ${CONTAINER_NAME} || echo "ERROR: No container name \"${CONTAINER_NAME}\" please set a valid CONTAINER_NAME before you continue" - -# First kill all processes of devel user (including running xds-server) -docker exec ${CONTAINER_NAME} bash -c "/bin/loginctl kill-user devel" - -# Change user and group id inside docker to match your ids -docker exec ${CONTAINER_NAME} bash -c "usermod -u $(id -u) devel" -docker exec ${CONTAINER_NAME} bash -c "groupmod -g $(id -g) devel" - -# Update some files ownership -docker exec ${CONTAINER_NAME} bash -c "chown -R devel:devel /home/devel /tmp/xds*" - -# Restart devel autologin service -docker exec ${CONTAINER_NAME} bash -c "systemctl start autologin" - -# Restart xds-server as a service (ssh port 2222 may depend on your container ID) -ssh -p 2222 devel@localhost -- "systemctl --user start xds-server" -``` - -## Check if xds-server is running (open XDS webapp) - -**`xds-server` is automatically started** as a service on container startup. - -If the container is running on your localhost, you can access to a basic web -application: - -```bash -xdg-open http://localhost:8000 -``` - -If needed you can status / stop / start it manually using following commands: - -```bash -# Status XDS server: -ssh -p 2222 devel@localhost systemctl --user status xds-server.service - -# Stop XDS server -ssh -p 2222 devel@localhost systemctl --user stop xds-server.service - -# Start XDS server -ssh -p 2222 devel@localhost systemctl --user start xds-server.service - -# Get XDS server logs -ssh -p 2222 devel@localhost journalctl --user --unit=xds-server.service --output=cat -``` +See [Installation based on Docker container](../part-1/2_install-xds-server.html#installation-based-on-docker-container) +chapter. ### Manually Start XDS server @@ -188,7 +63,7 @@ If needed you can change default setting by defining specific environment variables file ```bash -ssh -p 2222 devel@localhost vim /etc/default/xds-server +ssh -t -p 2222 devel@localhost vim /etc/default/xds-server ``` For example to control log level, just set LOG_LEVEL env variable. @@ -203,10 +78,8 @@ knowing that supported *level* are: - debug ```bash -ssh -p 2222 devel@localhost -echo 'LOG_LEVEL=debug' | sudo tee --append /etc/default/xds-server > /dev/null -systemctl --user restart xds-server.service -tail -f /tmp/xds-server/logs/xds-server.log +docker exec ${CONTAINER_NAME} bash -c "echo 'LOG_LEVEL=debug' >> /etc/default/xds-server" +ssh -p 2222 devel@localhost -- "systemctl --user restart xds-server" ``` ### SDK cross-toolchain Management @@ -412,28 +285,26 @@ Refer to [Prerequisites chapter](./0_Abstract.html#prerequisites) for more detai Create a GOPATH variable(must be a full path): ```bash - export GOPATH=$(realpath ~/workspace_go) +export GOPATH=$(realpath ~/workspace_go) ``` -SEB Rework GOPATH inscrutions - Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: ```bash export GOPATH=${GOPATH}:${ROOTDIR} - mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds - cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds - git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-server - # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-server - cd xds-server - make all +mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds +cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds +git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-server +# or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-server +cd xds-server +make all ``` And to install `xds-server` (by default in `/opt/AGL/xds/server`): ```bash - make install +make install ``` <!-- warning --> @@ -518,6 +389,18 @@ All fields are optional and example below corresponds to the default values. >Environment variables are supported by using `${MY_VAR}` syntax. > +When `xds-server` is started as a systemd service, default environment variables +are set into `/etc/default/xds-server` file. + +`xds-server` configuration is also driven by a JSON config file (`server-config.json`), +and default JSON config is `/etc/xds/server/server-config.json`. + +<!-- note --> +**Note:** +You can use your own JSON config by settings `APP_CONFIG` variable of +`/etc/default/xds-server` file to your file, for example `/home/MYUSER/.xds/server/server-config.json` +<!-- endnote --> + #### Disable syncthing `CloudSync` synchronization type based on `syncthing` tool can be disabled by @@ -540,6 +423,13 @@ Here is a JSON configuration file example where syncthing key as been renamed: On benefit to do that is to increase XDS-Server startup time. +<!-- note --> +**Note:** + +- `CloudSync` (AKA syncthing) synchronzation type can also be disabled when `"syncthing"` key is not defined in JSON configuration file. + +<!-- endnote --> + ## Debugging ### XDS server architecture @@ -548,27 +438,31 @@ The server part is written in *Go* and web app (basic HTML) in *Angular4*. ```bash | -+-- bin/ where xds-server binary file will be built ++-- 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 | -+-- conf.d Linux configuration and startup files (systemd user service) ++-- lib/ # sources of server part (Go) | -+-- glide.yaml Go package dependency file ++-- LICENSE # XDS server license | -+-- lib/ sources of server part (Go) ++-- main.go # main entry point of of Web server (Go) | -+-- main.go main entry point of of Web server (Go) ++-- Makefile # makefile including | -+-- Makefile makefile including ++-- README.md # | -+-- README.md this readme ++-- scripts/ # hold various scripts used for installation or startup | -+-- scripts/ hold various scripts used for installation or startup ++-- test/ # XDS test suite | -+-- tools/ temporary directory to hold development tools (like glide) ++-- tools/ # temporary directory to hold development tools (like glide) | -+-- vendor/ temporary directory to hold Go dependencies packages ++-- vendor/ # temporary directory to hold Go dependencies packages | -+-- webapp/ source client basic web application ++-- webapp/ # source client basic web application ``` Visual Studio Code launcher settings can be found into `.vscode/launch.json`. diff --git a/docs/part-2/2_xds-agent.md b/docs/part-2/2_xds-agent.md index ce03ae7..1429715 100644 --- a/docs/part-2/2_xds-agent.md +++ b/docs/part-2/2_xds-agent.md @@ -12,6 +12,7 @@ used to remotely cross build applications. ## 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: @@ -52,7 +53,9 @@ below corresponds to the default values): } ``` ->**Note:** environment variables are supported by using `${MY_VAR}` syntax. +>**Note:** +> +>environment variables are supported by using `${MY_VAR}` syntax. ## Start-up @@ -62,7 +65,9 @@ Simply to start `xds-agent` executable ./xds-agent & ``` ->**Note:** if need be, you can increase log level by setting option +>**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. @@ -94,7 +99,9 @@ And to install xds-agent (by default in `/usr/local/bin`): make install ``` ->**Note:** Used `DESTDIR` to specify another install directory +>**Note:** +> +>Used `DESTDIR` to specify another install directory >```bash >make install DESTDIR=$HOME/opt/xds-agent >``` @@ -158,10 +165,15 @@ The agent part is written in *Go* and the webapp / dashboard is in *typescript + 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. +>**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 diff --git a/docs/part-2/3_xds-cli.md b/docs/part-2/3_xds-cli.md index a4ccca5..ade25f8 100644 --- a/docs/part-2/3_xds-cli.md +++ b/docs/part-2/3_xds-cli.md @@ -6,9 +6,11 @@ `xds-cli` configuration is defined either by environment variables or by setting command line options. + Configuration through environment variables may also be defined in a file that -will be sourced by `xds-cli` on start-up. Use `--config|-c` option or set -`XDS_CONFIG` environment variable to specify the config file to use. +will be sourced by `xds-cli` on start-up. + +Use `--config|-c` option or set `XDS_CONFIG` environment variable to specify the config file to use. So configuration is driven either by environment variables or by command line options or using a config file knowing that the following priority order is used: @@ -19,7 +21,9 @@ options or using a config file knowing that the following priority order is used 1. else use `XDS_xxx` (for example `XDS_PROJECT_ID`) environment variable <!-- note --> -**Note:** all parameters after a double dash (--) are considered as the command +**Note:** + +All parameters after a double dash (--) are considered as the command to execute on xds-server. <!-- endnote --> @@ -35,24 +39,24 @@ __`--log|-l` option or `XDS_LOGLEVEL` env variable__ Logging level, supported levels are: -- panic, -- fatal, -- error, -- warn, -- info, +- panic +- fatal +- error +- warn +- info - debug Default level is "error". -__`--rpath` option or `XDS_PATH` env variable__ +**`--rpath` option or `XDS_PATH` env variable** Relative path into project -__`timestamp|-ts` option or `XDS_TIMESTAMP` env variable__ +**`timestamp|-ts` option or `XDS_TIMESTAMP` env variable** Prefix output with timestamp -__`url` option or `XDS_AGENT_URL` env variable__ +**`url` option or `XDS_AGENT_URL` env variable** Local XDS agent url (default: "localhost:8800") @@ -61,6 +65,7 @@ Local XDS agent url (default: "localhost:8800") ### projects `projects` (short `prj`) command should be used to managed XDS projects. + This command supports following sub-commands: ```bash @@ -87,6 +92,7 @@ xds-cli prj rm 8e49 ### sdks `sdks` (alias `sdk`) command should be used to managed cross SDKs. + This command supports following sub-commands: ```bash @@ -108,23 +114,25 @@ xds-cli sdks get c64d ### exec -`exec` command should be used to exec command through XDS system. For example -you can use this command to build your project in XDS system. +`exec` command should be used to exec command through XDS system. + +For example you can use this command to build your project in XDS system. + This command supports following sub-commands: `exec` command options are: -__`--id` option or `XDS_PROJECT_ID` env variable (**mandatory option**)__ +**`--id` option or `XDS_PROJECT_ID` env variable (**mandatory option**)** project ID you want to build -__`--rpath` (short `-p`) or `XDS_RPATH` env variable__ +**`--rpath` (short `-p`) or `XDS_RPATH` env variable** relative path into project -__`--sdkid` (alias `--sdk`) or `XDS_SDK_ID` env variable (**mandatory option**)__ +**`--sdkid` (alias `--sdk`) or `XDS_SDK_ID` env variable (**mandatory option**)** -Cross Sdk ID to use to build project +Cross Sdk ID to use to build project. Here are some usage examples: @@ -140,7 +148,8 @@ xds-cli exec --id=4021 --sdkid=c226 -- "cd build && make all" ``` In case of `xds-agent` is not running on default url:port (that is `localhost:8800`) -you can specify the url using `--url` option : + +You can specify the url using `--url` option : ```bash xds-cli --url=http://localhost:8800 exec --id=4021 --sdkid=c226 -- "cd build && make all" @@ -188,10 +197,15 @@ Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds Visual Studio Code launcher settings can be found into `.vscode/launch.json`. ->**Tricks:** To debug both `xds-cli` and `xds-agent` (REST API part) or common +>**Tricks:** +> +>To debug both `xds-cli` and `xds-agent` (REST API part) or common code `xds-common`, it may be useful use the same local sources. -So you should replace `xds-agent` + `xds-common` in `vendor` directory by a symlink. -So clone first `xds-agent` + `xds-common` sources next to `xds-cli` directory. +> +>So you should replace `xds-agent` + `xds-common` in `vendor` directory by a symlink. +> +>So clone first `xds-agent` + `xds-common` sources next to `xds-cli` directory. + You should have the following tree: ```bash diff --git a/docs/part-2/4_xds-gdb.md b/docs/part-2/4_xds-gdb.md index 6185ce9..96f5498 100644 --- a/docs/part-2/4_xds-gdb.md +++ b/docs/part-2/4_xds-gdb.md @@ -22,8 +22,9 @@ used to remotely cross build applications. ## Configuration - `xds-gdb` configuration is defined by variables (see listed below). - These variables may be set using : +`xds-gdb` configuration is defined by variables (see listed below). + +These variables may be set using: - environment variables (inherited), - or a config file set with `XDS_CONFIG` environment variable, for example: @@ -37,11 +38,15 @@ used to remotely cross build applications. ### Configuration Variables - `XDS_CONFIG` : - Config file defining `XDS_xxx` configuration variables. Variables of this file - will overwrite inherited environment variables. Variables definition may be - prefixed or not by "export" keyword. - Here is an example of config file +`XDS_CONFIG` + +Config file defining `XDS_xxx` configuration variables. + +Variables of this file will overwrite inherited environment variables. + +Variables definition may be prefixed or not by "export" keyword. + +Here is an example of config file: ```bash cat $HOME/myProject/xds-gdb.env @@ -53,7 +58,16 @@ export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 `XDS_LOGLEVEL` -Set logging level (supported levels: panic, fatal, error, warn, info, debug) +Set logging level + +Supported levels: + +- panic +- fatal +- error +- warn +- info +- debug `XDS_LOGFILE` @@ -83,6 +97,7 @@ Local XDS agent url (default `http://localhost:8800`) Above `XDS_xxx` variables may also be defined within gdb init command file (see --command or -x option of genuine Gdb). + You must respect the following syntax: commented line including `:XDS-ENV:` tag Example of gdb init file where we define project and sdk ID: |