er image build and changed it to build a single clixon docker\

image which can be found at olofhagsand/clixon
This commit is contained in:
Olof Hagsand 2018-07-21 13:55:21 +00:00
parent deb89600ed
commit c7aed5e7a7
17 changed files with 70 additions and 418 deletions

View file

@ -52,6 +52,7 @@
### Minor changes
* Updated the docker image build and changed it to build a single clixon docker image which can be found at olofhagsand/clixon.
* Added systemd example files under example/systemd
* Changed `plugin_init()` backend return semantics: If returns NULL, _without_ calling clicon_err(), the module is disabled.
* Added util subdir, with dedicated standalone xml,json,yang and xpath parser utility test programs.
@ -66,7 +67,6 @@
* Added xmlns validation
* for eg <a xmlns:x="uri"><x:b/></a>
* Added yang identityref runtime validation
* Added --enable-debug.
* Added cligen variable translation.
* See FAQ and example

View file

@ -22,6 +22,7 @@ transaction support from a YANG specification.
* [Runtime](#runtime)
* [Clixon project page](http://www.clicon.org)
* [Tests](test/)
* [Docker](docker/)
* [Reference manual](http://www.clicon.org/doxygen/index.html) (Note: the link may not be up-to-date. It is better to build your own: `cd doc; make doc`)
Background

8
configure vendored
View file

@ -4325,7 +4325,7 @@ _ACEOF
ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/docker/Makefile extras/rpm/Makefile docker/Makefile docker/cli/Makefile docker/cli/Dockerfile docker/backend/Makefile docker/backend/Dockerfile docker/netconf/Makefile docker/netconf/Dockerfile datastore/Makefile datastore/text/Makefile util/Makefile yang/Makefile doc/Makefile"
ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/docker/Makefile extras/rpm/Makefile docker/Makefile datastore/Makefile datastore/text/Makefile util/Makefile yang/Makefile doc/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -5035,12 +5035,6 @@ do
"example/docker/Makefile") CONFIG_FILES="$CONFIG_FILES example/docker/Makefile" ;;
"extras/rpm/Makefile") CONFIG_FILES="$CONFIG_FILES extras/rpm/Makefile" ;;
"docker/Makefile") CONFIG_FILES="$CONFIG_FILES docker/Makefile" ;;
"docker/cli/Makefile") CONFIG_FILES="$CONFIG_FILES docker/cli/Makefile" ;;
"docker/cli/Dockerfile") CONFIG_FILES="$CONFIG_FILES docker/cli/Dockerfile" ;;
"docker/backend/Makefile") CONFIG_FILES="$CONFIG_FILES docker/backend/Makefile" ;;
"docker/backend/Dockerfile") CONFIG_FILES="$CONFIG_FILES docker/backend/Dockerfile" ;;
"docker/netconf/Makefile") CONFIG_FILES="$CONFIG_FILES docker/netconf/Makefile" ;;
"docker/netconf/Dockerfile") CONFIG_FILES="$CONFIG_FILES docker/netconf/Dockerfile" ;;
"datastore/Makefile") CONFIG_FILES="$CONFIG_FILES datastore/Makefile" ;;
"datastore/text/Makefile") CONFIG_FILES="$CONFIG_FILES datastore/text/Makefile" ;;
"util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;;

View file

@ -203,12 +203,6 @@ AC_OUTPUT(Makefile
example/docker/Makefile
extras/rpm/Makefile
docker/Makefile
docker/cli/Makefile
docker/cli/Dockerfile
docker/backend/Makefile
docker/backend/Dockerfile
docker/netconf/Makefile
docker/netconf/Dockerfile
datastore/Makefile
datastore/text/Makefile
util/Makefile

View file

@ -101,6 +101,8 @@ You can change where CLixon looks for the configuration FILE as follows:
- FILE is /usr/local/etc/clixon.xml
## Can I run Clixon as docker containers?
(Not updated)
Yes, the example works as docker containers as well. backend and cli needs a
common file-system so they need to run as a composed pair.
```
@ -108,7 +110,7 @@ common file-system so they need to run as a composed pair.
make docker # Prepares /data as shared file-system mount
run.sh # Starts an example backend and a cli
```
The containers are by default downloaded from dockerhib, but you may
The containers are by default downloaded from dockerhub, but you may
build the containers locally:
```
cd docker

View file

@ -31,19 +31,38 @@
# ***** END LICENSE BLOCK *****
#
FROM ubuntu:14.04
# 12.04
FROM debian
MAINTAINER Olof Hagsand <olof@hagsand.se>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y libqdbm-dev
RUN apt-get update && apt-get install -y \
git make gcc flex bison
RUN groupadd clicon
COPY libcligen.so.@CLIGEN_VERSION@ /usr/lib/
COPY libclixon.so.@CLIXON_VERSION_MAJOR@ /usr/lib/
COPY libclixon_cli.so.@CLIXON_VERSION_MAJOR@ /usr/lib/
COPY clixon_cli /usr/bin/
# Create a directory to hold source-code, dependencies etc
RUN mkdir /clixon
WORKDIR /clixon
# Clone cligen and clixon
RUN git clone https://github.com/olofhagsand/cligen.git
RUN git clone https://github.com/clicon/clixon.git
# Build cligen
WORKDIR /clixon/cligen
RUN ./configure
RUN make
RUN make install
# Build clixon
WORKDIR /clixon/clixon
RUN git checkout -b develop origin/develop
RUN ./configure --without-restconf
RUN make
RUN make install
RUN make install-include
#RUN rm -rf /clixon
RUN ldconfig
CMD ["/usr/bin/clixon_cli", "-f", "/data/clixon.conf"]

View file

@ -38,46 +38,33 @@ CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
# Change this
IMAGE = olofhagsand/clixon
SHELL = /bin/sh
SUBDIRS = cli backend netconf
.PHONY: all clean depend install $(SUBDIRS) docker push
.PHONY: all clean depend install docker push
all: $(SUBDIRS)
depend:
for i in $(SUBDIRS); \
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
$(SUBDIRS):
(cd $@; $(MAKE) $(MFLAGS) all)
install-include:
for i in $(SUBDIRS); \
do (cd $$i ; $(MAKE) $(MFLAGS) $@); done;
install:
for i in $(SUBDIRS); \
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
uninstall:
for i in $(SUBDIRS); \
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
all:
@echo "Run make docker to build docker image"
clean:
for i in $(SUBDIRS); \
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
distclean: clean
rm -f Makefile *~ .depend
for i in $(SUBDIRS); \
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
docker:
for i in $(SUBDIRS); \
do (cd $$i && $(MAKE) $(MFLAGS) $@); done
sudo docker build -t $(IMAGE) .
push:
for i in $(SUBDIRS); \
do (cd $$i && $(MAKE) $(MFLAGS) $@); done
sudo docker push $(IMAGE)
depend:
install-include:
install:
uninstall:

View file

@ -1,12 +0,0 @@
This dir is not updated
This dir contains docker code - how to build clixon as docker containers
cli Build olofhagsand/clixon_cli container
backend Build olofhagsand/clixon_backend container
netconf Build olofhagsand/clixon_netconf container
Perform the build by 'make docker'.
You may also do 'make push' if you want to push the image, but you may then consider changing the image name (in the makefile:s).
You may run the container directly by going directly to example and
the docker runtime scripts there

19
docker/README.md Normal file
View file

@ -0,0 +1,19 @@
# Clixon base docker image
This directory contains code for building and pushing a Clixon docker
container. By default it is pushed to olofhagsand/clixon, but you can change
the IMAGE in Makefile.in and push it to another name.
The clixon docker image is a base image that can be used to build
clixon applications. It has all the whole code for a clixon release
which it downloads from git - it does not use local code.
See example/docker for how to build a docker application using the base image.
Build and push
==============
Perform the build by 'make docker'.
You may also do 'make push' if you want to push the image, but you may then consider changing the image name (in the makefile:s).
You may run the container directly by going directly to example and
the docker runtime scripts there

View file

@ -1,53 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2009-2018 Olof Hagsand and Benny Holmgren
#
# This file is part of CLIXON
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 3 or later (the "GPL"),
# in which case the provisions of the GPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of the GPL, and not to allow others to
# use your version of this file under the terms of Apache License version 2,
# indicate your decision by deleting the provisions above and replace them with
# the notice and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the Apache License version 2 or the GPL.
#
# ***** END LICENSE BLOCK *****
#
FROM ubuntu:14.04
# 12.04
MAINTAINER Olof Hagsand <olof@hagsand.se>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y libqdbm-dev
RUN groupadd clicon
COPY libcligen.so.@CLIGEN_VERSION@ /usr/lib/
COPY libclixon.so.@CLIXON_VERSION_MAJOR@ /usr/lib/
COPY libclixon_backend.so.@CLIXON_VERSION_MAJOR@ /usr/lib/
COPY clixon_backend /usr/sbin/
RUN ldconfig
RUN sudo groupadd clixon
CMD ["/usr/sbin/clixon_backend", "-F", "-f", "/data/clixon.conf"]

View file

@ -1,77 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2009-2018 Olof Hagsand and Benny Holmgren
#
# This file is part of CLIXON
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 3 or later (the "GPL"),
# in which case the provisions of the GPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of the GPL, and not to allow others to
# use your version of this file under the terms of Apache License version 2,
# indicate your decision by deleting the provisions above and replace them with
# the notice and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the Apache License version 2 or the GPL.
#
# ***** END LICENSE BLOCK *****
#
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
bindir = @bindir@
sbindir = @sbindir@
libdir = @libdir@
includedir = @includedir@
datarootdir = @datarootdir@
# You may consider changing this
image = olofhagsand/clixon_backend
all:
@echo "Run make docker to build docker image"
clean:
distclean: clean
rm -f Makefile *~ .depend libcligen* libclixon* clixon_backend Dockerfile
# Kind of reverse install, could have copied from src dir,...
.PHONY: docker push
docker:
cp $(DESTDIR)$(libdir)/libcligen.so.@CLIGEN_VERSION@ .
cp $(DESTDIR)$(libdir)/libclixon.so.@CLIXON_VERSION_MAJOR@ .
cp $(DESTDIR)$(libdir)/libclixon_backend.so.@CLIXON_VERSION_MAJOR@ .
cp $(DESTDIR)$(sbindir)/clixon_backend .
sudo docker build -t $(image) .
push:
docker push $(image)
install:
uninstall:
install-include:
depend:
# $(CC) $(DEPENDFLAGS) $(INCLUDES) $(CFLAGS) -MM $(SRC) > .depend
#include .depend

View file

@ -1,6 +0,0 @@
Ensure that cligen and clixon has been built and installed.
sudo make docker
make push
Then go to example and run the example as a docker container

View file

@ -1,76 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2009-2018 Olof Hagsand and Benny Holmgren
#
# This file is part of CLIXON
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 3 or later (the "GPL"),
# in which case the provisions of the GPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of the GPL, and not to allow others to
# use your version of this file under the terms of Apache License version 2,
# indicate your decision by deleting the provisions above and replace them with
# the notice and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the Apache License version 2 or the GPL.
#
# ***** END LICENSE BLOCK *****
#
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
bindir = @bindir@
sbindir = @sbindir@
libdir = @libdir@
includedir = @includedir@
datarootdir = @datarootdir@
# You may consider changing this
image = olofhagsand/clixon_cli
all:
@echo "Run make docker to build docker image"
clean:
distclean: clean
rm -f Makefile *~ .depend libcligen* libclixon* clixon_cli Dockerfile
# Kind of reverse install, could have copied from src dir,...
.PHONY: docker push
docker:
cp $(DESTDIR)$(libdir)/libcligen.so.@CLIGEN_VERSION@ .
cp $(DESTDIR)$(libdir)/libclixon.so.@CLIXON_VERSION_MAJOR@ .
cp $(DESTDIR)$(libdir)/libclixon_cli.so.@CLIXON_VERSION_MAJOR@ .
cp $(DESTDIR)$(bindir)/clixon_cli .
sudo docker build -t $(image) .
push:
sudo docker push $(image)
install:
uninstall:
install-include:
depend:
# $(CC) $(DEPENDFLAGS) $(INCLUDES) $(CFLAGS) -MM $(SRC) > .depend
#include .depend

View file

@ -1,6 +0,0 @@
Ensure that cligen and clixon has been built and installed.
sudo make docker
make push
Then go to example and run the example as a docker container

View file

@ -1,52 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2009-2018 Olof Hagsand and Benny Holmgren
#
# This file is part of CLIXON
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 3 or later (the "GPL"),
# in which case the provisions of the GPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of the GPL, and not to allow others to
# use your version of this file under the terms of Apache License version 2,
# indicate your decision by deleting the provisions above and replace them with
# the notice and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the Apache License version 2 or the GPL.
#
# ***** END LICENSE BLOCK *****
#
FROM ubuntu:14.04
# 12.04
MAINTAINER Olof Hagsand <olof@hagsand.se>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y libqdbm-dev
RUN groupadd clicon
COPY libcligen.so.@CLIGEN_VERSION@ /usr/lib/
COPY libclixon.so.@CLIXON_VERSION_MAJOR@ /usr/lib/
COPY libclixon_netconf.so.@CLIXON_VERSION_MAJOR@ /usr/lib/
COPY clixon_netconf /usr/bin/
RUN ldconfig
CMD ["/usr/bin/clixon_netconf", "-f", "/data/clixon.conf"]

View file

@ -1,76 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2009-2018 Olof Hagsand and Benny Holmgren
#
# This file is part of CLIXON
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 3 or later (the "GPL"),
# in which case the provisions of the GPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of the GPL, and not to allow others to
# use your version of this file under the terms of Apache License version 2,
# indicate your decision by deleting the provisions above and replace them with
# the notice and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the Apache License version 2 or the GPL.
#
# ***** END LICENSE BLOCK *****
#
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
bindir = @bindir@
sbindir = @sbindir@
libdir = @libdir@
includedir = @includedir@
datarootdir = @datarootdir@
# You may consider changing this
image = olofhagsand/clixon_netconf
all:
@echo "Run make docker to build docker image"
clean:
distclean: clean
rm -f Makefile *~ .depend libcligen* libclixon* clixon_netconf Dockerfile
# Kind of reverse install, could have copied from src dir,...
.PHONY: docker push
docker:
cp $(DESTDIR)$(libdir)/libcligen.so.@CLIGEN_VERSION@ .
cp $(DESTDIR)$(libdir)/libclixon.so.@CLIXON_VERSION_MAJOR@ .
cp $(DESTDIR)$(libdir)/libclixon_netconf.so.@CLIXON_VERSION_MAJOR@ .
cp $(DESTDIR)$(bindir)/clixon_netconf .
sudo docker build -t $(image) .
push:
sudo docker push $(image)
install:
uninstall:
install-include:
depend:
# $(CC) $(DEPENDFLAGS) $(INCLUDES) $(CFLAGS) -MM $(SRC) > .depend
#include .depend

View file

@ -1,6 +0,0 @@
Ensure that cligen and clixon has been built and installed.
sudo make docker
make push
Then go to example and run the example as a docker container