Rémi Robert 9ca25af309 Improve plugin management
- Configure plugins from config file
- Option to disable plugin loading from the web interface
2017-11-22 23:10:19 +01:00
2017-11-22 23:10:19 +01:00
2017-10-17 22:05:17 +02:00
2017-11-08 22:01:07 +01:00
2017-11-22 23:10:19 +01:00
2017-11-22 22:29:48 +01:00
2017-11-22 23:10:19 +01:00
2017-11-21 22:55:52 +01:00
2017-11-09 21:17:35 +01:00
2017-11-21 22:55:52 +01:00
2017-11-22 23:10:19 +01:00
2017-11-22 23:10:19 +01:00
2017-11-09 21:54:33 +01:00
2017-11-22 23:10:19 +01:00

Lagenhet

Appartment monitoring Solution. Lagenhet can be used to centralized appartment offer from different sources and display them in a uniform and user friendly way.

Through Web push notification Lagenhet can also quickly altert the user when an interesting offer is posted.

Build

Requirements

The following software is required to build Lagenhet:

  • Golang (tested with version 1.8.3)
  • NodeJs (tested with version 6.9.1)
  • Npm
  • Govendor

To install these please refer to the documentation of your Linux distribution.

Setup

You need to install both Golang and JavaScript using govendor and npm. This can be done using the Makefile setup target:

  make setup

Building

You can build a full release of Lagenhet (backend and frontend) using the 'release' target:

  make release

This will generate a 'lagenhet.tar.gz' file containing all that is required to use Lagenhet (server binary, plugins and frontend).

Usage

Extract the lagenhet.tar.gz archive, cd into the folder and run the lagenhet binary.

The server can be configured using a json file. An example is provided in the 'config.json.example' file.

By default the server looks for a config file called 'config.json' in the current folder. This can be overidden using the LAGENHET_CONFIG environment variable.

The configuration expects the following parameters:

  • Database: follows the parameters used here: http://jinzhu.me/gorm/database.html#connecting-to-a-database
    • Dialect: SQL Variant
    • ConnectionString: Server connection information
  • Server:
    • Address: Address String
    • Cors: Enable Cors Middleware. It is not safe for production, to use for debugging only
    • CorsDomain: Origin to allow in Cors
  • CsrfKey: 32 characters long string to use as key for the CSRF Tokens
  • WebLoad: Enable the loading of plugins through the web interface (possibly usafe)
  • Plugins: Dictionnary containing the path to the plugins to loaded
  • PluginConfigs: Dictionnary containing the plugins configurations

You can force the server to reload the plugin configuration from the config file by sending SIGHUP.

NOTE: All plugins must be disabled for the reload operation to be possible.

First start

At the first start, the server will wait for you to create the admin user. You can do so by sending a POST request to the /install endpoint. For instance with curl:

  curl --request POST \
  --url http://localhost:3001/install \
  --header 'content-type: application/json' \
  --data '{\n	"Email": "toto@pipo.fr",\n	"Username": "airremi",\n "Password": "abc"\n}'

When this is done is should be possible to use the website normally.

Configuration

To use Lagenhet you need to:

  1. Add at least one plugin. Configure and enabe it
  2. Create at least one input box (with or without constraints)
  3. Configure the Ticker interval and start it

Architecture

Lagenhet is built around three concepts: Plugin, Ticker and Box.

Plugin

A Plugin is a module that is used to extract information about appartments. It can be for instance a we scrapper that retrieves the offers from a website.

The plugins are not built into the server but loaded dynamically from .so files. The plugin must be compiled for the exact version of the code the server is running.

Plugins can be managed from the Plugins tab in the administration panel. Only the administrator can manage them. There are two parameters that can be modified for a plugin: it can be enabled or disabled and a configuration URL can be provided.

Ticker

The ticker is the component responsible for executing the plugins at a configurable interval. Only the enabled plugins are executed by the Ticker.

The ticker can be managed by the admin through the Ticker tab in the admin panel. It is possible to modify the polling interval and start/stop the ticker.

Box

A Box is a container used to store appartments. There are 2 types of boxes:

  • Input: These boxes are filled by the ticker when appartments are fetched through the plugins.
  • Archive: These boxes are only filled by the user (by moving or copying appartment to them). They are intended to be used to categorize interesting appartments.

Each input box can contains a set a constraints that limit the appartments that is can hold. Theses contraints are conditions executed on the differents fields of the appartment data structure. When the ticker is running it puts each appartments to all the input boxes for which it fulfils the contraints. This means that an appartment can be duplicated and placed in several boxes.

For the input boxes, it is possible to enable notification to warn the user when an appartment is added to the box. Each browser that is to receive notification must be first registered through the notification settings tab on the site.

Description
No description provided
Readme 204 KiB