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