Native Installation

Installation Backend

The installation of the backend is straight forward, at the moment only available from source. Clone the GitLab repository onto your server and install the requirements for the backend implementation, found in web/api.

How to install the required packages is described in this section

Getting the Source

Note

The backend and frontend are both part of the same repository - the backend source is located at web/api, the frontend source at web/ui.

Clone the GitLab repository

Using https:

git clone https://gitlab.ti.bfh.ch/muscle/muscle.git

Using ssh:

git clone git@gitlab.ti.bfh.ch:muscle/muscle.git

Installation

After successfully cloning the repository, change into the web/api directory and install the dependencies

Configuration Backend

The backend configuration is done via environment variables. The easiest way to configure the application is to place a file called .muscleenv in the top level backend directory.

Inside this file you can export the configurations which you need.

Serve the Backend

Note

Make sure the dependecies are installed before starting here

Its recommended to use a server application to serve the backend API. How to finally serve the backend over the ethernet, read the description in section webservers.

Installation Frontend

The frontend is built from source, from the web/ui directory of the same repository as the backend:

cd web/ui
npm install
npm run build

This produces a dist/ directory containing the compiled application, which must then be deployed via a server.

Configuration Frontend

The web application supports different optional configurations. To enable those configurations, copy the file application.config.json.tpl inside the downloaded directory at config/ to config/application.config.json.

If config/application.config.json does not exist, the default configuration is taken, which assumes that the frontend is served over the same server as the backend. All options inside the file are optional, only the configured values are used, others will stay at their default.

The file provides the following structure:

{
  "server": {},
  "device": {}
}

server

Backend configuration with the following options:

name

The server URL. If the server uses a port then the port must also be specified here. If this value is omitted the backend is assumed over the same URL and port as the frontend.

protocol

The protocol to use to call the server. If this value is omitted the backend is assumed via the same protocol as the frontend.

timeout

The timeout for backend responses, defaults to 1 second.

device

Device configuration with the following options:

defaultAPIVersion

The device RPC API version which is used for devices that do not set apiVersion in their device.json. Can be either "v1" or "v2", defaults to "v2".

See the API Version section of the device implementation for a description of the versions.

Example

An example configuration may look like this:

{
  "server": {
    "name": "localhost:8080",
    "protocol": "http",
    "timeout": 1000
  },
  "device": {
    "defaultAPIVersion": "v2"
  }
}

Serve the Frontend

To serve the frontend there is a need for a proper server. How to finally serve the frontend over the ethernet, read the description in section webservers.

Webservers

Both applications listed above need to be served by a server. Its recommended to serve both instances by the same server. However, it is also possible to serve them separately on different servers.

These are the currently supported servers, however, you may choose another one which fits you more.