diff --git a/.gitignore b/.gitignore index 4ee05c0..9bec6ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ cworker configure +config.status libtool Makefile config.h @@ -16,4 +17,4 @@ autom4te* *.la .libs run -log \ No newline at end of file +log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dfa5630 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM debian:bullseye AS builder +WORKDIR /app/src/ + +RUN apt-get -y -q update +RUN apt-get -y -q install make binutils gcc libc-dev +COPY . . +RUN ./configure --prefix=/app +RUN make clean all install clean + +FROM debian:bullseye +WORKDIR /app +COPY --from=builder /app /app + +USER daemon:daemon +ENTRYPOINT ["/app/sbin/cworker"] + diff --git a/Makefile b/Makefile index b606a42..6f84930 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # Makefile. Generated from Makefile.in by configure. -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,8 +170,8 @@ am__recursive_targets = \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)defines.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + defines.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -233,34 +233,38 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print -ACLOCAL = ${SHELL} /dat2/home/ziggi/Projects/cworker/missing aclocal +ACLOCAL = ${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' aclocal-1.16 AMTAR = $${TAR-tar} AM_DEFAULT_VERBOSITY = 1 -APP_CACHEDIR = /dat2/home/ziggi/Projects/cworker/cache -APP_CONFIGDIR = /dat2/home/ziggi/Projects/cworker/ -APP_DATABASEDIR = /dat2/home/ziggi/Projects/cworker/data -APP_LIBDIR = /dat2/home/ziggi/Projects/cworker/lib -APP_LOGDIR = /dat2/home/ziggi/Projects/cworker/log -APP_RUNDIR = /dat2/home/ziggi/Projects/cworker/run -APP_USER = ziggi +APP_CACHEDIR = /var/cache/cworker +APP_CONFIGDIR = /app/etc/cworker +APP_DATABASEDIR = /var/db/cworker +APP_LIBDIR = /app/lib/cworker +APP_LOGDIR = /var/log/cworker +APP_RUNDIR = /var/run/cworker +APP_USER = www-data AR = ar -AUTOCONF = ${SHELL} /dat2/home/ziggi/Projects/cworker/missing autoconf -AUTOHEADER = ${SHELL} /dat2/home/ziggi/Projects/cworker/missing autoheader -AUTOMAKE = ${SHELL} /dat2/home/ziggi/Projects/cworker/missing automake +AUTOCONF = ${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' autoconf +AUTOHEADER = ${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' autoheader +AUTOMAKE = ${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' automake-1.16 AWK = gawk CC = clang CCDEPMODE = depmode=none CFLAGS = -g -O2 CP = +CPP = clang -E CPPFLAGS = CYGPATH_W = echo DEFS = -DHAVE_CONFIG_H DEPDIR = .deps DLLTOOL = false +DOCKER = /bin/podman DSYMUTIL = DUMPBIN = ECHO_C = @@ -271,11 +275,13 @@ EXEEXT = FGREP = /bin/grep -F GREP = /bin/grep HAVE_CP = true +HELM = /bin/helm INSTALL = /bin/install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +KUBECTL = /bin/kubectl LD = /bin/ld -m elf_x86_64 LDFLAGS = LIBOBJS = @@ -286,7 +292,7 @@ LIPO = LN_S = ln -s LTLIBOBJS = LT_SYS_LIBRARY_PATH = -MAKEINFO = ${SHELL} /dat2/home/ziggi/Projects/cworker/missing makeinfo +MAKEINFO = ${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' makeinfo MANIFEST_TOOL = : MKDIR_P = /bin/mkdir -p NM = /bin/nm -B @@ -322,14 +328,14 @@ am__leading_dot = . am__quote = am__tar = $${TAR-tar} chof - "$$tardir" am__untar = $${TAR-tar} xf - -app_cachedir = /dat2/home/ziggi/Projects/cworker/cache -app_configdir = /dat2/home/ziggi/Projects/cworker/ -app_databasedir = /dat2/home/ziggi/Projects/cworker/data -app_libdir = /dat2/home/ziggi/Projects/cworker/lib -app_logdir = /dat2/home/ziggi/Projects/cworker/log +app_cachedir = /var/cache/cworker +app_configdir = /app/etc/cworker +app_databasedir = /var/db/cworker +app_libdir = /app/lib/cworker +app_logdir = /var/log/cworker app_name = cworker -app_rundir = /dat2/home/ziggi/Projects/cworker/run -app_user = ziggi +app_rundir = /var/run/cworker +app_user = www-data bindir = ${exec_prefix}/bin build = x86_64-pc-linux-gnu build_alias = @@ -359,7 +365,7 @@ mandir = ${datarootdir}/man mkdir_p = $(MKDIR_P) oldincludedir = /usr/include pdfdir = ${docdir} -prefix = /usr/local +prefix = /app program_transform_name = s,x,x, psdir = ${docdir} runstatedir = ${localstatedir}/run @@ -378,6 +384,11 @@ AM_CFLAGS = -Wall -I./clib -std=gnu99 AM_LDFLAGS = -pthread cworker_SOURCES = main.c cworker.c cworker.h cworker_LDADD = clib/libcworker.la +IMAGE_REPO = docker.io/onborodin +IMAGE_TAG = latest +IMAGE_NAME = cworker +RELEASE_NAMESPACE = cworker +RELEASE_NAME = cworker all: defines.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -697,6 +708,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -739,6 +754,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -754,7 +771,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -922,18 +939,19 @@ uninstall-am: uninstall-sbinPROGRAMS clean-libtool clean-local clean-sbinPROGRAMS cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-sbinPROGRAMS install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-sbinPROGRAMS + dist-zstd distcheck distclean distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-sbinPROGRAMS .PRECIOUS: Makefile @@ -944,6 +962,22 @@ uninstall-am: uninstall-sbinPROGRAMS run: $(sbin_PROGRAMS) ./cworker --port=9002 --nofork=true +image: + $(DOCKER) build -t $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile . + +push: + $(DOCKER) push $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) + +kinstall: + $(HELM) install --create-namespace --namespace $(RELEASE_NAMESPACE) \ + --set cworker.image.path=$(IMAGE_REPO) \ + --set cworker.image.name=$(IMAGE_NAME) \ + --set cworker.image.tag=$(IMAGE_TAG) \ + $(RELEASE_NAME) ./chart + +kuninstall: + $(HELM) uninstall --namespace $(RELEASE_NAMESPACE) $(RELEASE_NAME) + #install-data-local: # test -z $(DESTDIR)$(APP_LIBDIR) || $(MKDIR_P) $(DESTDIR)$(APP_LIBDIR) # test -z $(DESTDIR)$(APP_CONFDIR) || $(MKDIR_P) $(DESTDIR)$(APP_CONFDIR) diff --git a/Makefile.am b/Makefile.am index b36bed3..b846ef0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,32 @@ cworker_LDADD = clib/libcworker.la run: $(sbin_PROGRAMS) ./cworker --port=9002 --nofork=true +IMAGE_REPO = docker.io/onborodin +IMAGE_TAG = latest +IMAGE_NAME = cworker + +image: + $(DOCKER) build -t $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile . + +push: + $(DOCKER) push $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) + + +RELEASE_NAMESPACE = cworker +RELEASE_NAME = cworker + +kinstall: + $(HELM) install --create-namespace --namespace $(RELEASE_NAMESPACE) \ + --set cworker.image.path=$(IMAGE_REPO) \ + --set cworker.image.name=$(IMAGE_NAME) \ + --set cworker.image.tag=$(IMAGE_TAG) \ + $(RELEASE_NAME) ./chart + + +kuninstall: + $(HELM) uninstall --namespace $(RELEASE_NAMESPACE) $(RELEASE_NAME) + + #install-data-local: # test -z $(DESTDIR)$(APP_LIBDIR) || $(MKDIR_P) $(DESTDIR)$(APP_LIBDIR) diff --git a/Makefile.in b/Makefile.in index 2dfe705..3ffa199 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,8 +170,8 @@ am__recursive_targets = \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)defines.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + defines.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -233,6 +233,8 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -256,11 +258,13 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DOCKER = @DOCKER@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -271,11 +275,13 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_CP = @HAVE_CP@ +HELM = @HELM@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KUBECTL = @KUBECTL@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ @@ -378,6 +384,11 @@ AM_CFLAGS = -Wall -I./clib -std=gnu99 AM_LDFLAGS = -pthread cworker_SOURCES = main.c cworker.c cworker.h cworker_LDADD = clib/libcworker.la +IMAGE_REPO = docker.io/onborodin +IMAGE_TAG = latest +IMAGE_NAME = cworker +RELEASE_NAMESPACE = cworker +RELEASE_NAME = cworker all: defines.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -697,6 +708,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -739,6 +754,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -754,7 +771,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -922,18 +939,19 @@ uninstall-am: uninstall-sbinPROGRAMS clean-libtool clean-local clean-sbinPROGRAMS cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-sbinPROGRAMS install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-sbinPROGRAMS + dist-zstd distcheck distclean distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-sbinPROGRAMS .PRECIOUS: Makefile @@ -944,6 +962,22 @@ uninstall-am: uninstall-sbinPROGRAMS run: $(sbin_PROGRAMS) ./cworker --port=9002 --nofork=true +image: + $(DOCKER) build -t $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile . + +push: + $(DOCKER) push $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) + +kinstall: + $(HELM) install --create-namespace --namespace $(RELEASE_NAMESPACE) \ + --set cworker.image.path=$(IMAGE_REPO) \ + --set cworker.image.name=$(IMAGE_NAME) \ + --set cworker.image.tag=$(IMAGE_TAG) \ + $(RELEASE_NAME) ./chart + +kuninstall: + $(HELM) uninstall --namespace $(RELEASE_NAMESPACE) $(RELEASE_NAME) + #install-data-local: # test -z $(DESTDIR)$(APP_LIBDIR) || $(MKDIR_P) $(DESTDIR)$(APP_LIBDIR) # test -z $(DESTDIR)$(APP_CONFDIR) || $(MKDIR_P) $(DESTDIR)$(APP_CONFDIR) diff --git a/aclocal.m4 b/aclocal.m4 index ec216f3..1039151 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.3 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, -[m4_warning([this file was generated for autoconf 2.71. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.1], [], +m4_if([$1], [1.16.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.1])dnl +[AM_AUTOMAKE_VERSION([1.16.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -371,7 +371,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi @@ -398,7 +400,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -475,9 +477,9 @@ _AM_IF_OPTION([no-define],, # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal]) +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl @@ -595,7 +597,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -616,7 +618,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -637,7 +639,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -680,7 +682,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -701,12 +703,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -719,7 +716,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -748,7 +745,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -795,7 +792,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -814,7 +811,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -895,7 +892,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -955,7 +952,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -983,7 +980,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1002,7 +999,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/chart/.helmignore b/chart/.helmignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/chart/.helmignore @@ -0,0 +1 @@ +*~ diff --git a/chart/Chart.yaml b/chart/Chart.yaml new file mode 100644 index 0000000..9b8afe4 --- /dev/null +++ b/chart/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v2 +name: cworker +description: Sample service +type: application +version: 0.1 +appVersion: "0.1" + diff --git a/chart/templates/configmap.yaml b/chart/templates/configmap.yaml new file mode 100644 index 0000000..57d935d --- /dev/null +++ b/chart/templates/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: {{ .Release.Namespace }} + name: cworker-config +data: + cworker.conf: |- + port = {{ .Values.cworker.service.port }} diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml new file mode 100644 index 0000000..aeb4630 --- /dev/null +++ b/chart/templates/deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cworker + namespace: {{ .Release.Namespace }} + labels: + app: cworker +spec: + serviceName: cworker + replicas: 1 + selector: + matchLabels: + app: cworker + template: + metadata: + labels: + app: cworker + spec: + restartPolicy: Always + containers: + - securityContext: + privileged: true + image: {{ .Values.cworker.image.path }}/{{ .Values.cworker.image.name }}:{{ .Values.cworker.image.tag }} + imagePullPolicy: {{ .Values.cworker.imagePullPolicy }} + name: cworker + ports: + - containerPort: {{ .Values.cworker.service.port }} + protocol: TCP + volumeMounts: + - name: config-volume + mountPath: /app/etc/cworker + volumes: + - name: config-volume + configMap: + name: cworker-config diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml new file mode 100644 index 0000000..73be972 --- /dev/null +++ b/chart/templates/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: cworker + namespace: {{ .Release.Namespace }} + labels: + app: cworker +spec: + selector: + app: cworker + ports: + - port: {{ .Values.cworker.service.port }} + protocol: TCP + targetPort: {{ .Values.cworker.service.targetPort }} + name: rpc + type: {{ .Values.cworker.service.type }} + + diff --git a/chart/values.yaml b/chart/values.yaml new file mode 100644 index 0000000..0879043 --- /dev/null +++ b/chart/values.yaml @@ -0,0 +1,12 @@ +cworker: + namespace: cworker + image: + path: docker.io/onborodin + name: cworker + tag: latest + imagePullPolicy: Always + service: + name: cworker + type: LoadBalancer + port: 9002 + targetPort: 9002 diff --git a/clib/Makefile.in b/clib/Makefile.in index 769d1cd..453cbc5 100644 --- a/clib/Makefile.in +++ b/clib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -274,11 +274,13 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CP = @CP@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DOCKER = @DOCKER@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -289,11 +291,13 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_CP = @HAVE_CP@ +HELM = @HELM@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KUBECTL = @KUBECTL@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ diff --git a/clib/jparser.c b/clib/jparser.c index 4feb0b1..56d0cbc 100644 --- a/clib/jparser.c +++ b/clib/jparser.c @@ -41,7 +41,7 @@ int jparser_parse(jparser_t * parser) { char* key = ""; while ((type = jlexer_gettoken(lex, token)) != JLEXTOK_END) { - //printf("pos %d tok 0x%02x: %s\n", pos, type, token); + //log_debug("pos %d tok 0x%02x: %s\n", pos, type, token); switch (pos) { // POS 0 case 0:{ @@ -112,7 +112,7 @@ int jparser_parse(jparser_t * parser) { jkval_t* kv = &(parser->kvalarr[parser->kvalsize]); kv->key = strcopy(key); - log_debug("parser added key %s", kv->key); + //log_debug("Parser added key %s", kv->key); if (type == JLEXTOK_NUMB) { kv->type = JVALTYPE_NUM; char* eptr = NULL; @@ -162,7 +162,7 @@ int jparser_bind(jparser_t* parser, int type, char* key, void* ref) { for (int i = 0; i < parser->kvalsize; i++) { jkval_t* kv = &(parser->kvalarr[i]); - log_debug("find equal keys: kv->key = %s, key = %s", kv->key, key); + //log_debug("Find equal keys: kv->key = %s, key = %s", kv->key, key); if (strcmp(kv->key, key) == 0) { if (kv->type == JVALTYPE_STR) { *(char**)(ref) = strcopy(kv->str); diff --git a/config.h b/config.h index fef786a..50ee4a4 100644 --- a/config.h +++ b/config.h @@ -2,8 +2,8 @@ #ifndef CONFIG_H_QWER #define CONFIG_H_QWER -static const char *srv_runpath = "/dat2/home/ziggi/Projects/cworker/run/cworker.pid"; -static const char *srv_logpath = "/dat2/home/ziggi/Projects/cworker/log/cworker.log"; -static const char *srv_configpath = "/dat2/home/ziggi/Projects/cworker//cworker.conf"; +static const char *srv_runpath = "/var/run/cworker/cworker.pid"; +static const char *srv_logpath = "/var/log/cworker/cworker.log"; +static const char *srv_configpath = "/app/etc/cworker/cworker.conf"; #endif diff --git a/config.status b/config.status index 3bb3bb9..c31641e 100755 --- a/config.status +++ b/config.status @@ -427,7 +427,7 @@ $config_commands Report bugs to the package provider." -ac_cs_config="'--enable-devel-mode'" +ac_cs_config="'--prefix=/app'" ac_cs_version="\ cworker config.status 0.0.1 configured by ./configure, generated by GNU Autoconf 2.69, @@ -519,7 +519,7 @@ if $ac_cs_silent; then fi if $ac_cs_recheck; then - set X /bin/bash './configure' '--enable-devel-mode' $ac_configure_extra_args --no-create --no-recursion + set X /bin/bash './configure' '--prefix=/app' $ac_configure_extra_args --no-create --no-recursion shift $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6 CONFIG_SHELL='/bin/bash' @@ -821,20 +821,20 @@ S["am__EXEEXT_FALSE"]="" S["am__EXEEXT_TRUE"]="#" S["LTLIBOBJS"]="" S["app_name"]="cworker" -S["app_cachedir"]="/dat2/home/ziggi/Projects/cworker/cache" -S["APP_CACHEDIR"]="/dat2/home/ziggi/Projects/cworker/cache" -S["app_databasedir"]="/dat2/home/ziggi/Projects/cworker/data" -S["APP_DATABASEDIR"]="/dat2/home/ziggi/Projects/cworker/data" -S["app_user"]="ziggi" -S["APP_USER"]="ziggi" -S["app_libdir"]="/dat2/home/ziggi/Projects/cworker/lib" -S["APP_LIBDIR"]="/dat2/home/ziggi/Projects/cworker/lib" -S["app_rundir"]="/dat2/home/ziggi/Projects/cworker/run" -S["APP_RUNDIR"]="/dat2/home/ziggi/Projects/cworker/run" -S["app_logdir"]="/dat2/home/ziggi/Projects/cworker/log" -S["APP_LOGDIR"]="/dat2/home/ziggi/Projects/cworker/log" -S["app_configdir"]="/dat2/home/ziggi/Projects/cworker/" -S["APP_CONFIGDIR"]="/dat2/home/ziggi/Projects/cworker/" +S["app_cachedir"]="/var/cache/cworker" +S["APP_CACHEDIR"]="/var/cache/cworker" +S["app_databasedir"]="/var/db/cworker" +S["APP_DATABASEDIR"]="/var/db/cworker" +S["app_user"]="www-data" +S["APP_USER"]="www-data" +S["app_libdir"]="/app/lib/cworker" +S["APP_LIBDIR"]="/app/lib/cworker" +S["app_rundir"]="/var/run/cworker" +S["APP_RUNDIR"]="/var/run/cworker" +S["app_logdir"]="/var/log/cworker" +S["APP_LOGDIR"]="/var/log/cworker" +S["app_configdir"]="/app/etc/cworker" +S["APP_CONFIGDIR"]="/app/etc/cworker" S["SYSTEMD_FALSE"]="#" S["SYSTEMD_TRUE"]="" S["LINUX_OS_FALSE"]="#" @@ -873,6 +873,9 @@ S["build_vendor"]="pc" S["build_cpu"]="x86_64" S["build"]="x86_64-pc-linux-gnu" S["LIBTOOL"]="$(SHELL) $(top_builddir)/libtool" +S["KUBECTL"]="/bin/kubectl" +S["HELM"]="/bin/helm" +S["DOCKER"]="/bin/podman" S["HAVE_VALGRIND_FALSE"]="" S["HAVE_VALGRIND_TRUE"]="#" S["VALGRIND"]="/bin/valgrind" @@ -910,11 +913,11 @@ S["MKDIR_P"]="/bin/mkdir -p" S["INSTALL_STRIP_PROGRAM"]="$(install_sh) -c -s" S["STRIP"]="strip" S["install_sh"]="${SHELL} /dat2/home/ziggi/Projects/cworker/install-sh" -S["MAKEINFO"]="${SHELL} /dat2/home/ziggi/Projects/cworker/missing makeinfo" -S["AUTOHEADER"]="${SHELL} /dat2/home/ziggi/Projects/cworker/missing autoheader" -S["AUTOMAKE"]="${SHELL} /dat2/home/ziggi/Projects/cworker/missing automake" -S["AUTOCONF"]="${SHELL} /dat2/home/ziggi/Projects/cworker/missing autoconf" -S["ACLOCAL"]="${SHELL} /dat2/home/ziggi/Projects/cworker/missing aclocal" +S["MAKEINFO"]="${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' makeinfo" +S["AUTOHEADER"]="${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' autoheader" +S["AUTOMAKE"]="${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' automake-1.16" +S["AUTOCONF"]="${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' autoconf" +S["ACLOCAL"]="${SHELL} '/dat2/home/ziggi/Projects/cworker/missing' aclocal-1.16" S["VERSION"]="0.0.1" S["PACKAGE"]="cworker" S["CYGPATH_W"]="echo" @@ -951,7 +954,7 @@ S["libexecdir"]="${exec_prefix}/libexec" S["sbindir"]="${exec_prefix}/sbin" S["bindir"]="${exec_prefix}/bin" S["program_transform_name"]="s,x,x," -S["prefix"]="/usr/local" +S["prefix"]="/app" S["exec_prefix"]="${prefix}" S["PACKAGE_URL"]="" S["PACKAGE_BUGREPORT"]="" @@ -1049,13 +1052,13 @@ D["HAVE_MEMSET"]=" 1" D["HAVE_MKDIR"]=" 1" D["HAVE_SETLOCALE"]=" 1" D["HAVE_SOCKET"]=" 1" -D["APP_CONFIGDIR"]=" \"/dat2/home/ziggi/Projects/cworker/\"" -D["APP_LOGDIR"]=" \"/dat2/home/ziggi/Projects/cworker/log\"" -D["APP_RUNDIR"]=" \"/dat2/home/ziggi/Projects/cworker/run\"" -D["APP_LIBDIR"]=" \"/dat2/home/ziggi/Projects/cworker/lib\"" -D["APP_USER"]=" \"ziggi\"" -D["APP_DATABASEDIR"]=" \"/dat2/home/ziggi/Projects/cworker/data\"" -D["APP_CACHEDIR"]=" \"/dat2/home/ziggi/Projects/cworker/cache\"" +D["APP_CONFIGDIR"]=" \"/app/etc/cworker\"" +D["APP_LOGDIR"]=" \"/var/log/cworker\"" +D["APP_RUNDIR"]=" \"/var/run/cworker\"" +D["APP_LIBDIR"]=" \"/app/lib/cworker\"" +D["APP_USER"]=" \"www-data\"" +D["APP_DATABASEDIR"]=" \"/var/db/cworker\"" +D["APP_CACHEDIR"]=" \"/var/cache/cworker\"" for (key in D) D_is_set[key] = 1 FS = "" } @@ -1461,7 +1464,9 @@ $as_echo X/"$am_mf" | { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } diff --git a/configure.ac b/configure.ac index 83ce3d5..31d2104 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,15 @@ AC_STRUCT_TIMEZONE AC_PATH_PROG([VALGRIND],[valgrind true]) AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" = "xvalgrind"]) +AC_PATH_PROGS([DOCKER],[podman docker true]) +dnl if test -z "$DOCKER"; then +dnl AC_MSG_ERROR([Requested program docker or podman not found]) +dnl fi + +AC_PATH_PROGS([HELM],[helm true]) +AC_PATH_PROGS([KUBECTL],[kubectl true]) + + LT_INIT([disable-shared]) AC_SUBST([LIBTOOL_DEPS]) AC_CONFIG_MACRO_DIRS([m4]) diff --git a/cworker.c b/cworker.c index 8146698..c1acdf3 100644 --- a/cworker.c +++ b/cworker.c @@ -45,7 +45,7 @@ #include #include -static const int64_t default_port = 9701; +static const int64_t default_port = 9002; static cworker_t* pworker = NULL; static int mkdirall(const char* path, mode_t mode); @@ -288,11 +288,16 @@ int cworker_handler(const cworker_t* worker, int socket) { } int64_t id = 0; + int64_t timeout = 0; char* name = "none"; if (jparser_bind(&parser, JVALTYPE_NUM, "id", (void *)&id) < 0) { log_error("Cannot bind id"); } + if (jparser_bind(&parser, JVALTYPE_NUM, "timeout", (void *)&timeout) < 0) { + log_error("Cannot bind timeout"); + } + if (jparser_bind(&parser, JVALTYPE_STR, "name", (void *)&name) < 0) { log_error("Cannot bind name"); } @@ -306,7 +311,12 @@ int cworker_handler(const cworker_t* worker, int socket) { jblock_addstr(&jb, "message", msg); jblock_addbool(&jb, "error", false); jblock_addint(&jb, "id", id); + jblock_addint(&jb, "timeout", timeout); + for (int64_t i = 0; i < timeout; i++) { + log_debug("The handler slept for %ld second from %ld", i + 1, timeout); + sleep(1); + } char* jsonstr = NULL; jblock_outjson(&jb, &jsonstr); diff --git a/cworker.conf b/cworker.conf index e5fd76a..8382cd8 100644 --- a/cworker.conf +++ b/cworker.conf @@ -1,2 +1,2 @@ -port = 9001 # listen port +port = 9002 # listen port diff --git a/defines.h b/defines.h index 600a662..ac78c78 100644 --- a/defines.h +++ b/defines.h @@ -2,25 +2,25 @@ /* defines.h.in. Generated from configure.ac by autoheader. */ /* location of cache dir */ -#define APP_CACHEDIR "/dat2/home/ziggi/Projects/cworker/cache" +#define APP_CACHEDIR "/var/cache/cworker" /* location of configuration files for ${PACKAGE} */ -#define APP_CONFIGDIR "/dat2/home/ziggi/Projects/cworker/" +#define APP_CONFIGDIR "/app/etc/cworker" /* location of database dir */ -#define APP_DATABASEDIR "/dat2/home/ziggi/Projects/cworker/data" +#define APP_DATABASEDIR "/var/db/cworker" /* location of libs */ -#define APP_LIBDIR "/dat2/home/ziggi/Projects/cworker/lib" +#define APP_LIBDIR "/app/lib/cworker" /* location of ${PACKAGE} logdir */ -#define APP_LOGDIR "/dat2/home/ziggi/Projects/cworker/log" +#define APP_LOGDIR "/var/log/cworker" /* location of pid file */ -#define APP_RUNDIR "/dat2/home/ziggi/Projects/cworker/run" +#define APP_RUNDIR "/var/run/cworker" /* effective user */ -#define APP_USER "ziggi" +#define APP_USER "www-data" /* Define to 1 if you have the header file. */ #define HAVE_ARPA_INET_H 1 @@ -57,6 +57,9 @@ to 0 otherwise. */ #define HAVE_MALLOC 1 +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + /* Define to 1 if you have the `memset' function. */ #define HAVE_MEMSET 1 @@ -75,9 +78,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDIO_H */ - /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 @@ -155,9 +155,7 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION "0.0.1" -/* Define to 1 if all of the C90 standard headers exist (not just the ones - required in a freestanding environment). This macro is provided for - backward compatibility; new code need not use it. */ +/* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if your declares `struct tm'. */ @@ -175,7 +173,7 @@ /* Define to `int' if does not define. */ /* #undef mode_t */ -/* Define as a signed integer type capable of holding a process identifier. */ +/* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to `int' if does not define. */ diff --git a/defines.h.in b/defines.h.in index c31d4f3..c842977 100644 --- a/defines.h.in +++ b/defines.h.in @@ -56,6 +56,9 @@ to 0 otherwise. */ #undef HAVE_MALLOC +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET @@ -74,9 +77,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -154,9 +154,7 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if all of the C90 standard headers exist (not just the ones - required in a freestanding environment). This macro is provided for - backward compatibility; new code need not use it. */ +/* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if your declares `struct tm'. */ @@ -174,7 +172,7 @@ /* Define to `int' if does not define. */ #undef mode_t -/* Define as a signed integer type capable of holding a process identifier. */ +/* Define to `int' if does not define. */ #undef pid_t /* Define to `int' if does not define. */