Update Readme
[src/xds/xds-agent.git] / README.md
1 # XDS - X(cross) Development System Agent
2
3 XDS-agent is a client that should run on your local / user development machine when you use XDS.
4
5 This agent takes care, among others, of starting [Syncthing](https://syncthing.net/)
6 tool to synchronize your project files from your local host to XDS build server
7 machine or container (where `xds-server` is running).
8
9 > **SEE ALSO**: [xds-server](https://github.com/iotbzh/xds-server), a web server
10 used to remotely cross build applications.
11
12 ## How to install xds-agent
13
14 ### Install package for debian distro type
15
16 ```bash
17 export DISTRO="Debian_8.0"
18 wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add -
19 sudo bash -c "cat >/etc/apt/sources.list.d/AGL.list<<EOL
20 #AGL
21 deb http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/ ./
22 EOL
23 "
24 sudo apt-get update
25 sudo apt-get install agl-xds-agent
26 ```
27
28 The value 'DISTRO' can be set to {Debian_8.0, Debian_9.0, xUbuntu_16.04, xUbuntu_16.10, xUbuntu_17.04}
29
30 Update the package
31
32 ```bash
33 sudo apt-get update
34 sudo apt-get upgrade agl-xds-agent
35 ```
36
37 The files are install here:
38
39 ```bash
40 /opt/AGL/agl-xds-agent
41 ```
42
43 ### Install package for rpm distro type
44
45 #### openSUSE
46
47 ```bash
48 export DISTRO="openSUSE_Leap_42.2"
49 sudo zypper ar http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/isv:LinuxAutomotive:app-Development.repo
50 sudo zypper ref
51 sudo zypper install agl-xds-agent
52 ```
53
54 The value 'DISTRO' can be set to {openSUSE_Leap_42.2, openSUSE_Leap_42.3, openSUSE_Tumbleweed}
55
56 Update the package
57
58 ```bash
59 sudo zypper ref
60 sudo zypper install --force agl-xds-agent
61 ```
62
63 The files are install here:
64
65 ```bash
66 /opt/AGL/agl-xds-agent
67 ```
68
69 ## How to install on other platform
70
71 You need to download `xds-agent` tarballs from xds dashboard by clicking
72 on download icon ![download icon](./resources/images/download_icon.jpg) of
73 configuration page.
74
75 > **NOTE** : you can also download released tarballs from github [releases page](https://github.com/iotbzh/xds-agent/releases).
76
77 Then unzip this tarball any where into your local disk.
78
79 ## Configuration
80
81 xds-agent configuration is driven by a JSON config file (named `agent-config.json`).
82 The tarball mentioned in previous section includes this file with default settings.
83
84 Here is the logic to determine which `agent-config.json` file will be used:
85
86 1. from command line option: `--config myConfig.json`
87 1. `$HOME/.xds/agent-config.json` file
88 1. `<current dir>/agent-config.json` file
89 1. `<xds-agent executable dir>/agent-config.json` file
90
91 Supported fields in configuration file are (all fields are optional and example
92 below corresponds to the default values):
93
94 - **httpPort** : http port of agent REST interface
95 - **logsDir**  : directory to store logs (eg. syncthing output)
96 - **xds-apikey** : xds-agent api-key to use (always set value to "1234abcezam")
97 - **syncthing.binDir** : syncthing binaries directory (default: executable directory)
98 - **syncthing.home"** : syncthing home directory (usually .../syncthing-config)
99 - **syncthing.gui-address** : syncthing gui url (default http://localhost:8384)
100 - **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated)
101
102 ```json
103 {
104     "httpPort": "8010",
105     "logsDir": "/tmp/logs",
106     "xds-apikey": "1234abcezam",
107     "syncthing": {
108         "binDir": ".",
109         "home": "${HOME}/.xds/syncthing-config",
110         "gui-address": "http://localhost:8384",
111         "gui-apikey": "1234abcezam",
112     }
113 }
114 ```
115
116 >**NOTE:** environment variables are supported by using `${MY_VAR}` syntax.
117
118 ## Start-up
119
120 Simply to start `xds-agent` executable
121
122 ```bash
123 ./xds-agent &
124 ```
125
126 >**NOTE** if need be, you can increase log level by setting option
127 `--log <level>`, supported *level* are: panic, fatal, error, warn, info, debug.
128
129 You can now use XDS dashboard and check that connection with `xds-agent` is up.
130 (see also [xds-server README](https://github.com/iotbzh/xds-server/blob/master/README.md#xds-dashboard))
131
132 ## Build xds-agent from scratch
133
134 ### Dependencies
135
136 Install and setup [Go](https://golang.org/doc/install) version 1.8 or
137 higher to compile this tool.
138
139 ### Building
140
141 Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile:
142
143 ```bash
144  mkdir -p $GOPATH/src/github.com/iotbzh
145  cd $GOPATH/src/github.com/iotbzh
146  git clone https://github.com/iotbzh/xds-agent.git
147  cd xds-agent
148  make all
149 ```
150
151 And to install xds-agent (by default in `/usr/local/bin`):
152
153 ```bash
154 make install
155 ```
156
157 >**NOTE:** Used `DESTDIR` to specify another install directory
158 >```bash
159 >make install DESTDIR=$HOME/opt/xds-agent
160 >```
161
162 #### Cross build
163
164 For example on a Linux machine to cross-build for Windows, just execute:
165
166 ```bash
167 export GOOS=windows
168 export GOARCH=amd64
169 make all
170 make package
171 ```