Needs super user rights using install-agl-sdks.sh
[src/xds/xds-server.git] / README.md
index 3c119db..95bd565 100644 (file)
--- a/README.md
+++ b/README.md
@@ -41,20 +41,7 @@ Load the pre-build AGL SDK docker image including `xds-server`:
 wget -O - http://iot.bzh/download/public/2017/XDS/docker/docker_agl_worker-xds-latest.tar.xz | docker load
 ```
 
-### Build the container
-As an alternative to a pre-build image, you can rebuild the container from scratch. 
-`xds-server` has been integrated as a flavour of AGL SDK docker image. 
-So to rebuild docker image just execute following commands:
-
-```bash
-# Clone docker-worker-generator git repo
-git clone https://git.automotivelinux.org/AGL/docker-worker-generator
-# Start build that will create a docker image
-cd docker-worker-generator
-make build FLAVOUR=xds
-```
-
-### List  container
+### List container
 You should get `docker.automotivelinux.org/agl/worker-xds:X.Y` image
  
 ```bash
@@ -87,10 +74,10 @@ This container (ID=0) exposes following ports:
   - 69   : TFTP
   - 2222 : ssh
 
-`xds-server` is automatically started as a service on container startup.
+**`xds-server` is automatically started** as a service on container startup.
 
+If the container is running on your localhost, you can access the web interface (what we call the "Dashboard"):
 ```bash
-#On your localhost you can access the web insterface:
 xdg-open http://localhost:8000
 ```
 
@@ -99,7 +86,7 @@ If needed you can status / stop / start  it manually using following commands:
 # Log into docker container
 ssh -p 2222 devel@localhost
 
-#Status XDS server:
+# Status XDS server:
 sudo systemctl status xds-server.service
 
 # Stop XDS server
@@ -107,66 +94,25 @@ sudo systemctl stop xds-server.service
 
 # Start XDS server
 sudo systemctl start xds-server.service
-```
 
-### Configuration in config.json:
-On `xds-server` startup, you should get the following output:
-
-```bash
+# Get XDS server logs
 sudo journalctl --unit=xds-server.service --output=cat
-{
-    "HTTPPort": 8000,
-    "webAppDir": "/usr/local/bin/www-xds-server",
-    "shareRootDir": "/home/devel/.xds/share",
-    "logsDir": "/tmp/xds-server/logs",
-    "sdkRootDir": "/xdt/sdk",
-    "syncthing": {
-        "binDir": "/usr/local/bin",
-        "home": "/home/devel/.xds/syncthing-config",
-        "gui-address": "http://localhost:8384",
-        "gui-apikey": "1234abcezam"
-    }
-}
 ```
 
 ### Manually Start XDS server
-Systemd use a service to start the XDS server:
 
+XDS server is started as a service by Systemd.
 ```bash
 /lib/systemd/system/xds-server.service
 ```
+This Systemd service starts a bash script `/usr/local/bin/xds-server-start.sh`
 
-Systemd service start a bash script `xds-server-start.sh` script to start all requested tools:
-
-```bash
-/usr/local/bin/xds-server-start.sh
-```
-
-Command line:
-
-```bash
-nohup $BINDIR/xds-server --config $XDS_CONFFILE -log $LOGLEVEL > $LOG_XDS
-```
-
-Default value :
+If you needed you can change default setting by defining specific environment variables in `/etc/default/xds-server`.
+For example to control log level, just set LOGLEVEL env variable knowing that supported *level* are: panic, fatal, error, warn, info, debug.
 ```bash
-BINDIR=/usr/local/bin
-#xds-server install directory
-
-XDS_CONFFILE=$HOME/.xds/config.json
-#Conf file create at the first boot
-
-LOGLEVEL=info
-#You can set LOGLEVEL env variable to increase log level if you need it. 
-#Supported *level* are: panic, fatal, error, warn, info, debug.
-
-LOG_XDS=/tmp/xds-server/logs/xds-server.log
-```
-
-#For example, to set log level to "debug" mode :
-
-```bash
-LOGLEVEL=debug /usr/local/bin/xds-server-start.sh
+echo 'LOGLEVEL=debug' | sudo tee --append /etc/default/xds-server > /dev/null
+sudo systemctl restart xds-server.service
+tail -f /tmp/xds-server/logs/xds-server.log
 ```
 
 ### Install SDK cross-toolchain
@@ -178,18 +124,20 @@ Use provided `install-agl-sdks` script, for example to install SDK for ARM64 and
 
 ```bash
 # Install ARM64 SDK (automatic download)
-/usr/local/bin/xds-utils/install-agl-sdks.sh --arch aarch64
+sudo /usr/local/bin/xds-utils/install-agl-sdks.sh --arch aarch64
 
 # Install Intel corei7-64 SDK (using an SDK tarball that has been built or downloaded manually)
-/usr/local/bin/xds-utils/install-agl-sdks.sh --arch corei7-64 --file /tmp/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-
+sudo /usr/local/bin/xds-utils/install-agl-sdks.sh --arch corei7-64 --file /tmp/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-
 3.99.1+snapshot.sh
 
 ```
 
 ### XDS Dashboard
 
-`xds-server` serves a web-application (default port 8000:
-[http://localhost:8000](http://localhost:8000) ). So you can now connect your browser to this url and use what we call the **XDS dashboard**.
+`xds-server` serves a web-application at [http://localhost:8000](http://localhost:8000) when XDS server is running on your host. Just replace `localhost` by the host name or ip when XDS server is running on another host. So you can now connect your browser to this url and use what we call the **XDS dashboard**.
+```bash
+xdg-open http://localhost:8000
+```
 
 Then follow instructions provided by this dashboard, knowing that the first time
 you need to download and start `xds-agent` on your local machine. 
@@ -225,6 +173,8 @@ Don't forget to open new user session after installing the packages.
 
 ### Building
 
+#### Native build
+
 Create a GOPATH variable(must be a full path):
 ```bash
  export GOPATH=$(realpath ~/workspace_go)
@@ -249,6 +199,20 @@ And to install `xds-server` (by default in `/usr/local/bin`):
 >make install DESTDIR=$HOME/opt/xds-server
 >```
 
+#### XDS docker image
+
+As an alternative to a pre-build image, you can rebuild the container from scratch. 
+`xds-server` has been integrated as a flavour of AGL SDK docker image. 
+So to rebuild docker image just execute following commands:
+
+```bash
+# Clone docker-worker-generator git repo
+git clone https://git.automotivelinux.org/AGL/docker-worker-generator
+# Start build that will create a docker image
+cd docker-worker-generator
+make build FLAVOUR=xds
+```
+
 ### Configuration
 
 `xds-server` configuration is driven by a JSON config file (`config.json`).
@@ -262,7 +226,7 @@ Here is the logic to determine which `config.json` file will be used:
 Supported fields in configuration file are (all fields are optional and listed values are the default values):
 ```
 {
-    "HTTPPort": 8000,
+    "httpPort": 8000,                               # HTTP port of client webapp / dashboard
     "webAppDir": "webapp/dist",                     # location of client dashboard (default: webapp/dist)
     "shareRootDir": "${HOME}/.xds/projects",        # root directory where projects will be copied
     "logsDir": "/tmp/logs",                         # directory to store logs (eg. syncthing output)
@@ -278,6 +242,7 @@ Supported fields in configuration file are (all fields are optional and listed v
 
 >**NOTE:** environment variables are supported by using `${MY_VAR}` syntax.
 
+
 ## Debugging
 
 ### XDS server architecture