21 Commits

Author SHA1 Message Date
6e195980a5 Bump version to 1.6.1-2 2016-05-26 01:35:56 +01:00
9929223677 Tweak readme file
Incorporates (more or less) some of the changes from #8.
2016-05-26 01:30:14 +01:00
439ffb6635 Merge pull request #16 from magcius/patch-1
Disable ipv6 by default
2016-05-26 00:51:51 +01:00
98858ea7b3 Merge pull request #14 from InAnimaTe/master
More verbosity on start and ca-certificates package
2016-05-26 00:47:38 +01:00
Jasper St. Pierre
a2911e8e71 Disable ipv6 by default
Since Docker doesn't install ipv6 iptables rules by default, we probably shouldn't build with it on.

Fixes #15.
2016-01-02 09:27:21 -08:00
dfd7a47e79 Fix formatting in readme 2015-12-07 14:30:48 +00:00
172bcb6f2d Update readme with web-interface details 2015-12-07 14:29:57 +00:00
Mario Loria
901b5d3df2 install ca-certificates package because 1.6 2015-12-06 22:56:04 -05:00
Mario Loria
7988d12cc4 added a little more verbosity 2015-12-06 22:55:40 -05:00
ff739de9db Update readme so it renders correctly on hub.docker.com 2015-09-20 17:43:40 +01:00
48fb699f4b Update ZNC to v1.6.1
And also restructure the Dockerfile a bit.
2015-09-20 17:37:41 +01:00
3dfefba576 Merge pull request #10 from MattHardcastle/fix-text-file-busy
Split /tmp/bootstrap.sh chmod and exec commands
2015-08-15 22:23:03 +01:00
Matt Hardcastle
4e6a5d4dc7 Split /tmp/bootstrap.sh chmod and exec commands
When I ran the original I got the following error:

    Step 3 : RUN chmod +x /tmp/bootstrap.sh && /tmp/bootstrap.sh
     ---> Running in 62f54b7a5e6d
    /bin/sh: 1: /tmp/bootstrap.sh: Text file busy

Splitting the two commands up seems to give the text file enough time to
finish up. I suppose a slight sleep could also be added inbetween the
two commands if one was worried about creating too many images.
2015-08-15 11:44:05 -07:00
5a826aad15 Update readme with info about DATADIR permissions 2014-07-10 20:19:33 +01:00
cc821dec0c Fix permissions issue with data dir
If the mounted data directory on the host is owned by root, the znc user
within the container would fail to write any settings to disk.

Hence this changes ownership of the data directory to the znc user (Uid:
1000) and znc group (Gid: 1000) from within the container.
2014-07-10 20:10:10 +01:00
01d3e5eb53 Update default config for ZNC 1.4 2014-07-10 20:09:42 +01:00
8712e23e5e Add custom arguments section to readme 2014-05-18 14:39:16 +01:00
b3bca7ee0b Minor updates to readme 2014-05-18 14:38:59 +01:00
01796adb43 Remove push target from Makefile, we use Trusted Builds now 2014-05-18 14:37:48 +01:00
bfc867af73 Bump version to 1.4-1
Version scheme now follows the ZNC version the container contains. The
format is "[ZNC_VERSION]-[CONTAINER_BUILD_NUMBER]".
2014-05-17 18:04:27 +01:00
3269e67261 Build ZNC from source instead of relying on 3rd-party PPA repo 2014-05-17 18:03:52 +01:00
6 changed files with 145 additions and 69 deletions

View File

@@ -1,19 +1,33 @@
# version 0.0.2 # version 1.6.1-2
# docker-version 0.7.6 # docker-version 1.11.1
FROM ubuntu:12.04 FROM ubuntu:15.04
MAINTAINER Jim Myhrberg "contact@jimeh.me" MAINTAINER Jim Myhrberg "contact@jimeh.me"
# We use a bootstrap script to avoid having temporary cache files and build ENV ZNC_VERSION 1.6.1
# dependencies being committed and included into the docker image.
ADD bootstrap.sh /tmp/ RUN apt-get update \
RUN chmod +x /tmp/bootstrap.sh && /tmp/bootstrap.sh && apt-get install -y sudo wget build-essential libssl-dev libperl-dev \
pkg-config swig3.0 libicu-dev ca-certificates \
&& mkdir -p /src \
&& cd /src \
&& wget "http://znc.in/releases/archive/znc-${ZNC_VERSION}.tar.gz" \
&& tar -zxf "znc-${ZNC_VERSION}.tar.gz" \
&& cd "znc-${ZNC_VERSION}" \
&& ./configure --disable-ipv6 \
&& make \
&& make install \
&& apt-get remove -y wget \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /src* /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN useradd znc RUN useradd znc
ADD start-znc /usr/local/bin/ ADD docker-entrypoint.sh /entrypoint.sh
ADD znc.conf.default /src/ ADD znc.conf.default /znc.conf.default
RUN chmod 644 /src/znc.conf.default RUN chmod 644 /znc.conf.default
VOLUME /znc-data
USER znc
EXPOSE 6667 EXPOSE 6667
ENTRYPOINT ["/usr/local/bin/start-znc"] ENTRYPOINT ["/entrypoint.sh"]
CMD [""] CMD [""]

View File

@@ -1,7 +1,4 @@
build: build:
docker build -t ${USER}/znc . docker build -t ${USER}/znc .
push: build .PHONY: build
docker push ${USER}/znc
.PHONY: default

View File

@@ -1,20 +1,22 @@
# 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/$(whoami)/.znc`
[Docker]: http://docker.com/
## Running ## Running
To retain your ZNC settings between runs, you will need to bind a directory ZNC needs to store settings somewhere, so simplest way to run it is to mount a
from the host to `/znc-data` in the container. For example: directory from the host machine to `/znc-data` in the container:
docker run -d -p 6667 -v /home/$(whoami)/.znc:/znc-data jimeh/znc mkdir -p $HOME/.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
your data directory unless you already have a config in place. The default your data directory unless you already have a config in place. The default
@@ -25,22 +27,24 @@ exposed:
Or if you want to specify which port to map the default 6667 port to: Or if you want to specify which port to map the default 6667 port to:
docker run -d -p 36667:6667 -v /home/$(whoami)/.znc:/znc-data jimeh/znc docker run -d -p 36667:6667 -v $HOME/.znc:/znc-data jimeh/znc
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
@@ -52,10 +56,75 @@ 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
ZNC stores all it's settings in a Docker volume mounted to `/znc-data` inside
the container.
### Mount a Host Directory
The simplest approach is typically to mount a directory off of your host machine
into the container. This is done with `-v $HOME/.znc:/znc-data` like in the
example above.
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
As `docker run` passes all arguments after the image name to the entrypoint
script, the [start-znc][] script simply passes all arguments along to ZNC.
[start-znc]: https://github.com/jimeh/docker-znc/blob/master/start-znc
For example, if you want to use the `--makepass` option, you would run:
docker run -i -t -v $HOME/.znc:/znc-data jimeh/znc --makepass
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
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
0. Follow Prerequisites above. 1. Follow Prerequisites above.
1. Checkout source: `git clone https://github.com/jimeh/docker-znc.git && cd docker-znc` 2. Checkout source: `git clone https://github.com/jimeh/docker-znc.git && cd docker-znc`
3. Build container: `sudo docker build -t $(whoami)/znc .` 3. Build container: `sudo docker build -t $(whoami)/znc .`
4. Run container: `sudo docker run -d -p 6667 -v /home/$(whoami)/.znc:/znc-data $(whoami)/znc` 4. Run container: `sudo docker run -d -p 6667 -v $HOME/.znc:/znc-data $(whoami)/znc`

View File

@@ -1,14 +0,0 @@
#! /usr/bin/env bash
# Install
apt-get install -y python-software-properties
add-apt-repository ppa:teward/znc
apt-get update
apt-get install -y znc znc-dbg znc-dev znc-perl znc-python znc-tcl
apt-get install -y znc znc-dbg znc-dev znc-extra znc-perl znc-python znc-tcl
# Clean up
apt-get remove -y python-software-properties
apt-get autoremove -y
apt-get clean

View File

@@ -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,9 +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 /src/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
# mounted directory on the host machine too.
echo "Setting necessary permissions..."
chown -R znc:znc "$DATADIR"
# Start ZNC. # Start ZNC.
exec znc --foreground --datadir="$DATADIR" $@ echo "Starting ZNC..."
exec sudo -u znc znc --foreground --datadir="$DATADIR" $@

View File

@@ -3,10 +3,12 @@
// Do NOT edit this file while ZNC is running! // Do NOT edit this file while ZNC is running!
// Use webadmin or *controlpanel instead. // Use webadmin or *controlpanel instead.
// //
// Buf if you feel risky, you might want to read help on /znc saveconfig and /znc rehash. // Altering this file by hand will forfeit all support.
//
// But if you feel risky, you might want to read help on /znc saveconfig and /znc rehash.
// Also check http://en.znc.in/wiki/Configuration // Also check http://en.znc.in/wiki/Configuration
Version = 1.0 Version = 1.6.1
<Listener l> <Listener l>
Port = 6667 Port = 6667
IPv4 = true IPv4 = true
@@ -16,7 +18,7 @@ Version = 1.0
LoadModule = webadmin LoadModule = webadmin
<User admin> <User admin>
Pass = sha256#0ff9dbecce6e6a60031937e471b4911c3c3b32e9545b7c2868c22152da4f109d#pvcfXcnF/BjsXVU:Z9;-# Pass = sha256#00793765305dfc3e7bba28267fe9d9e2c721ebef4e20f3a89720265a89ee6a4f#N!lgZM8S.HZ4zH?)vFoW#
Admin = true Admin = true
Nick = admin Nick = admin
AltNick = admin_ AltNick = admin_