TLDR; Getting Started With Bundler

This page will explain on how to get started with Legion via Bundler. If you just want to install the gem and skip bundler, go to this TLDR

Instructions

Installation, running basics

  1. git clone https://bitbucket.org/legion-io/legion.git

  2. cd legion

  3. bundle update

  4. bundle exec exe/legion

  5. Control+C to exit

Installing a LEX

  1. Edit Gemfile to add in the lex(s) you want

  2. Add a line like this gem 'lex-http'

  3. Repeat for each LEX you want to install

  4. Run bundle update

Configuring Legion

  1. Legion will look in the following paths, in this order and stop when it finds a valid directory

    1. /etc/legionio

    2. "#{ENV['home']}/legionio"

    3. ~/legionio

    4. ./settings

    5. ./

  2. Legion will then load all .json files and merge them into Legion::Settings (see examples below)

  3. If Legion is running, you will need to stop and start it to have the new settings take affect

  4. LEX Settings can be added to the json configs directly, example LEX::Pushover requires the token setting so you can do this {”extensions”:{”pushover”:{”token”:”abc”}}}

 

Config Examples

{ "transport": { "vhost": "legion", "connection": { "host": "rabbitmq-server.local.domain", "user": "legion", "password": "legion", "vhost": "legion", "heartbeat": 10 }, "messages": { "encrypt": false }, "prefetch": 20 } }
{ "data": { "creds": { "host":"host.docker.internal", "password": "foobar" }, "connection": { "max_connections": 100, "preconnect": false } } }
{ "extensions": { "esphome": { "enabled": true }, "conditioner": {}, "health": { "enabed": false }, "http": {}, "lex": { "enabled": true }, "log": { "enabled": true, "workers": 5 }, "pushover": { "workers": 1, "token": "abcd1234567890" }, "scheduler": { "enabled": true, "workers": 11 }, "tasker": { "enabled": true, "workers": 10, "logger":{ "trace": true, "extended": true, "level":"debug" } }, "transformer": { "enabled": true } } }

 

 

 

When using Bundler, LEXs will not be installed automatically. If you run the legion command after installing the legion gem, it will automatically install the gems needed on start. This is a major difference between using bundler and using the gem directly

Related articles