How to setup KiwiIRC on Ubuntu 18.04

From IRC Wiki
Jump to: navigation, search
This article is a rough draft. Some items in the article may be incomplete or may not work as intended. You can help by learning how to Contribute to the article.

This guide will walk you through setting up KiwiIRC on your Ubuntu 18.04 server. These steps should also work for Debian, other versions of Ubuntu, and their derivatives.

Prerequisites

Before you begin you will need root access on the server, as well as a few packages. I'm not going to go through the web server setup but it shouldn't matter which web server daemon that you use.

# apt-get install golang nodejs npm
# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# apt-get update && apt-get install yarn

Download & Prepare KiwiIRC Files

$ git clone https://github.com/kiwiirc/kiwiirc.git
$ cd kiwiirc/
$ yarn install
$ yarn build

If you get this error while running yarn install please follow the "Installing nodejs" section, otherwise skip it: The engine "node" is incompatible with this module. Expected version ">=6".

Now move the contents of the dist/ directory to your web root directory. Once moved edit static/config.json to your licking.

Installing nodejs

# curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
# apt-get install -y nodejs

Setting up the WebIRC Gateway

This step isn't really required since the front end will connect to official kiwiirc servers just fine. However if you want to run your own back-end servers for kiwiirc you can.

# adduser kiwiirc # follow the prompts.
# su - kiwiirc
$ go get github.com/kiwiirc/webircgateway
$ cd $HOME/go/src/github.com/kiwiirc/webircgateway
$ go build -o webircgateway main.go

WebIRC Gateway configuration

Modify and save this configuration as config.json then feel free to run your kiwiserver by typing $HOME/go/bin/webircgateway --config /path/to/config.json

# 1 = Debug; 2 = Info; 3 = Warn;
logLevel = 3

# Enable the built in identd server (listens on port 113)
identd = false

gateway_name = ""

[verify]
recaptcha_secret = ""
recaptcha_key = ""

[clients]
# Default username / realname for IRC connections. If disabled it will use
# the values provided from the IRC client itself.
# %h will be replaced with the users hostname
# %i will be replaced with a hexed value of the users IP
#username = "%i"
#realname = "I am a webchat user"

# This hostname value will only be used when using a WEBIRC password
#hostname = "%h"

# The websocket / http server
[server.1]
bind = "0.0.0.0"
port = 80

# Example TLS server
#[server.2]
#bind = "0.0.0.0"
#port = 443
#tls = true
#cert = server.crt
#key = server.key
# If you don't have a certificate, uncomment the below line to automatically generate a
# free certificate using letsencrypt.com (overrides the above cert/key options)
#letsencrypt_cache = letsencrypt.cache

# Example unix socket server
#[server.3]
#bind = unix:/tmp/webircgateway.sock
#bind_mode = 0777

# Serve static files from a web root folder.
# Optional, but handy for serving the Kiwi IRC client if no other webserver is available
[fileserving]
enabled = false
webroot = www/

[engines]
websocket
sockjs
kiwiirc

# Websites (hostnames) that are allowed to connect here
# No entries here will allow any website to connect.
[allowed_origins]
#*://example.com

# If using a reverse proxy, it must be whitelisted for the client
# hostnames to be read correctly. In CIDR format.
# The user IPs are read from the standard X-Forwarded-For HTTP header
[reverse_proxies]
127.0.0.0/8
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
"::1/128"
"fd00::/8"

# Connections will be sent to a random upstream
[upstream.1]
hostname = "irc.example.net"
port = 6667
tls = false
# Connection timeout in seconds
timeout = 5
# Throttle the lines being written by X per second
throttle = 2
webirc = ""


# A public gateway to any IRC network
# If enabled, Kiwi IRC clients may connect to any IRC network (or a whitelisted
# network below) through the kiwiirc engine
[gateway]
enabled = false
timeout = 5
throttle = 2

# Whitelisted IRC networks while in public gateway mode
# If any networks are in this list then connections can only be made to these
[gateway.whitelist]
#irc.example.com
#*.example2.com

[gateway.webirc]
irc.network.org = webirc_password
irc.network2.org = webirc_password