summaryrefslogtreecommitdiffstats
path: root/docs/part-2/1_xds-server.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/part-2/1_xds-server.md')
-rw-r--r--docs/part-2/1_xds-server.md200
1 files changed, 47 insertions, 153 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`.