8 Commits

Author SHA1 Message Date
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 75 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
# version 0.0.2 # version 1.4-1
# docker-version 0.7.6 # docker-version 0.11.1
FROM ubuntu:12.04 FROM ubuntu:12.04
MAINTAINER Jim Myhrberg "contact@jimeh.me" MAINTAINER Jim Myhrberg "contact@jimeh.me"
@@ -13,7 +13,6 @@ ADD start-znc /usr/local/bin/
ADD znc.conf.default /src/ ADD znc.conf.default /src/
RUN chmod 644 /src/znc.conf.default RUN chmod 644 /src/znc.conf.default
USER znc
EXPOSE 6667 EXPOSE 6667
ENTRYPOINT ["/usr/local/bin/start-znc"] ENTRYPOINT ["/usr/local/bin/start-znc"]
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

@@ -6,7 +6,7 @@ Run the [ZNC](http://znc.in) IRC Bouncer in a Docker container.
## Prerequisites ## Prerequisites
1. Install [Docker](http://docker.io/). 1. Install [Docker](http://docker.io/).
2. Make .znc folder: `mkdir /home/$(whoami)/.znc` 2. Make .znc folder: `mkdir $HOME/.znc`
## Running ## Running
@@ -14,7 +14,7 @@ Run the [ZNC](http://znc.in) IRC Bouncer in a Docker container.
To retain your ZNC settings between runs, you will need to bind a directory To retain your ZNC settings between runs, you will need to bind a directory
from the host to `/znc-data` in the container. For example: from the host to `/znc-data` in the container. For example:
docker run -d -p 6667 -v /home/$(whoami)/.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
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,7 +25,7 @@ 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.
@@ -53,9 +53,38 @@ 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.
## Notes on DATADIR
ZNC needs a data/config directory to run. Within the container it uses
`/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
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.
## 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.
## 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 +1,34 @@
#! /usr/bin/env bash #! /usr/bin/env bash
set -e
# Install
apt-get install -y python-software-properties # Config
add-apt-repository ppa:teward/znc ZNC_VERSION="1.4"
# Ensure package list is up to date.
apt-get update 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 # Install runtime dependencies.
apt-get install -y sudo
# Install build dependencies.
apt-get install -y wget build-essential libssl-dev libperl-dev pkg-config
# Prepare building
mkdir -p /src
# Download, compile and install ZNC.
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 && make && make install
# Clean up # Clean up
apt-get remove -y python-software-properties apt-get remove -y wget
apt-get autoremove -y apt-get autoremove -y
apt-get clean apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View File

@@ -27,5 +27,9 @@ if [ ! -f "${DATADIR}/configs/znc.conf" ]; then
cp /src/znc.conf.default "${DATADIR}/configs/znc.conf" cp /src/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.
chown -R znc:znc "$DATADIR"
# Start ZNC. # Start ZNC.
exec znc --foreground --datadir="$DATADIR" $@ 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.4
<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#1b9a69be60544ae4a83147ebb04c4c1edc24dba4c62f8f25ef5603b06c264476#5zD6V:PYLf*jZcL8VbZY#
Admin = true Admin = true
Nick = admin Nick = admin
AltNick = admin_ AltNick = admin_