mirror of
https://github.com/jimeh/docker-znc.git
synced 2026-02-19 09:56:43 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e195980a5 | |||
| 9929223677 | |||
| 439ffb6635 | |||
| 98858ea7b3 | |||
|
|
a2911e8e71 | ||
| dfd7a47e79 | |||
| 172bcb6f2d | |||
|
|
901b5d3df2 | ||
|
|
7988d12cc4 | ||
| ff739de9db |
@@ -1,5 +1,5 @@
|
|||||||
# version 1.6.1-1
|
# version 1.6.1-2
|
||||||
# docker-version 1.8.2
|
# docker-version 1.11.1
|
||||||
FROM ubuntu:15.04
|
FROM ubuntu:15.04
|
||||||
MAINTAINER Jim Myhrberg "contact@jimeh.me"
|
MAINTAINER Jim Myhrberg "contact@jimeh.me"
|
||||||
|
|
||||||
@@ -7,13 +7,13 @@ ENV ZNC_VERSION 1.6.1
|
|||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y sudo wget build-essential libssl-dev libperl-dev \
|
&& apt-get install -y sudo wget build-essential libssl-dev libperl-dev \
|
||||||
pkg-config swig3.0 libicu-dev \
|
pkg-config swig3.0 libicu-dev ca-certificates \
|
||||||
&& mkdir -p /src \
|
&& mkdir -p /src \
|
||||||
&& cd /src \
|
&& cd /src \
|
||||||
&& wget "http://znc.in/releases/archive/znc-${ZNC_VERSION}.tar.gz" \
|
&& wget "http://znc.in/releases/archive/znc-${ZNC_VERSION}.tar.gz" \
|
||||||
&& tar -zxf "znc-${ZNC_VERSION}.tar.gz" \
|
&& tar -zxf "znc-${ZNC_VERSION}.tar.gz" \
|
||||||
&& cd "znc-${ZNC_VERSION}" \
|
&& cd "znc-${ZNC_VERSION}" \
|
||||||
&& ./configure \
|
&& ./configure --disable-ipv6 \
|
||||||
&& make \
|
&& make \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& apt-get remove -y wget \
|
&& apt-get remove -y wget \
|
||||||
|
|||||||
79
README.md
79
README.md
@@ -1,20 +1,21 @@
|
|||||||
# ZNC for Docker
|
# ZNC for Docker
|
||||||
|
|
||||||
Run the [ZNC](http://znc.in) IRC Bouncer in a Docker container.
|
Run the [ZNC][] IRC Bouncer in a Docker container.
|
||||||
|
|
||||||
|
[ZNC]: http://znc.in
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
1. Install [Docker](http://docker.io/).
|
1. Install [Docker][].
|
||||||
2. Make .znc folder: `mkdir $HOME/.znc`
|
|
||||||
|
|
||||||
|
[Docker]: http://docker.com/
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
To retain your ZNC settings between runs, you'll most likely want to
|
ZNC needs to store settings somewhere, so simplest way to run it is to mount a
|
||||||
bind a directory from the host to `/znc-data` in the container. For
|
directory from the host machine to `/znc-data` in the container:
|
||||||
example:
|
|
||||||
|
|
||||||
|
mkdir -p $HOME/.znc
|
||||||
docker run -d -p 6667 -v $HOME/.znc:/znc-data jimeh/znc
|
docker run -d -p 6667 -v $HOME/.znc:/znc-data jimeh/znc
|
||||||
|
|
||||||
This will download the image if needed, and create a default config file in
|
This will download the image if needed, and create a default config file in
|
||||||
@@ -30,18 +31,20 @@ Or if you want to specify which port to map the default 6667 port to:
|
|||||||
|
|
||||||
Resulting in port 36667 on the host mapping to 6667 within the container.
|
Resulting in port 36667 on the host mapping to 6667 within the container.
|
||||||
|
|
||||||
|
## Configuring ZNC
|
||||||
## Configuring
|
|
||||||
|
|
||||||
If you've let the container create a default config for you, the default
|
If you've let the container create a default config for you, the default
|
||||||
username/password combination is admin/admin. You can access the web-interface
|
username/password combination is `admin`/`admin`. You can access the
|
||||||
to create your own user by pointing your web-browser at the opened port.
|
web-interface to create your own user by pointing your web-browser at the opened
|
||||||
|
port.
|
||||||
|
|
||||||
|
For example, if you passed in `-p 36667:6667` like above when running the
|
||||||
|
container, the web-interface would be available on: `http://hostname:36667/`
|
||||||
|
|
||||||
I'd recommend you create your own user by cloning the admin user, then ensure
|
I'd recommend you create your own user by cloning the admin user, then ensure
|
||||||
your new cloned user is set to be an admin user. Once you login with your new
|
your new cloned user is set to be an admin user. Once you login with your new
|
||||||
user go ahead and delete the default admin user.
|
user go ahead and delete the default admin user.
|
||||||
|
|
||||||
|
|
||||||
## External Modules
|
## External Modules
|
||||||
|
|
||||||
If you need to use external modules, simply place the original `*.cpp` source
|
If you need to use external modules, simply place the original `*.cpp` source
|
||||||
@@ -53,19 +56,40 @@ This ensures that you can easily add new external modules to your znc
|
|||||||
configuration without having to worry about building them. And it only slows
|
configuration without having to worry about building them. And it only slows
|
||||||
down ZNC's startup with a few seconds.
|
down ZNC's startup with a few seconds.
|
||||||
|
|
||||||
|
## DATADIR
|
||||||
|
|
||||||
## Notes on DATADIR
|
ZNC stores all it's settings in a Docker volume mounted to `/znc-data` inside
|
||||||
|
the container.
|
||||||
|
|
||||||
ZNC needs a data/config directory to run. Within the container it uses
|
### Mount a Host Directory
|
||||||
`/znc-data`, so to retain this data when shutting down a container, you should
|
|
||||||
mount a directory from the host. Hence `-v $HOME/.znc:/znc-data` is part of
|
|
||||||
the instructions above.
|
|
||||||
|
|
||||||
As ZNC needs to run as it's own user within the container, the directory will
|
The simplest approach is typically to mount a directory off of your host machine
|
||||||
have it's ownership changed to UID 1000 (user) and GID 1000 (group). Meaning
|
into the container. This is done with `-v $HOME/.znc:/znc-data` like in the
|
||||||
after the first run, you might need root access to manually modify the data
|
example above.
|
||||||
directory.
|
|
||||||
|
|
||||||
|
One issue with this though is that ZNC needs to run as it's own user within the
|
||||||
|
container, the directory will have it's ownership changed to UID 1000 (user) and
|
||||||
|
GID 1000 (group). Meaning after the first run, you might need root access to
|
||||||
|
manually modify the data directory.
|
||||||
|
|
||||||
|
### Use a Volume Container
|
||||||
|
|
||||||
|
First we need to create a volume container:
|
||||||
|
|
||||||
|
docker run -v /znc-data --name znc-data busybox echo "data for znc"
|
||||||
|
|
||||||
|
And then run the znc container using the `--volumes-from` option instead of
|
||||||
|
`-v`:
|
||||||
|
|
||||||
|
docker run -d -p 6667 --name znc --volumes-from znc-data jimeh/znc
|
||||||
|
|
||||||
|
You'll want to periodically back up your znc data to the host:
|
||||||
|
|
||||||
|
docker run --volumes-from znc-data -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /znc-data
|
||||||
|
|
||||||
|
And restore them later:
|
||||||
|
|
||||||
|
docker run --volumes-from znc-data -v $(pwd):/backup busybox tar xvf /backup/backup.tar
|
||||||
|
|
||||||
## Passing Custom Arguments to ZNC
|
## Passing Custom Arguments to ZNC
|
||||||
|
|
||||||
@@ -82,6 +106,21 @@ Make note of the use of `-i` and `-t` instead of `-d`. This attaches us to the
|
|||||||
container, so we can interact with ZNC's makepass process. With `-d` it would
|
container, so we can interact with ZNC's makepass process. With `-d` it would
|
||||||
simply run in the background.
|
simply run in the background.
|
||||||
|
|
||||||
|
## A note about ZNC 1.6
|
||||||
|
|
||||||
|
Starting with version 1.6, ZNC now requires ssl/tls certificate verification!
|
||||||
|
This means that it will *not* connect to your IRC server(s) if they don't
|
||||||
|
present a valid certificate. This is meant to help keep you safer from MitM
|
||||||
|
attacks.
|
||||||
|
|
||||||
|
This image installs the debian/ubuntu `ca-certificates`
|
||||||
|
[package](http://packages.ubuntu.com/vivid/ca-certificates) so that servers with
|
||||||
|
valid certificates will automatically be connected to ensuring no additional
|
||||||
|
user intervention needed. If one of your servers doesn't have a valid
|
||||||
|
fingerprint, you will need to connect to your bouncer and respond to `*status`.
|
||||||
|
|
||||||
|
See [this](https://mikaela.info/english/2015/02/24/znc160-ssl.html) article for
|
||||||
|
more information.
|
||||||
|
|
||||||
## Building It Yourself
|
## Building It Yourself
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ if [ -d "${DATADIR}/modules" ]; then
|
|||||||
|
|
||||||
# Build modules.
|
# Build modules.
|
||||||
for module in $modules; do
|
for module in $modules; do
|
||||||
|
echo "Building module $module..."
|
||||||
cd "$(dirname "$module")"
|
cd "$(dirname "$module")"
|
||||||
znc-buildmod "$module"
|
znc-buildmod "$module"
|
||||||
done
|
done
|
||||||
@@ -23,13 +24,16 @@ fi
|
|||||||
|
|
||||||
# Create default config if it doesn't exist
|
# Create default config if it doesn't exist
|
||||||
if [ ! -f "${DATADIR}/configs/znc.conf" ]; then
|
if [ ! -f "${DATADIR}/configs/znc.conf" ]; then
|
||||||
|
echo "Creating a default configuration..."
|
||||||
mkdir -p "${DATADIR}/configs"
|
mkdir -p "${DATADIR}/configs"
|
||||||
cp /znc.conf.default "${DATADIR}/configs/znc.conf"
|
cp /znc.conf.default "${DATADIR}/configs/znc.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure $DATADIR is owned by znc user. This effects ownership of the
|
# Make sure $DATADIR is owned by znc user. This effects ownership of the
|
||||||
# mounted directory on the host machine too.
|
# mounted directory on the host machine too.
|
||||||
|
echo "Setting necessary permissions..."
|
||||||
chown -R znc:znc "$DATADIR"
|
chown -R znc:znc "$DATADIR"
|
||||||
|
|
||||||
# Start ZNC.
|
# Start ZNC.
|
||||||
|
echo "Starting ZNC..."
|
||||||
exec sudo -u znc znc --foreground --datadir="$DATADIR" $@
|
exec sudo -u znc znc --foreground --datadir="$DATADIR" $@
|
||||||
|
|||||||
Reference in New Issue
Block a user