From 99ca4641fbce3068e0cf5763daf4c825c31e57da6374a322c6153ccd46d53640 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Sun, 7 Mar 2021 09:33:37 +0000 Subject: [PATCH] Accepting request 877487 from home:matwey:branches:server:database This is influxdb2, next major version of InfluxDB time series database OBS-URL: https://build.opensuse.org/request/show/877487 OBS-URL: https://build.opensuse.org/package/show/server:database/influxdb2?expand=0&rev=1 --- .gitattributes | 23 ++++ .gitignore | 1 + _service | 23 ++++ influxdb.init | 249 +++++++++++++++++++++++++++++++++++++++++ influxdb.service | 16 +++ influxdb.tmpfiles | 1 + influxdb2-2.0.4.tar.xz | 3 + influxdb2.changes | 4 + influxdb2.spec | 133 ++++++++++++++++++++++ vendor.tar.xz | 3 + 10 files changed, 456 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _service create mode 100644 influxdb.init create mode 100644 influxdb.service create mode 100644 influxdb.tmpfiles create mode 100644 influxdb2-2.0.4.tar.xz create mode 100644 influxdb2.changes create mode 100644 influxdb2.spec create mode 100644 vendor.tar.xz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_service b/_service new file mode 100644 index 0000000..b323f5b --- /dev/null +++ b/_service @@ -0,0 +1,23 @@ + + + git://github.com/influxdata/influxdb.git + git + 2.0 + @PARENT_TAG@ + disable + v(.*) + influxdb2 + + + influxdb + + + *.tar + gz + + + + *.tar.gz + xz + + diff --git a/influxdb.init b/influxdb.init new file mode 100644 index 0000000..e343280 --- /dev/null +++ b/influxdb.init @@ -0,0 +1,249 @@ +#!/bin/sh +# +# /etc/init.d/influx +# and its symbolic link +# /(usr/)sbin/rcinflux +# +### BEGIN INIT INFO +# Provides: influx +# Required-Start: $syslog $remote_fs +# Should-Start: $time ypbind smtp +# Required-Stop: $syslog $remote_fs +# Should-Stop: ypbind smtp +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: InfluxDB database server +# Description: InfluxDB database server +### END INIT INFO +# +# Any extensions to the keywords given above should be preceeded by +# X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB. +# +# Notes on Required-Start/Should-Start: +# * There are two different issues that are solved by Required-Start +# and Should-Start +# (a) Hard dependencies: This is used by the runlevel editor to determine +# which services absolutely need to be started to make the start of +# this service make sense. Example: nfsserver should have +# Required-Start: $portmap +# Also, required services are started before the dependent ones. +# The runlevel editor will warn about such missing hard dependencies +# and suggest enabling. During system startup, you may expect an error, +# if the dependency is not fulfilled. +# (b) Specifying the init script ordering, not real (hard) dependencies. +# This is needed by insserv to determine which service should be +# started first (and at a later stage what services can be started +# in parallel). The tag Should-Start: is used for this. +# It tells, that if a service is available, it should be started +# before. If not, never mind. +# * When specifying hard dependencies or ordering requirements, you can +# use names of services (contents of their Provides: section) +# or pseudo names starting with a $. The following ones are available +# according to LSB (1.1): +# $local_fs all local file systems are mounted +# (most services should need this!) +# $remote_fs all remote file systems are mounted +# (note that /usr may be remote, so +# many services should Require this!) +# $syslog system logging facility up +# $network low level networking (eth card, ...) +# $named hostname resolution available +# $netdaemons all network daemons are running +# The $netdaemons pseudo service has been removed in LSB 1.2. +# For now, we still offer it for backward compatibility. +# These are new (LSB 1.2): +# $time the system time has been set correctly +# $portmap SunRPC portmapping service available +# UnitedLinux extensions: +# $ALL indicates that a script should be inserted +# at the end +# * The services specified in the stop tags +# (Required-Stop/Should-Stop) +# specify which services need to be still running when this service +# is shut down. Often the entries there are just copies or a subset +# from the respective start tag. +# * Should-Start/Stop are now part of LSB as of 2.0, +# formerly SUSE/Unitedlinux used X-UnitedLinux-Should-Start/-Stop. +# insserv does support both variants. +# * X-UnitedLinux-Default-Enabled: yes/no is used at installation time +# (%fillup_and_insserv macro in %post of many RPMs) to specify whether +# a startup script should default to be enabled after installation. +# It's not used by insserv. +# +# Note on runlevels: +# 0 - halt/poweroff 6 - reboot +# 1 - single user 2 - multiuser without network exported +# 3 - multiuser w/ network (text mode) 5 - multiuser w/ network and X11 (xdm) +# +# Note on script names: +# http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/scrptnames.html +# A registry has been set up to manage the init script namespace. +# http://www.lanana.org/ +# Please use the names already registered or register one or use a +# vendor prefix. + + +# Check for missing binaries (stale symlinks should not happen) +# Note: Special treatment of stop for LSB conformance +INFLUXDB_BIN=/usr/bin/influxd +test -x $INFLUXDB_BIN || { echo "$INFLUXDB_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } +INFLUXDB_PID="/var/run/influxdb/influxdb.pid" +# # Check for existence of needed config file and read it +# INFLUXDB_CONFIG=/etc/sysconfig/influx +# test -r $INFLUXDB_CONFIG || { echo "$INFLUXDB_CONFIG not existing"; +# if [ "$1" = "stop" ]; then exit 0; +# else exit 6; fi; } +# +# # Read config +# . $INFLUXDB_CONFIG + +# Source LSB init functions +# providing start_daemon, killproc, pidofproc, +# log_success_msg, log_failure_msg and log_warning_msg. +# This is currently not used by UnitedLinux based distributions and +# not needed for init scripts for UnitedLinux only. If it is used, +# the functions from rc.status should not be sourced or used. +#. /lib/lsb/init-functions + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v be verbose in local rc status and clear it afterwards +# rc_status -v -r ditto and clear both the local and overall rc status +# rc_status -s display "skipped" and exit with status 3 +# rc_status -u display "unused" and exit with status 3 +# rc_failed set local and overall rc status to failed +# rc_failed set local and overall rc status to +# rc_reset clear both the local and overall rc status +# rc_exit exit appropriate to overall rc status +# rc_active checks whether a service is activated by symlinks +. /etc/rc.status + +# Reset status of this service +rc_reset + +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - user had insufficient privileges +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signaling is not supported) are +# considered a success. + +case "$1" in + start) + echo -n "Starting influx " + ## Start daemon with startproc(8). If this fails + ## the return value is set appropriately by startproc. + /sbin/startproc -u influxdb -g influxdb -l /var/log/influxdb/startup.log $INFLUXDB_BIN -config /etc/influxdb/config.toml -pidfile $INFLUXDB_PID + + # Remember status and be verbose + rc_status -v + ;; + stop) + echo -n "Shutting down influx " + ## Stop daemon with killproc(8) and if this fails + ## killproc sets the return value according to LSB. + + /sbin/killproc -p $INFLUXDB_PID $INFLUXDB_BIN + + # Remember status and be verbose + rc_status -v + ;; + try-restart|condrestart) + ## Do a restart only if the service was active before. + ## Note: try-restart is now part of LSB (as of 1.9). + ## RH has a similar command named condrestart. + if test "$1" = "condrestart"; then + echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset # Not running is not a failure. + fi + # Remember status and be quiet + rc_status + ;; + restart) + ## Stop the service and regardless of whether it was + ## running or not, start it again. + $0 stop + $0 start + + # Remember status and be quiet + rc_status + ;; + force-reload) + ## Signal the daemon to reload its config. Most daemons + ## do this on signal 1 (SIGHUP). + ## If it does not support it, restart the service if it + ## is running. + + echo -n "Reload service influx " + ## if it supports it: + /sbin/killproc -p $INFLUXDB_PID -HUP $INFLUXDB_BIN + #touch /var/run/influx.pid + rc_status -v + + ## Otherwise: + #$0 try-restart + #rc_status + ;; + reload) + ## Like force-reload, but if daemon does not support + ## signaling, do nothing (!) + + # If it supports signaling: + echo -n "Reload service influx " + /sbin/killproc -p $INFLUXDB_PID -HUP $INFLUXDB_BIN + #touch /var/run/influx.pid + rc_status -v + + ## Otherwise if it does not support reload: + #rc_failed 3 + #rc_status -v + ;; + status) + echo -n "Checking for service influx " + ## Check status with checkproc(8), if process is running + ## checkproc will return with exit status 0. + + # Return value is slightly different for the status command: + # 0 - service up and running + # 1 - service dead, but /var/run/ pid file exists + # 2 - service dead, but /var/lock/ lock file exists + # 3 - service not running (unused) + # 4 - service status unknown :-( + # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) + + # NOTE: checkproc returns LSB compliant status values. + /sbin/checkproc $INFLUXDB_BIN + # NOTE: rc_status knows that we called this init script with + # "status" option and adapts its messages accordingly. + rc_status -v + ;; + probe) + ## Optional: Probe for the necessity of a reload, print out the + ## argument to this init script which is required for a reload. + ## Note: probe is not (yet) part of LSB (as of 1.9) + + test /etc/influxdb/config.toml -nt $INFLUXDB_PID && echo reload + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" + exit 1 + ;; +esac +rc_exit diff --git a/influxdb.service b/influxdb.service new file mode 100644 index 0000000..97fdeb3 --- /dev/null +++ b/influxdb.service @@ -0,0 +1,16 @@ +[Unit] +Description=InfluxDB database server +After=network.target + +[Service] +Environment="config=/etc/influxdb/config.toml" "pidfile=/run/influxdb/influxdb.pid" +LimitNOFILE=100000 +ExecStart=/usr/bin/influxd -config ${config} -pidfile ${pidfile} +Type=simple +StandardOutput=journal +StandardError=journal +User=influxdb +Group=influxdb + +[Install] +WantedBy=multi-user.target diff --git a/influxdb.tmpfiles b/influxdb.tmpfiles new file mode 100644 index 0000000..f38b001 --- /dev/null +++ b/influxdb.tmpfiles @@ -0,0 +1 @@ +d /run/influxdb 0775 influxdb influxdb diff --git a/influxdb2-2.0.4.tar.xz b/influxdb2-2.0.4.tar.xz new file mode 100644 index 0000000..8551cab --- /dev/null +++ b/influxdb2-2.0.4.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c761a72931ebe18027d8d1dbc0b7ec58092b3b242003052e0d8e06911693fa84 +size 11017508 diff --git a/influxdb2.changes b/influxdb2.changes new file mode 100644 index 0000000..346fb0a --- /dev/null +++ b/influxdb2.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Sun Mar 7 08:54:12 UTC 2021 - Matwey Kornilov + +- Initial version diff --git a/influxdb2.spec b/influxdb2.spec new file mode 100644 index 0000000..d62142c --- /dev/null +++ b/influxdb2.spec @@ -0,0 +1,133 @@ +# +# spec file for package influxdb2 +# +# Copyright (c) 2021 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: influxdb2 +Summary: Scalable datastore for metrics, events, and real-time analytics +License: MIT +Group: Productivity/Databases/Servers +Version: 2.0.4 +Release: 0 +URL: https://github.com/influxdata/influxdb +Source: %{name}-%{version}.tar.xz +Source1: influxdb.service +Source2: influxdb.tmpfiles +Source3: influxdb.init +Source99: vendor.tar.xz +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: asciidoc +BuildRequires: cargo +BuildRequires: fdupes +BuildRequires: go >= 1.15 +BuildRequires: golang-packaging >= 15.0.8 +BuildRequires: rust +BuildRequires: systemd-rpm-macros +BuildRequires: xmlto +BuildRequires: yarn +BuildRequires: pkgconfig(flux) = 0.105.1 +%{!?_tmpfilesdir:%global _tmpfilesdir /usr/lib/tmpfiles.d} +Requires(pre): pwdutils +%{systemd_requires} +Requires(post): systemd + +%description +InfluxDB is an distributed time series database with no external dependencies. +It's useful for recording metrics, events, and performing analytics. + +%package devel +Summary: InfluxDB development files +Group: Development/Languages/Golang +Requires: go + +%description devel +Go sources and other development files for InfluxDB + +%prep +%setup -q +%setup -q -T -D -a 99 + +%build +export GO111MODULE=on + +# TODO: +# Disable phone-home to usage.influxdata.com + +# Build influxdb +%goprep github.com/influxdata/influxdb/v2 +%gobuild -mod=vendor -ldflags="-X main.version=%{version}" cmd/... + +%install +%gosrc +%fdupes -s %{buildroot}/%{go_contribsrcdir}/github.com/influxdata/influxdb + +mkdir -p %{buildroot}%{_sysconfdir}/influxdb +mkdir -p %{buildroot}%{_localstatedir}/log/influxdb +mkdir -p %{buildroot}%{_localstatedir}/lib/influxdb +mkdir -p %{buildroot}%{_localstatedir}/lib/influxdb/{data,meta,hh,wal} +mkdir -p %{buildroot}%{_sbindir} +install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/influxdb.service +ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcinfluxdb +install -D -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/influxdb.conf +install -D -m 0755 -t %{buildroot}%{_bindir} %{_builddir}/go/bin/* + +%check +#%%gotest github.com/influxdata/influxdb + +%pre +getent group influxdb >/dev/null || groupadd -r influxdb +getent passwd influxdb >/dev/null || useradd -r -g influxdb \ + -d %{_localstatedir}/lib/influxdb \ + -s /sbin/nologin \ + -c "user for InfluxDB database server" influxdb +%service_add_pre influxdb.service + +%preun +%service_del_preun influxdb.service + +%post +%tmpfiles_create %_tmpfilesdir/influxdb.conf +%service_add_post influxdb.service + +%postun +%service_del_postun influxdb.service + +%files +%license LICENSE +%doc README.md CHANGELOG.md +%dir %{_sysconfdir}/influxdb +%{_bindir}/chronograf-migrator +%{_bindir}/influx +%{_bindir}/influxd +%{_bindir}/telemetryd +%{_sbindir}/rcinfluxdb +%{_unitdir}/influxdb.service +%dir %{_tmpfilesdir} +%{_tmpfilesdir}/influxdb.conf +%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/log/influxdb +%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb +%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb/meta +%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb/data +%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb/hh +%attr(0700, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb/wal + +%files devel +%license LICENSE +%dir %{go_contribsrcdir}/github.com +%dir %{go_contribsrcdir}/github.com/influxdata +%{go_contribsrcdir}/github.com/influxdata/influxdb + +%changelog diff --git a/vendor.tar.xz b/vendor.tar.xz new file mode 100644 index 0000000..04d745e --- /dev/null +++ b/vendor.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d86c73cae27c699dbfcb4d8314138a1cb2e0d5c1b155c19edb3ca871f1c7b267 +size 7192488