Post-release test and docs

This commit is contained in:
Olof hagsand 2024-10-29 09:53:20 +01:00
parent e0ebe41ee2
commit 0586e94856
7 changed files with 47 additions and 36 deletions

View file

@ -32,7 +32,7 @@
# ***** END LICENSE BLOCK *****
#
FROM alpine
FROM alpine:latest
LABEL maintainer="Olof Hagsand <olof@hagsand.se>"
# For clixon and cligen
@ -41,9 +41,14 @@ RUN apk add --update git make build-base gcc flex bison curl-dev
# nghttp2 dependencies
RUN apk add --update nghttp2
# For netsnmp
RUN apk add --update net-snmp net-snmp-dev
# For groupadd/groupdel
RUN apk add --update shadow
# Create a directory to hold source-code, dependencies etc
RUN mkdir -p /clixon/build
WORKDIR /clixon
# Clone cligen
@ -51,7 +56,7 @@ RUN git clone https://github.com/clicon/cligen.git
# Build cligen
WORKDIR /clixon/cligen
RUN ./configure --prefix=/usr/local
RUN ./configure --prefix=/usr/local --sysconfdir=/etc
RUN make
RUN make DESTDIR=/clixon/build install
@ -64,16 +69,18 @@ WORKDIR /clixon/clixon
COPY clixon .
# Configure, build and install clixon
RUN ./configure --prefix=/usr/local --with-cligen=/clixon/build/usr/local --with-restconf=native --enable-nghttp2 --enable-http1
RUN ./configure --prefix=/usr/local --sysconfdir=/etc --with-cligen=/clixon/build/usr/local --with-restconf=native --enable-nghttp2 --enable-http1 --enable-netsnmp
RUN make
RUN make DESTDIR=/clixon/build install
RUN make DESTDIR=/clixon/build install-include
# Install main example
# Build and install the clixon example
WORKDIR /clixon/clixon/example/main
RUN make
RUN make DESTDIR=/clixon/build install
RUN mkdir -p /clixon/build/etc
RUN install example.xml /clixon/build/etc/clixon.xml
# Copy startscript
WORKDIR /clixon
@ -83,17 +90,29 @@ RUN install startsystem.sh /clixon/build/usr/local/bin/
#
# Stage 2
# The second step skips the development environment and builds a runtime system
FROM alpine
FROM alpine:latest
MAINTAINER Olof Hagsand <olof@hagsand.se>
# For clixon and cligen
RUN apk add --update flex bison
RUN apk add --update flex bison openssl
# need to add www user manually
RUN adduser -D -H -G www-data www-data
# openssl and nghttp2 dependencies
RUN apk add --update openssl nghttp2
# nghttp2 dependencies
RUN apk add --update nghttp2
# For SNMP
RUN apk add --update net-snmp net-snmp-tools
# Some custom configuration for SNMP
RUN echo "master agentx" > /etc/snmp/snmpd.conf
RUN echo "agentaddress 127.0.0.1" >> /etc/snmp/snmpd.conf
RUN echo "rwcommunity public localhost" >> /etc/snmp/snmpd.conf
RUN echo "agentxsocket unix:/var/run/snmp.sock" >> /etc/snmp/snmpd.conf
RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf
RUN echo "trap2sink localhost public 162" >> /etc/snmp/snmpd.conf
RUN echo "disableAuthorization yes" >> /etc/snmp/snmptrapd.conf
# Expose https port for restconf
EXPOSE 80/tcp
@ -111,9 +130,9 @@ RUN adduser -D -H clicon
COPY --from=0 /clixon/build/ /
# Overwrite config file since install dirs are wrong
COPY example.xml /usr/local/etc/example.xml
COPY example.xml /usr/local/etc/clixon/example.xml
# Create symlink so you can run clixon without -f arg
RUN ln -s /usr/local/etc/example.xml /usr/local/etc/clixon.xml
RUN ln -s /usr/local/etc/clixon/example.xml /usr/local/etc/clixon.xml
# Start daemons
CMD /usr/local/bin/startsystem.sh

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2017-2019 Olof Hagsand
@ -54,10 +54,8 @@ touch /run/openrc/softlevel
#/usr/local/bin/clixon_restconf -l f/var/log/restconf.log -D $DBG &
#>&2 echo "clixon_restconf started"
#ln -s /usr/local/etc/example.xml clixon.xml
# Start clixon backend
/usr/local/sbin/clixon_backend -D $DBG -s running -l e -f /usr/local/etc/example.xml
/usr/local/sbin/clixon_backend -D $DBG -s running -l e -f /usr/local/etc/clixon/example.xml
>&2 echo "clixon_backend started"
# Alt: let backend be in foreground, but test scripts may