From 10cbaf23b5554847020c3f99bc4bf7d5314b3639 Mon Sep 17 00:00:00 2001 From: Brian Stanback Date: Fri, 20 Jan 2017 19:52:27 -0800 Subject: [PATCH] Initial commit --- README.md | 152 +++++++++++++++++++++++++++++++++++++++++++++ bitlbee/Dockerfile | 19 ++++++ znc/Dockerfile | 37 +++++++++++ 3 files changed, 208 insertions(+) create mode 100644 README.md create mode 100644 bitlbee/Dockerfile create mode 100644 znc/Dockerfile diff --git a/README.md b/README.md new file mode 100644 index 0000000..fd5fff4 --- /dev/null +++ b/README.md @@ -0,0 +1,152 @@ +In progress :bomb: + +# Docker-based Chat Gateway (Alpine Linux + Bitlbee + ZNC) + +This project is a combination of an IM to IRC service (Bitlbee) and +an IRC bouncer (ZNC) which keeps you connected, managing away status +and message buffers for all your devices. + +This is a setup I have personally used and evolved slightly since around 2008 +(of course back then without Docker or the improved message playback features). +The setup has served me well and continues to be useful. This repository is a +way to document my configuration as well as to share what I've learned and get +feedback. + +Feel free to fork and modify for your own needs or issue a pull request! + +## Bitlbee + +Bitlbee is an IRC server that acts as a bridge between the IRC protocol +and the protocols used by various instant messaging systemms +(Jabber/XMPP, Facebook, AIM/Oscar, Yahoo, MSN, ICQ, Skype, etc). + +The Docker image for Bitlbee that is part of this project includes +additional packages for Facebook chat and OTR that you may optionally +use. + +### Building Docker Image + +In the `bitlbee/` directory of this repository, run: + +``` +docker build \ + --rm=true \ + --tag=bitlbee \ + . +``` + +### Starting + +Create a directory for storing your user `data/`, then run: + +``` +docker run \ + -d \ + -v /etc/localtime:/etc/localtime:ro \ + -v $PWD/data:/var/lib/bitlbee:rw \ + --name=bitlbee \ + --restart=always \ + bitlbee +``` + +### Configuring + +Once you add the Bitlbee server in ZNC (below), you will be prompted +to register and configure. If you want to bypass ZNC and connect +to Bitlbee directly, simply add a port mapping using `-p 6667:6667` +when running the container, then connect up your client to the Docker +host. + +In addition to the settings you can configure from your IRC client, +there are some global options that you may set in +`/etc/bitlbee/bitlbee.conf` as well as the message in +`/etc/bitlbee/motd`. You can copy these locally into a `config` +directory and map with `-v $PWD/config:/etc/bitlbee:ro`. + +### Commands Quickstart + +TODO: Setting up user, adding networks, basic management + +## ZNC + +ZNC is an IRC bouncer, a system designed to keep you always connected to +your favorite IRC servers. I'm primarily using it with Bitlbee (above) +and Slack's IRC gateway. Other networks include places like Freenode, +Gitter, DALNet, EFNet, etc. + +ZNC includes a variety of useful plugins for keeping track of missed +messages, automatically setting away status, perforing commands with +ChanServ/NickServ, watching for particular words or phrases, and many more. + +The Docker image for ZNC that is part of this project includes additional +3rd party modules for push notifications with the Palaver iOS client (below), +partial message buffer playback, and separate buffers for your differnet clients. + +### Building Docker Image + +In the `znc/` directory of this repository, run: + +``` +docker build \ + --rm=true \ + --tag=znc \ + . +``` + +### Configuring ZNC + +Create a directory for storing your `data/`, then run: + +``` +docker run \ + -it \ + --rm=true \ + -v $PWD/data:/var/lib/znc \ + znc --makeconf +``` + +### Starting + +Replace 6697 with whatever port you configured in the previous step. +Symlinking localtime is optional, but was required for my IRC and system +timestamps to sync up. The `--link` command connects with a running +Bitlbee container, with this you can use the hostname `bitlbee` when +adding a new IRC server. + +``` +docker run \ + -d \ + -p 6697:6697 \ + -v /etc/localtime:/etc/localtime:ro \ + -v $PWD/data:/var/lib/znc \ + --name=znc \ + --restart=always \ + --link=bitlbee:bitlbee \ + znc +``` + +### Commands Quickstart + +TODO: Setup user, add network for Bitlbee, load and configure modules + +## Client Recommendations + +### OSX + +Recommendation: Textual + +### iOS + +Recommendation: Palaver, followed by Mobile Colloquy + +### Windows + +Recommendation: HexChat + +### Android + +Recommendation: HoloIRC + +### Linux + +Recommendation: Communi diff --git a/bitlbee/Dockerfile b/bitlbee/Dockerfile new file mode 100644 index 0000000..e01e4c2 --- /dev/null +++ b/bitlbee/Dockerfile @@ -0,0 +1,19 @@ +# +# Bitlbee (w/ Facebook and OTR) + Alpine Linux +# + +FROM alpine:edge + +RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ + apk --update add ca-certificates bitlbee@testing bitlbee-facebook@testing bitlbee-otr@testing && \ + adduser -h /var/lib/bitlbee -s /sbin/nologin -DH bitlbee && \ + chown -R bitlbee:bitlbee /var/lib/bitlbee && \ + touch /var/run/bitlbee.pid && \ + chown bitlbee:bitlbee /var/run/bitlbee.pid && \ + rm -rf /var/cache/apk/* + +USER bitlbee +VOLUME ["/var/lib/bitlbee"] +EXPOSE 6667/tcp + +ENTRYPOINT ["bitlbee", "-F", "-n"] diff --git a/znc/Dockerfile b/znc/Dockerfile new file mode 100644 index 0000000..8d5641a --- /dev/null +++ b/znc/Dockerfile @@ -0,0 +1,37 @@ +# +# ZNC + Alpine Linux +# Includes znc-palaver, znc-playback, znc-clientbuffer plugins +# + +FROM alpine:edge + +ENV PALAVER_URL https://github.com/Palaver/znc-palaver/archive/master.zip +ENV PLAYBACK_URL https://github.com/jpnurmi/znc-playback/archive/master.zip +ENV CLIENTBUFFER_URL https://github.com/jpnurmi/znc-clientbuffer/archive/master.zip + +# Append if desired: znc-modperl znc-modpython znc-modtcl +RUN apk --update add build-base openssl-dev wget unzip ca-certificates znc znc-dev znc-extra && \ + chown znc:znc /var/lib/znc && \ + wget -O /tmp/palaver.zip $PALAVER_URL && \ + unzip /tmp/palaver.zip -d /tmp && \ + cd /tmp/znc-palaver-master && \ + make && \ + cp palaver.so /usr/lib/znc/ && \ + wget -O /tmp/playback.zip $PLAYBACK_URL && \ + unzip /tmp/playback.zip -d /tmp && \ + cd /tmp/znc-playback-master && \ + znc-buildmod playback.cpp && \ + cp playback.so /usr/lib/znc && \ + wget -O /tmp/clientbuffer.zip $CLIENTBUFFER_URL && \ + unzip /tmp/clientbuffer.zip -d /tmp && \ + cd /tmp/znc-clientbuffer-master && \ + znc-buildmod clientbuffer.cpp && \ + cp clientbuffer.so /usr/lib/znc && \ + rm -rf /tmp/* && \ + apk del build-base openssl-dev wget unzip znc-dev && \ + rm -rf /var/cache/apk/* + +USER znc +VOLUME ["/var/lib/znc"] + +ENTRYPOINT ["znc", "--foreground", "--datadir=/var/lib/znc"]