Speculare
  • ℹ️About
  • ⏳TimescaleDB
  • Speculare Server
    • Getting started
  • Speculare Alerts
    • Getting started
  • Speculare PGCDC
    • Getting started
    • How does it works
  • Speculare Client
    • Getting started
Powered by GitBook
On this page
  1. Speculare Server

Getting started

PreviousTimescaleDBNextGetting started

Last updated 1 year ago

is the core of the infrastructure. It is where all clients will send their metrics and where the dashboard will ask for historical data.

Setup

As of now Speculare Server does not provide easy setup solution such as a one-line installer (but it's planned). The current recommanded way to install Speculare Server is to build it from source. But don't be afraid, it's easy and straightforwards.

Install dependencies

Speculare Alerts is a Rust project that rely on some dependencies to be able to be built correctly. Much of them are default deps in most servers.

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install APT dependencies
sudo apt-get install libssl-dev libpq-dev pkg-config build-essential cmake

Build the binary

You can build the binary using:

cargo build --release

The resulting binary will be located in ./target/release/server.

Configuration files

The server binary depends on a server.config file whose path will be passed as arguments to the binary (default location is XXX).

You can create your server.config from the server.example.config given in the source code.

speculare-server "path/to/server.config"

Apply setup migration to construct database

For this step you will have to methods:

This is the easiest solution... Just do nothing and the migrations will be applied automatically. Once you launch the binary, it will check if all the lastest migrations has been applied, and will applied them if not.

You might, however need to create the DATABASE inside TimescaleDB.

CREATE DATABASE database_name;

This method is recommended if you want to work on the development of Speculare.

# Install the diesel_cli tool
cargo install diesel_cli --no-default-features --features postgres

# For diesel setup to works you need to be at the root of the project
diesel setup --database-url="postgres://xxx"

# If you've installed the diesel_cli you can also use it's migration commands
diesel migration run/add/revert/redo --database-url="postgres://xxx"

Install as a service

Here is a sample speculare-server.service for systemd:

[Unit]
Description=Speculare Server Process
After=network.target postgresql.service
StartLimitIntervalSec=600
StartLimitBurst=10

[Service]
Restart=on-failure
RestartSec=60s
Group=www-data
ExecStart=/root/speculare-server/target/release/speculare-server -c "path/to/server.config"

[Install]
WantedBy=multi-user.target

The above service will start after postgres, this is important. The server cannot start before postgresql.

Speculare Server