Add target to get Syncthing and start server script.
[src/xds/xds-server.git] / README.md
1 # XDS - X(cross) Development System
2
3 XDS-server is a web server that allows user to remotely cross build applications.
4
5 The first goal is to provide a multi-platform cross development tool with
6 near-zero installation.
7 The second goals is to keep application sources locally (on user's machine) to
8 make it compatible with existing IT policies (e.g. corporate backup or SCM).
9
10 This powerful webserver (written in [Go](https://golang.org)) exposes a REST
11 interface over HTTP and also provides a Web dashboard to configure projects and execute only _(for now)_ basics commands.
12
13 XDS-server also uses [Syncthing](https://syncthing.net/) tool to synchronize
14 projects files from user machine to build server machine or container.
15
16 > **NOTE**: For now, only Syncthing sharing method is supported to synchronize
17 projects files.
18
19 > **SEE ALSO**: [xds-make](https://github.com/iotbzh/xds-make), a wrapper on `make`
20 command that allows you to build your application from command-line through
21 xds-server.
22
23
24 ## How to build
25
26 ### Dependencies
27
28 - Install and setup [Go](https://golang.org/doc/install) version 1.7 or
29 higher to compile this tool.
30 - Install [npm](https://www.npmjs.com/) : `sudo apt install npm`
31 - Install [gulp](http://gulpjs.com/) : `sudo npm install -g gulp-cli`
32
33
34 ### Building
35
36 Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile:
37 ```bash
38  mkdir -p $GOPATH/src/github.com/iotbzh
39  cd $GOPATH/src/github.com/iotbzh
40  git clone https://github.com/iotbzh/xds-server.git
41  cd xds-server
42  make all
43 ```
44
45 And to install xds-server in /usr/local/bin:
46 ```bash
47 make install
48 ```
49
50 ## How to run
51
52 ## Configuration
53
54 xds-server configuration is driven by a JSON config file (`config.json`).
55
56 Here is the logic to determine which `config.json` file will be used:
57 1. from command line option: `--config myConfig.json`
58 2. `$HOME/.xds/config.json` file
59 3. `<xds-server executable dir>/config.json` file
60
61 Supported fields in configuration file are:
62 ```json
63 {
64     "webAppDir": "location of client dashboard (default: webapp/dist)",
65     "shareRootDir": "root directory where projects will be copied",
66     "syncthing": {
67         "home": "syncthing home directory (usually .../syncthing-config)",
68         "gui-address": "syncthing gui url (default http://localhost:8384)"
69     }
70 }
71 ```
72
73 >**NOTE:** environment variables are supported by using `${MY_VAR}` syntax.
74
75 ## Start-up
76
77 Use `xds-start-server.sh` script to start all requested tools
78 ```bash
79 /usr/local/bin/xds-start-server.sh
80 ```
81
82 >**NOTE** you can define some environment variables to setup for example
83 config file `XDS_CONFFILE` or change logs directory `LOGDIR`.
84 See head section of `xds-start-server.sh` file to see all configurable variables.
85
86
87 ## Debugging
88
89 ### XDS server architecture
90
91 The server part is written in *Go* and web app / dashboard (client part) in
92 *Angular2*.
93
94 ```
95 |
96 +-- bin/                where xds-server binary file will be built
97 |
98 +-- config.json.in      example of config.json file
99 |
100 +-- glide.yaml          Go package dependency file
101 |
102 +-- lib/                sources of server part (Go)
103 |
104 +-- main.go             main entry point of of Web server (Go)
105 |
106 +-- Makefile            makefile including
107 |
108 +-- README.md           this readme
109 |
110 +-- tools/              temporary directory to hold development tools (like glide)
111 |
112 +-- vendor/             temporary directory to hold Go dependencies packages
113 |
114 +-- webapp/             source client dashboard (Angular2 app)
115 ```
116
117 Visual Studio Code launcher settings can be found into `.vscode/launch.json`.
118
119
120 ## TODO:
121 - replace makefile by build.go to make Windows build support easier
122 - add more tests
123 - add more documentation