Skip to content

systemd

Oscar Javier Gentilezza Arenas edited this page Jul 16, 2017 · 1 revision

System requirements

The system requirements are only node.js v6.10.0 or greater and, for a problem with a dependency, git.

To install node.js you can follow this page.

Install

With nodejs we can use npm directly, to install this version (beta), you need to expecified the next version, as root:

# npm install -g ircgrampp@next

Running in user-space

Ircgrampp uses the user's home to store the configuration and channels information if it's running as user. In the meantime, we go to create the unit as user service

Setting up all bridges

You can start all bridges at the same time, with the same unit file, or manage each bridge taking advantage of the --only option.

To manage all bridges with a simple unit, we need to create the file: ~/.local/share/systemd/user/ircgrampp.service (The path may not exist), with te follow content:

[Unit]
Description=Telegram <-> IRC bridge

[Service]
TimeoutStartSec=5
Restart=always
Environment="DEBUG='session,bridge'"
ExecStart=/usr/bin/ircgrampp start

[Install]
WantedBy=default.target

To start all bridges execute:

$ systemctl --user start ircgrampp

And to enable:

$ systemctl --user enable ircgrampp

Setting up bridge per service instance

The other option is make a service by each bridge, and manage the bridges with systemd, we need to do other file called ~/.local/share/systemd/user/[email protected] (notice the @), with the follow content:

[Unit]
Description=Telegram <-> IRC bridge for %i

[Service]
TimeoutStartSec=5
Restart=always
Environment="DEBUG='session,bridge'"
ExecStart=/usr/bin/ircgrampp start --only %i

[Install]
WantedBy=default.target

In this case, we can control manually each bridge starting service as:

$ systemctl --user start ircgrampp@bridgename

Running is system space

In version 0.2.x and follow can use the /etc directory and set a specific UID and GID if it's running as root.

Creating directories and user

We can run the config wizard as root to create directories and global settings in the /etc directory:

# ircgrampp config

Now, the configuration asked for the user and group to run the service, we must create an user/group for this propouse:

# groupadd ircgrampp
# useradd -rg ircgrampp ircgrampp

When the configuration wizzard asked, we need to define ircgrampp in both.

Note: The configuration wizard create the diretory /var/lib/ircgrampp, but with uid/gid root, and it's are going to generate access problems, we need change the user/group:

# usermod ircgrampp:ircgrampp /var/lib/ircgrampp

Configure bridges

You can use the wizard to create a new bridges, or make it manually in /etc/ircgrampp.

Creating unit file

We need to create a unit file in /etc/systemd/system/[email protected], you can download this unitfile from:

https://gist.github.com/exos/f4473a7cf8f671fa80610670b59b50f9

Once created this file, we can startup each bridge with:

# systemctl start ircgrampp@bridgename

And enable:

# systemctl enable ircgrampp@bridgename

If you follow this steeps, you must to get the service running and working. To read logs you can use journalctl:

# journalctl -xefu ircgrampp@bridgename

If you need more debug information, you can edit [email protected] and replace:

Environment=DEBUG=session,-node-telegram-bot-api

By:

Environment=DEBUG=*,-node-telegram-bot-api

Also you too try it alone:

# systemctl stop ircgrampp@bridgename
# DEBUG="*,-node-telegram-bot-api" ircgrampp start --only bridgename

Clone this wiki locally