diff --git a/CHANGELOG.md b/CHANGELOG.md index 44d6e9a7..030813db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 * Added yang identityref runtime validation - * Added --enable-debug. * Added cligen variable translation. * See FAQ and example diff --git a/README.md b/README.md index 74812d4f..e422bb35 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/configure b/configure index 3312a01a..a71a99fe 100755 --- a/configure +++ b/configure @@ -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" ;; diff --git a/configure.ac b/configure.ac index 44614911..bf9b7c3a 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/doc/FAQ.md b/doc/FAQ.md index 880e34dc..31fa0fb8 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -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 diff --git a/docker/cli/Dockerfile.in b/docker/Dockerfile similarity index 72% rename from docker/cli/Dockerfile.in rename to docker/Dockerfile index 6b316d58..b07bc32b 100644 --- a/docker/cli/Dockerfile.in +++ b/docker/Dockerfile @@ -31,19 +31,38 @@ # ***** END LICENSE BLOCK ***** # -FROM ubuntu:14.04 -# 12.04 +FROM debian MAINTAINER Olof Hagsand 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"] - diff --git a/docker/Makefile.in b/docker/Makefile.in index 2a653879..58905f5b 100644 --- a/docker/Makefile.in +++ b/docker/Makefile.in @@ -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: + diff --git a/docker/README b/docker/README deleted file mode 100644 index 5fcd6d49..00000000 --- a/docker/README +++ /dev/null @@ -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 \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000..95c9af33 --- /dev/null +++ b/docker/README.md @@ -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 \ No newline at end of file diff --git a/docker/backend/Dockerfile.in b/docker/backend/Dockerfile.in deleted file mode 100644 index 69929f80..00000000 --- a/docker/backend/Dockerfile.in +++ /dev/null @@ -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 -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"] - - - - - - - diff --git a/docker/backend/Makefile.in b/docker/backend/Makefile.in deleted file mode 100644 index 21c1287e..00000000 --- a/docker/backend/Makefile.in +++ /dev/null @@ -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 - diff --git a/docker/backend/README b/docker/backend/README deleted file mode 100644 index d452c07a..00000000 --- a/docker/backend/README +++ /dev/null @@ -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 - diff --git a/docker/cli/Makefile.in b/docker/cli/Makefile.in deleted file mode 100644 index 349d4136..00000000 --- a/docker/cli/Makefile.in +++ /dev/null @@ -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 - diff --git a/docker/cli/README b/docker/cli/README deleted file mode 100644 index d452c07a..00000000 --- a/docker/cli/README +++ /dev/null @@ -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 - diff --git a/docker/netconf/Dockerfile.in b/docker/netconf/Dockerfile.in deleted file mode 100644 index 9a8bcc45..00000000 --- a/docker/netconf/Dockerfile.in +++ /dev/null @@ -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 -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"] - - - - - - - diff --git a/docker/netconf/Makefile.in b/docker/netconf/Makefile.in deleted file mode 100644 index d099d3d2..00000000 --- a/docker/netconf/Makefile.in +++ /dev/null @@ -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 - diff --git a/docker/netconf/README b/docker/netconf/README deleted file mode 100644 index d452c07a..00000000 --- a/docker/netconf/README +++ /dev/null @@ -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 -