ar3ph.github.io

One Directory Lounge

The Lounge is a self-hosted IRC web client. I don’t find the official setup guide very good, so I’m doing it differently. Here is what I did. This could also be useful for managing any npm pacakge.

asdf

Gotta have Node to run a Node application. asdf is a version manager for different development tools including Node.js, and I’m using it to install node. In fact, I recommend keeping asdf on your system. It’s very handy.

To download the executable:

1ASDF_VERSION=0.18.0
2wget https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-amd64.tar.gz
3tar xzvf asdf-v${ASDF_VERSION}-linux-amd64.tar.gz && rm asdf-v${ASDF_VERSION}-linux-amd64.tar.gz
4sudo mv asdf /usr/local/bin

Then add the shims in your $PATH by appending this line in your zshrc or bashrc:

1export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

The Lounge

Now, the Lounge is just a npm package. To setup nodejs and install the Lounge:

1mkdir ~/the_lounge
2cd ~/the_lounge
3
4asdf plugin add nodejs
5asdf set nodejs lts
6asdf install
7
8npm i thelounge

Start the server and stop it when it’s started:

1THELOUNGE_HOME="$HOME/the_lounge/data" asdf exec node node_modules/.bin/thelounge start

Use this command to add a user:

1THELOUNGE_HOME="$HOME/the_lounge/data" asdf exec node node_modules/.bin/thelounge add myuser

Now create the systemd service the_lounge@.service:

 1[Unit]
 2Description=The Lounge IRC Client
 3After=network.target
 4
 5[Service]
 6Type=simple
 7User=%i
 8Group=%i
 9WorkingDirectory=/home/%i/the_lounge
10Environment=THELOUNGE_HOME=/home/%i/the_lounge/data
11ExecStart=/bin/bash -c 'asdf exec node node_modules/.bin/thelounge start'
12Restart=on-failure
13RestartSec=5
14
15[Install]
16WantedBy=multi-user.target

Install the systemd service system-wide:

1sudo ln -sf ~/the_lounge/the_lounge@.service /etc/systemd/system/

Now enable and start it, and you will have the Lounge running at port 9000:

1sudo systemctl enable --now the_lounge@your-user

When you backup you should just backup $HOME/the_lounge directory. It’s a docker-less “one directory lounge”.

#Linux #IRC