From 3b6be8033e94897d2d07d79ff67697e83480bc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D0=B5=D0=B3=20=D0=91=D0=BE=D1=80=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sat, 14 Feb 2026 21:17:15 +0200 Subject: [PATCH] working commit --- .gitignore | 1 + Containerfile | 23 ++++ Makefile.am | 47 +++++-- Makefile.in | 74 ++++++++--- app/config/variant.go | 8 +- chart/.gitignore | 3 + chart/.helmignore | 2 + chart/Chart.yaml.in | 7 + chart/templates/_imagepath.tpl | 9 ++ chart/templates/_serviceport.tmpl | 10 ++ chart/templates/_storageclass.tpl | 10 ++ chart/templates/_storagesize.tpl | 10 ++ chart/templates/_userpass.tpl | 31 +++++ chart/templates/configmap.yaml | 11 ++ chart/templates/deployment.yaml | 37 ++++++ chart/templates/service.yaml | 14 ++ chart/templates/volumeclaim.yaml | 12 ++ chart/values.yaml.in | 16 +++ configure | 210 +++++++++++++++++++++++++++++- configure.ac | 8 ++ initrc/mstored.service | 2 +- test/account_test.go | 2 +- test/file_test.go | 1 - test/image_test.go | 5 +- 24 files changed, 514 insertions(+), 39 deletions(-) create mode 100644 Containerfile create mode 100644 chart/.gitignore create mode 100644 chart/.helmignore create mode 100644 chart/Chart.yaml.in create mode 100644 chart/templates/_imagepath.tpl create mode 100644 chart/templates/_serviceport.tmpl create mode 100644 chart/templates/_storageclass.tpl create mode 100644 chart/templates/_storagesize.tpl create mode 100644 chart/templates/_userpass.tpl create mode 100644 chart/templates/configmap.yaml create mode 100644 chart/templates/deployment.yaml create mode 100644 chart/templates/service.yaml create mode 100644 chart/templates/volumeclaim.yaml create mode 100644 chart/values.yaml.in diff --git a/.gitignore b/.gitignore index e649bd3..1f9faf4 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ cmd/mstorectl/mstorectl tmp mstored mstorectl +DIST diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..e73a247 --- /dev/null +++ b/Containerfile @@ -0,0 +1,23 @@ +FROM alpine:3.20 as builder + +RUN apk --no-cache add make binutils gcc libc-dev automake autoconf curl +RUN curl -o /usr/local/lib/go.tar.gz https://dl.google.com/go/go1.25.5.linux-amd64.tar.gz +RUN cd /usr/local/lib && tar xzf go.tar.gz +RUN cd /usr/local/bin && ln -sf ../lib/go/bin/* . + +WORKDIR /app/src/ +COPY go.mod go.sum . +COPY . . + +RUN ./configure --prefix=/app +RUN make all install +RUN make clean +RUN rm -rf /app/src + +FROM alpine:3.20 +COPY --from=builder /app /app +RUN chmod 1777 /var +WORKDIR /app + +#USER daemon:daemon +ENTRYPOINT ["/app/sbin/mstored"] diff --git a/Makefile.am b/Makefile.am index 44a036d..0d6fd2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,16 +33,36 @@ format: done .PHONY: test - test: - cd pkg/client && $(GO) test -v . + cd test && $(GO) test -v . + + +DIST_DIR= $(shell pwd)/DIST + +IMAGE_REPO = localhost +IMAGE_NAME = $(PACKAGE_NAME):$(PACKAGE_VERSION) +IMAGE_TARNAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION).img +IMAGE_CONTAINERFILE = Containerfile + +image:: build-image +build-image: clean + $(GO) mod vendor + mkdir -p $(DIST_DIR) + $(SUDO) $(PODMAN) build -t $(IMAGE_REPO)/$(IMAGE_NAME) -f $(IMAGE_CONTAINERFILE) . + rm -f $(DIST_DIR)/$(IMAGE_TARNAME) + $(SUDO) $(PODMAN) image save $(IMAGE_REPO)/$(IMAGE_NAME) --format oci-archive \ + -o $(DIST_DIR)/$(IMAGE_TARNAME) + username=$$(whoami); \ + $(SUDO) chown $$username $(DIST_DIR)/$(IMAGE_TARNAME) + rm -rf vendor + +CHART_NAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION).tgz + +chart:: build-chart +build-chart: + mkdir -p $(DIST_DIR) + $(HELM) package --destination $(DIST_DIR) chart/ -clean-local: - $(FIND) $(CWD) -name '*~' | $(XARGS) rm -f - rm -rf autom4te.cache - rm -f cmd/mstored/istored - rm -f cmd/mstorectl/mstorectl - rm -rf tmp/ FREEBSD_LOCALBASE = /usr/local FREEBSD_RCDIR = $(FREEBSD_LOCALBASE)/etc/rc.d @@ -64,3 +84,14 @@ if SYSTEMD $(INSTALL_DATA) initrc/mstored.service $(DESTDIR)$(LINUX_SYSTEMDDIR) endif endif + +clean-local: + $(FIND) $(CWD) -name '*~' | $(XARGS) rm -f + rm -rf autom4te.cache + rm -f cmd/mstored/istored + rm -f cmd/mstorectl/mstorectl + rm -rf tmp/ + +distclean-local: + rm -rf autom4te.cache + rm -rf $(DIST_DIR) diff --git a/Makefile.in b/Makefile.in index a3a224f..5f722a3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -101,7 +101,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = app/config/variant.go initrc/mstored.service \ - initrc/mstored + initrc/mstored chart/Chart.yaml chart/values.yaml CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) @@ -165,6 +165,8 @@ am__define_uniq_tagged_files = \ AM_RECURSIVE_TARGETS = cscope am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/app/config/variant.go.in \ + $(top_srcdir)/chart/Chart.yaml.in \ + $(top_srcdir)/chart/values.yaml.in \ $(top_srcdir)/initrc/mstored.in \ $(top_srcdir)/initrc/mstored.service.in README.md config.guess \ config.sub install-sh missing @@ -194,7 +196,9 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BASENAME = @BASENAME@ CP = @CP@ +CPIO = @CPIO@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ @@ -206,6 +210,7 @@ ETAGS = @ETAGS@ FIND = @FIND@ GO = @GO@ HAVE_GO = @HAVE_GO@ +HELM = @HELM@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -229,6 +234,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SORT = @SORT@ STRIP = @STRIP@ +SUDO = @SUDO@ UNIQ = @UNIQ@ VERSION = @VERSION@ XARGS = @XARGS@ @@ -300,6 +306,12 @@ mstored_SOURCES = \ cmd/mstored/main.go CWD = $(shell pwd) +DIST_DIR = $(shell pwd)/DIST +IMAGE_REPO = localhost +IMAGE_NAME = $(PACKAGE_NAME):$(PACKAGE_VERSION) +IMAGE_TARNAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION).img +IMAGE_CONTAINERFILE = Containerfile +CHART_NAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION).tgz FREEBSD_LOCALBASE = /usr/local FREEBSD_RCDIR = $(FREEBSD_LOCALBASE)/etc/rc.d LINUX_SYSTEMDDIR = /lib/systemd/system @@ -345,6 +357,10 @@ initrc/mstored.service: $(top_builddir)/config.status $(top_srcdir)/initrc/mstor cd $(top_builddir) && $(SHELL) ./config.status $@ initrc/mstored: $(top_builddir)/config.status $(top_srcdir)/initrc/mstored.in cd $(top_builddir) && $(SHELL) ./config.status $@ +chart/Chart.yaml: $(top_builddir)/config.status $(top_srcdir)/chart/Chart.yaml.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +chart/values.yaml: $(top_builddir)/config.status $(top_srcdir)/chart/values.yaml.in + cd $(top_builddir) && $(SHELL) ./config.status $@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -712,7 +728,7 @@ distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-local distclean-tags dvi: dvi-am @@ -781,15 +797,15 @@ uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS 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 dist-zstd distcheck distclean \ - distclean-compile distclean-generic distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-data-local 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 maintainer-clean \ + distclean-compile distclean-generic distclean-local \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am \ + install-data-local 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 maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-sbinPROGRAMS @@ -813,16 +829,25 @@ format: done .PHONY: test - test: - cd pkg/client && $(GO) test -v . + cd test && $(GO) test -v . -clean-local: - $(FIND) $(CWD) -name '*~' | $(XARGS) rm -f - rm -rf autom4te.cache - rm -f cmd/mstored/istored - rm -f cmd/mstorectl/mstorectl - rm -rf tmp/ +image:: build-image +build-image: clean + $(GO) mod vendor + mkdir -p $(DIST_DIR) + $(SUDO) $(PODMAN) build -t $(IMAGE_REPO)/$(IMAGE_NAME) -f $(IMAGE_CONTAINERFILE) . + rm -f $(DIST_DIR)/$(IMAGE_TARNAME) + $(SUDO) $(PODMAN) image save $(IMAGE_REPO)/$(IMAGE_NAME) --format oci-archive \ + -o $(DIST_DIR)/$(IMAGE_TARNAME) + username=$$(whoami); \ + $(SUDO) chown $$username $(DIST_DIR)/$(IMAGE_TARNAME) + rm -rf vendor + +chart:: build-chart +build-chart: + mkdir -p $(DIST_DIR) + $(HELM) package --destination $(DIST_DIR) chart/ install-data-local: test -z $(DESTDIR)$(srv_confdir) || $(MKDIR_P) $(DESTDIR)$(srv_confdir) @@ -835,6 +860,17 @@ install-data-local: @LINUX_OS_TRUE@@SYSTEMD_TRUE@ test -z $(DESTDIR)$(LINUX_SYSTEMDDIR) || $(MKDIR_P) $(DESTDIR)$(LINUX_SYSTEMDDIR) @LINUX_OS_TRUE@@SYSTEMD_TRUE@ $(INSTALL_DATA) initrc/mstored.service $(DESTDIR)$(LINUX_SYSTEMDDIR) +clean-local: + $(FIND) $(CWD) -name '*~' | $(XARGS) rm -f + rm -rf autom4te.cache + rm -f cmd/mstored/istored + rm -f cmd/mstorectl/mstorectl + rm -rf tmp/ + +distclean-local: + rm -rf autom4te.cache + rm -rf $(DIST_DIR) + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/app/config/variant.go b/app/config/variant.go index 6e2d0bb..9bba10e 100644 --- a/app/config/variant.go +++ b/app/config/variant.go @@ -1,10 +1,10 @@ package config const ( - confdir = "/usr/local/etc/mstore" - rundir = "/var/run/mstore" - logdir = "/var/log/mstore" - datadir = "/var/data/mstore" + confdir = "/home/ziggi/Projects/mstore/etc/mstore" + rundir = "/home/ziggi/Projects/mstore/tmp/run" + logdir = "/home/ziggi/Projects/mstore/tmp/log" + datadir = "/home/ziggi/Projects/mstore/tmp/data" version = "0.1.0" srvname = "mstored" ) diff --git a/chart/.gitignore b/chart/.gitignore new file mode 100644 index 0000000..0dc8d99 --- /dev/null +++ b/chart/.gitignore @@ -0,0 +1,3 @@ +*~ +Chart.yaml +values.yaml diff --git a/chart/.helmignore b/chart/.helmignore new file mode 100644 index 0000000..4ac5b94 --- /dev/null +++ b/chart/.helmignore @@ -0,0 +1,2 @@ +*.in +*~ diff --git a/chart/Chart.yaml.in b/chart/Chart.yaml.in new file mode 100644 index 0000000..e7b54f5 --- /dev/null +++ b/chart/Chart.yaml.in @@ -0,0 +1,7 @@ +apiVersion: v1 +name: @PACKAGE_NAME@ +description: mStore service +type: application +version: "@PACKAGE_VERSION@" +appVersion: "@PACKAGE_VERSION@" + diff --git a/chart/templates/_imagepath.tpl b/chart/templates/_imagepath.tpl new file mode 100644 index 0000000..09e87da --- /dev/null +++ b/chart/templates/_imagepath.tpl @@ -0,0 +1,9 @@ +{{- define "mstore.imagePath" -}} +{{- if .Values.global -}} +{{- if .Values.global.imagePath -}} +{{- .Values.global.imagePath -}} +{{- end -}} +{{- else -}} +{{- .Values.main.image.path -}} +{{- end -}} +{{- end -}} diff --git a/chart/templates/_serviceport.tmpl b/chart/templates/_serviceport.tmpl new file mode 100644 index 0000000..f0acdaf --- /dev/null +++ b/chart/templates/_serviceport.tmpl @@ -0,0 +1,10 @@ +{{- define "mstore.servicePort" -}} +{{- if .Values.global -}} +{{- if .Values.global.mstorePort -}} +{{- .Values.global.mstorePort -}} +{{- end -}} +{{- else -}} +{{- .Values.main.service.port -}} +{{- end -}} +{{- end -}} + diff --git a/chart/templates/_storageclass.tpl b/chart/templates/_storageclass.tpl new file mode 100644 index 0000000..e67e9e6 --- /dev/null +++ b/chart/templates/_storageclass.tpl @@ -0,0 +1,10 @@ +{{- define "mstore.storageClass" -}} +{{- if .Values.global -}} +{{- if .Values.global.storageClass -}} +{{- .Values.global.storageClass -}} +{{- end -}} +{{- else -}} +{{- .Values.main.storageClass -}} +{{- end -}} +{{- end -}} + diff --git a/chart/templates/_storagesize.tpl b/chart/templates/_storagesize.tpl new file mode 100644 index 0000000..c6cf4c8 --- /dev/null +++ b/chart/templates/_storagesize.tpl @@ -0,0 +1,10 @@ +{{- define "mstore.storageSize" -}} +{{- if .Values.global -}} +{{- if .Values.global.mstoreStorageSize -}} +{{- .Values.global.mstoreStorageSize -}} +{{- end -}} +{{- else -}} +{{- .Values.main.storageSize -}} +{{- end -}} +{{- end -}} + diff --git a/chart/templates/_userpass.tpl b/chart/templates/_userpass.tpl new file mode 100644 index 0000000..b917411 --- /dev/null +++ b/chart/templates/_userpass.tpl @@ -0,0 +1,31 @@ +{{- define "mstore.username" -}} +{{- if .Values.global -}} +{{- if .Values.global.mstoreUsername -}} +{{- .Values.global.mstoreUsername -}} +{{- else -}} +{{- fail "Istore username is empty, fill it in global values.yaml !" -}} +{{- end -}} +{{- else -}} +{{- if .Values.main.auth.username -}} +{{- .Values.main.auth.username -}} +{{- else -}} +{{- fail "Istore username is empty, fill it in values.yaml !" -}} +{{- end }} +{{- end -}} +{{- end -}} + +{{- define "mstore.password" -}} +{{- if .Values.global -}} +{{- if .Values.global.mstoreUserpass -}} +{{- .Values.global.mstoreUserpass -}} +{{- else -}} +{{- fail "Istore password is empty, fill it in global values.yaml !"}} +{{- end -}} +{{- else -}} +{{- if .Values.main.auth.password -}} +{{- .Values.main.auth.password -}} +{{- else -}} +{{- fail "Istore password is empty, fill it in values.yaml !"}} +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/chart/templates/configmap.yaml b/chart/templates/configmap.yaml new file mode 100644 index 0000000..94cc4d8 --- /dev/null +++ b/chart/templates/configmap.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: {{ .Release.Namespace }} + name: mstored-config +data: + mstored.yaml: |- + service: + address: 0.0.0.0 + port: {{ include "mstore.servicePort" . }} + asDaemon: false diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml new file mode 100644 index 0000000..ee905ff --- /dev/null +++ b/chart/templates/deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mstore + namespace: {{ .Release.Namespace }} +spec: + replicas: 1 + selector: + matchLabels: + app: mstore + template: + metadata: + labels: + app: mstore + spec: + restartPolicy: Always + containers: + - securityContext: + privileged: true + image: {{ include "mstore.imagePath" . }}/{{ .Values.main.image.name }}:{{ .Values.main.image.tag }} + imagePullPolicy: {{ .Values.main.image.imagePullPolicy }} + name: mstore + ports: + - containerPort: {{ include "mstore.servicePort" . }} + protocol: TCP + volumeMounts: + - name: config-volume + mountPath: /app/etc/mstore + - name: db-volume + mountPath: /var/data + volumes: + - name: config-volume + configMap: + name: mstored-config + - name: db-volume + persistentVolumeClaim: + claimName: mstore-data diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml new file mode 100644 index 0000000..5b9f119 --- /dev/null +++ b/chart/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: mstore + namespace: {{ .Release.Namespace }} +spec: + selector: + app: mstore + ports: + - port: {{ include "mstore.servicePort" . }} + protocol: TCP + targetPort: {{ include "mstore.servicePort" . }} + name: api + type: {{ .Values.main.service.type }} diff --git a/chart/templates/volumeclaim.yaml b/chart/templates/volumeclaim.yaml new file mode 100644 index 0000000..eca1d13 --- /dev/null +++ b/chart/templates/volumeclaim.yaml @@ -0,0 +1,12 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: mstore-data +spec: + storageClassName: {{ include "mstore.storageClass" . }} + accessModes: + - ReadWriteOnce + volumeMode: Filesystem + resources: + requests: + storage: {{ include "mstore.storageSize" . }} diff --git a/chart/values.yaml.in b/chart/values.yaml.in new file mode 100644 index 0000000..b7ae2dd --- /dev/null +++ b/chart/values.yaml.in @@ -0,0 +1,16 @@ +main: + image: + path: hub.unix7.org/mstore + name: "@PACKAGE_NAME@" + tag: "@PACKAGE_VERSION@" + imagePullPolicy: Always + service: + type: LoadBalancer + port: 1025 +# x509Cert: xxx +# x509Key: xxx + hostname: "localhost" + daemon: false + storageClass: local-path + storageSize: 10Gi + \ No newline at end of file diff --git a/configure b/configure index bdcffb6..1eb7e64 100755 --- a/configure +++ b/configure @@ -638,6 +638,10 @@ build_vendor build_cpu build CP +HELM +BASENAME +CPIO +SUDO UNIQ SORT XARGS @@ -2888,6 +2892,208 @@ printf "%s\n" "no" >&6; } fi +for ac_prog in sudo false +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_SUDO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $SUDO in + [\\/]* | ?:[\\/]*) + ac_cv_path_SUDO="$SUDO" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_SUDO="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +SUDO=$ac_cv_path_SUDO +if test -n "$SUDO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SUDO" >&5 +printf "%s\n" "$SUDO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$SUDO" && break +done + +for ac_prog in cpio false +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_CPIO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $CPIO in + [\\/]* | ?:[\\/]*) + ac_cv_path_CPIO="$CPIO" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_CPIO="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +CPIO=$ac_cv_path_CPIO +if test -n "$CPIO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPIO" >&5 +printf "%s\n" "$CPIO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CPIO" && break +done + +for ac_prog in basename +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_BASENAME+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $BASENAME in + [\\/]* | ?:[\\/]*) + ac_cv_path_BASENAME="$BASENAME" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_BASENAME="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +BASENAME=$ac_cv_path_BASENAME +if test -n "$BASENAME"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BASENAME" >&5 +printf "%s\n" "$BASENAME" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$BASENAME" && break +done + + +for ac_prog in helm true +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_HELM+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $HELM in + [\\/]* | ?:[\\/]*) + ac_cv_path_HELM="$HELM" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_HELM="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +HELM=$ac_cv_path_HELM +if test -n "$HELM"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $HELM" >&5 +printf "%s\n" "$HELM" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$HELM" && break +done + + for ac_prog in gcp cp @@ -3344,7 +3550,7 @@ printf "%s\n" "$as_me: srv_datadir set as ${SRV_DATADIR}" >&6;} -ac_config_files="$ac_config_files Makefile app/config/variant.go initrc/mstored.service initrc/mstored" +ac_config_files="$ac_config_files Makefile app/config/variant.go initrc/mstored.service initrc/mstored chart/Chart.yaml chart/values.yaml" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4086,6 +4292,8 @@ do "app/config/variant.go") CONFIG_FILES="$CONFIG_FILES app/config/variant.go" ;; "initrc/mstored.service") CONFIG_FILES="$CONFIG_FILES initrc/mstored.service" ;; "initrc/mstored") CONFIG_FILES="$CONFIG_FILES initrc/mstored" ;; + "chart/Chart.yaml") CONFIG_FILES="$CONFIG_FILES chart/Chart.yaml" ;; + "chart/values.yaml") CONFIG_FILES="$CONFIG_FILES chart/values.yaml" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/configure.ac b/configure.ac index 7515d03..51ab8d7 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,12 @@ AC_PATH_PROG([FIND],[find]) AC_PATH_PROG([XARGS],[xargs]) AC_PATH_PROG([SORT],[sort]) AC_PATH_PROG([UNIQ],[uniq]) +AC_PATH_PROGS([SUDO],[sudo false]) +AC_PATH_PROGS([CPIO],[cpio false]) +AC_PATH_PROGS([BASENAME],[basename]) + +AC_PATH_PROGS([HELM],[helm true]) + AC_PATH_PROGS([CP],[gcp cp]) @@ -238,5 +244,7 @@ Makefile app/config/variant.go initrc/mstored.service initrc/mstored +chart/Chart.yaml +chart/values.yaml ]) AC_OUTPUT diff --git a/initrc/mstored.service b/initrc/mstored.service index 4469bed..2b9bee9 100644 --- a/initrc/mstored.service +++ b/initrc/mstored.service @@ -3,7 +3,7 @@ Description=mstored [Service] Type=forking -PIDFile=/var/run/mstore/mstored.pid +PIDFile=/home/ziggi/Projects/mstore/tmp/run/mstored.pid ExecStart=/usr/local/sbin/mstored -daemon=true ExecReload=/bin/kill -HUP $MAINPID diff --git a/test/account_test.go b/test/account_test.go index 9d23754..8cb998e 100644 --- a/test/account_test.go +++ b/test/account_test.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/yaml" ) -func xxxTestAccountLife(t *testing.T) { +func TestAccountLife(t *testing.T) { var srvport int64 = 10250 srvdir := t.TempDir() srvaddr := fmt.Sprintf("mstore:mstore@127.0.0.1:%d", srvport) diff --git a/test/file_test.go b/test/file_test.go index 43e0195..62d2b65 100644 --- a/test/file_test.go +++ b/test/file_test.go @@ -111,7 +111,6 @@ func TestFileLife(t *testing.T) { require.True(t, exists) require.NotNil(t, file) } - return { // GetFile fmt.Printf("=== GetFile ===\n") diff --git a/test/image_test.go b/test/image_test.go index 6833f51..b3d7434 100644 --- a/test/image_test.go +++ b/test/image_test.go @@ -98,11 +98,8 @@ func TestImageLife(t *testing.T) { fmt.Printf("=== DeleteImage ===\n") cli := client.NewClient() ctx, _ := context.WithTimeout(context.Background(), 1*time.Second) - info, err := cli.DeleteImage(ctx, srvaddr+"/foo/test:123") + err := cli.DeleteImage(ctx, srvaddr+"/foo/test:123") require.NoError(t, err) - infoYaml, err := yaml.Marshal(info) - require.NoError(t, err) - fmt.Printf("deleteImage:\n%s\n", string(infoYaml)) } }