Used standard DESTDIR variable in make install
[src/xds/xds-agent.git] / README.md
1 # XDS - X(cross) Development System Agent
2
3 XDS-agent is an agent that should run on your local machine when you use XDS.
4
5 This agent takes care of starting [Syncthing](https://syncthing.net/) tool to
6 synchronize your projects files from your local machine to build server machine
7 or container.
8
9
10 > **SEE ALSO**: [xds-server](https://github.com/iotbzh/xds-server), a web server
11 used to remotely cross build applications.
12
13
14 ## How to build
15
16 ### Dependencies
17
18 - Install and setup [Go](https://golang.org/doc/install) version 1.8 or
19 higher to compile this tool.
20
21
22 ### Building
23
24 Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile:
25 ```bash
26  mkdir -p $GOPATH/src/github.com/iotbzh
27  cd $GOPATH/src/github.com/iotbzh
28  git clone https://github.com/iotbzh/xds-agent.git
29  cd xds-agent
30  make all
31 ```
32
33 And to install xds-agent (by default in `/usr/local/bin`):
34 ```bash
35 make install
36 ```
37
38 >**NOTE:** Used `DESTDIR` to specify another install directory
39 >```bash
40 >make install DESTDIR=$HOME/opt/xds-agent
41 >```
42
43
44 #### Cross build
45 For example on a Linux machine to cross-build for Windows, just execute:
46 ```bash
47 export GOOS=windows
48 export GOARCH=amd64
49 make all
50 make package
51 ```
52
53 ## How to run
54
55 ## Configuration
56
57 xds-agent configuration is driven by a JSON config file (`agent-config.json`).
58
59 Here is the logic to determine which `agent-config.json` file will be used:
60 1. from command line option: `--config myConfig.json`
61 2. `$HOME/.xds/agent-config.json` file
62 3. `<current dir>/agent-config.json` file
63 4. `<xds-agent executable dir>/agent-config.json` file
64
65 Supported fields in configuration file are:
66 ```json
67 {
68     "httpPort": "http port of agent REST interface",
69     "logsDir": "directory to store logs (eg. syncthing output)",
70     "syncthing": {
71         "binDir": "syncthing binaries directory (use xds-agent executable dir when not set)",
72         "home": "syncthing home directory (usually .../syncthing-config)",
73         "gui-address": "syncthing gui url (default http://localhost:8384)",
74         "gui-apikey": "syncthing api-key to use (default auto-generated)"
75     }
76 }
77 ```
78
79 >**NOTE:** environment variables are supported by using `${MY_VAR}` syntax.
80
81 ## Start-up
82
83 ```bash
84 ./bin/xds-agent.sh
85
86 # OR if you have install agent
87
88 /usr/local/bin/xds-agent.sh
89 ```
90
91 >**NOTE** you can define some environment variables to setup for example
92 config file `XDS_CONFIGFILE` or change logs level `LOG_LEVEL`.