Adding disable redis and fixing daemon mode

This commit is contained in:
John Dorman
2020-07-20 00:09:26 -07:00
parent 04cfd84880
commit dc853c7ad0
4 changed files with 34 additions and 44 deletions

View File

@@ -1,45 +1,13 @@
FROM arm64v8/debian:buster-slim
FROM debian:buster-slim
# necessary for running build from x86 environments
ADD qemu-aarch64-static /usr/bin
COPY entrypoint.sh /entrypoint.sh
COPY packages/*200711*.deb /tmp
RUN apt-get update && apt-get -y install libsqlite3-0 libexpat1 redis-server librrd8 logrotate libcurl4 libpcap0.8 libldap-2.4-2 libhiredis0.14 \
libssl1.1 libmariadbd19 lsb-release tar ethtool libcap2 bridge-utils libnetfilter-conntrack3 libzstd1 libmaxminddb0 \
libradcli4 libjson-c3 libsnmp30 udev libzmq5 libcurl3-gnutls net-tools curl procps
libssl1.1 libmariadbd19 lsb-release tar ethtool libcap2 bridge-utils libnetfilter-conntrack3 libzstd1 libmaxminddb0 \
libradcli4 libjson-c3 libsnmp30 udev libzmq5 libcurl3-gnutls net-tools curl procps \
&& curl -Lo /tmp/geoipupdate_2.3.1-1_arm64.deb http://ftp.us.debian.org/debian/pool/contrib/g/geoipupdate/geoipupdate_2.3.1-1_arm64.deb \
&& dpkg -i /tmp/*.deb && rm /tmp/*.deb \
&& echo "-i=br0\n-n=1\n-W=3001" >> /etc/ntopng/ntopng.conf && chmod +x /entrypoint.sh
# grab geoipupdate from the Debian contrib repository
RUN curl -Lo /tmp/geoipupdate_2.3.1-1_arm64.deb http://ftp.us.debian.org/debian/pool/contrib/g/geoipupdate/geoipupdate_2.3.1-1_arm64.deb \
&& dpkg -i /tmp/geoipupdate_2.3.1-1_arm64.deb && rm /tmp/geoipupdate_2.3.1-1_arm64.deb
RUN curl -Lo /tmp/ntopng-data_4.1.200711_all.deb https://github.com/tusc/ntopng-udm/blob/master/packages/ntopng-data_4.1.200711_all.deb?raw=true \
&& curl -Lo /tmp/ntopng_4.1.200711-10754_arm64.deb https://github.com/tusc/ntopng-udm/blob/master/packages/ntopng_4.1.200711-10754_arm64.deb?raw=true \
&& dpkg -i /tmp/ntopng-data_4.1.200711_all.deb \
&& dpkg -i /tmp/ntopng_4.1.200711-10754_arm64.deb
# update ntop config file
RUN echo "-e" >> /etc/ntopng/ntopng.conf
RUN echo "-i=br0" >> /etc/ntopng/ntopng.conf
RUN echo "-n=1" >> /etc/ntopng/ntopng.conf
RUN echo "-W=3001" >> /etc/ntopng/ntopng.conf
# build startup script
# note The script below will instruct ntopng to listen to br0 by default.
# Change the -i parameter below if you want another interface
RUN echo "#!/bin/bash" > /startscript.sh
RUN echo "/etc/init.d/redis-server start" >> /startscript.sh
# check if GeoIP.conf is populated. If so run geoipupdate
RUN echo "if [ -s /etc/GeoIP.conf ]" >> /startscript.sh
RUN echo "then" >> /startscript.sh
RUN echo " echo 'Please wait, geoipupdate is running'" >> /startscript.sh
RUN echo " /usr/bin/geoipupdate" >> /startscript.sh
RUN echo "fi" >> /startscript.sh
# start ntopng
RUN echo "/usr/local/bin/ntopng /etc/ntopng/ntopng.conf" >> /startscript.sh
# Keep container running with the command below since we started
# just background services
RUN echo "tail -f /dev/null" >> /startscript.sh
RUN chmod +x /startscript.sh
ENTRYPOINT ["/startscript.sh"]
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -8,6 +8,11 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Building
Build on your UDM or build on another device using buildx and targeting arm64
```
docker buildx build --platform linux/arm64 -t ntopng:latest --load .
```
## Project Notes
**Author:** Carlos Talbot (@tusc69 on ubnt forums)
@@ -66,13 +71,17 @@ Anytime the docker container is started it will run a geoipupdate to download th
# Customize settings
The default instance will listen on the LAN interface (br0). You can edit the file /mnt/data/ntopng/ntopng.conf on the UDM to change the settings. The default is -e (daemon mode), -i=br0 (LAN), n=1 ( Decode DNS responses and resolve all numeric IPs ) and -W3001 (enable HTTPS port)
The default instance will listen on the LAN interface (br0). You can edit the file /mnt/data/ntopng/ntopng.conf on the UDM to change the settings. The default is -i=br0 (LAN), n=1 ( Decode DNS responses and resolve all numeric IPs ) and -W3001 (enable HTTPS port)
**NOTE** If you comment out the -i interface and let ntopng startup listening to all interfaces you will have to wait up to 30 seconds for all interfaces to register. This will also consume additional CPU and memory resources so be careful with this option.
You can also customize the settings for the redis database if you want to eliminates database saves to storage. That file is located at /mnt/data/ntopng/redis.conf
# Disable Redis
If you want to disable Redis and use an external server just set the env var "DISABLE_REDIS"
```
docker run -e DISABLE_REDIS=true boostchicken/ntopng
```
# Upgrades
Whenever there is a new version of ntopng you can easily perform an upgrade by doing the following commands:

14
entrypoint.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -e
if [ -z "$DISABLE_REDIS" ]; then
/etc/init.d/redis-server start
fi
if [ -s /etc/GeoIP.conf ]
then
echo 'Please wait, geoipupdate is running'
/usr/bin/geoipupdate
fi
ntopng /etc/ntopng/ntopng.conf

View File

@@ -68,7 +68,6 @@
# Disable web interface logout for inactivity.
#
# -q=
-e
-i=br0
-n=1
-W=3001