Import webdis_0.1.1-2.debian.tar.xz
authorAndriy Senkovych <jolly_roger@itblog.org.ua>
Fri, 24 Oct 2014 19:48:16 +0000 (20:48 +0100)
committerAndriy Senkovych <jolly_roger@itblog.org.ua>
Fri, 24 Oct 2014 19:48:16 +0000 (20:48 +0100)
[dgit import tarball webdis 0.1.1-2 webdis_0.1.1-2.debian.tar.xz]

26 files changed:
changelog [new file with mode: 0644]
compat [new file with mode: 0644]
control [new file with mode: 0644]
copyright [new file with mode: 0644]
docs [new file with mode: 0644]
gbp.conf [new file with mode: 0644]
patches/series [new file with mode: 0644]
patches/tests.patch [new file with mode: 0644]
redis-test.conf [new file with mode: 0644]
rules [new file with mode: 0755]
source/format [new file with mode: 0644]
test.sh [new file with mode: 0755]
tests/control [new file with mode: 0644]
tests/webdis [new file with mode: 0644]
watch [new file with mode: 0644]
webdis-test.json [new file with mode: 0644]
webdis.1 [new file with mode: 0644]
webdis.default [new file with mode: 0644]
webdis.dirs [new file with mode: 0644]
webdis.init [new file with mode: 0644]
webdis.install [new file with mode: 0644]
webdis.json [new file with mode: 0644]
webdis.logrotate [new file with mode: 0644]
webdis.manpages [new file with mode: 0644]
webdis.postinst [new file with mode: 0644]
webdis.postrm [new file with mode: 0644]

diff --git a/changelog b/changelog
new file mode 100644 (file)
index 0000000..31d8483
--- /dev/null
+++ b/changelog
@@ -0,0 +1,14 @@
+webdis (0.1.1-2) unstable; urgency=medium
+
+  * Use correct license names in debian/copyright
+  * Document hiredis and jansson libraries
+  * Add autopkgtest support
+  * Update Standards-Version to 3.9.6. No changes required
+
+ -- Andriy Senkovych <jolly_roger@itblog.org.ua>  Fri, 24 Oct 2014 22:48:16 +0300
+
+webdis (0.1.1-1) unstable; urgency=low
+
+  * Initial release (Closes: #623528)
+
+ -- Andriy Senkovych <jolly_roger@itblog.org.ua>  Mon, 04 Aug 2014 02:10:55 +0300
diff --git a/compat b/compat
new file mode 100644 (file)
index 0000000..7f8f011
--- /dev/null
+++ b/compat
@@ -0,0 +1 @@
+7
diff --git a/control b/control
new file mode 100644 (file)
index 0000000..3bef0c6
--- /dev/null
+++ b/control
@@ -0,0 +1,55 @@
+Source: webdis
+Section: web
+Priority: optional
+Maintainer: Andriy Senkovych <jolly_roger@itblog.org.ua>
+Build-Depends: debhelper (>= 7.0.50~), 
+    libevent-dev (>= 1.4.13), 
+    libhiredis-dev (>= 0.10),
+    libjansson-dev (>= 1.3),
+    libb64-dev (>= 1.2),
+    libmsgpack-dev,
+    redis-server,
+    python-unittest2,
+    python-msgpack (>= 0.3),
+    net-tools
+Standards-Version: 3.9.6
+Vcs-Git: git://github.com/jollyroger/webdis.git -b debian
+Vcs-Browser: https://github.com/jollyroger/webdis
+Homepage: http://webd.is
+Testsuite: autopkgtest
+
+Package: webdis
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
+Suggests: redis-server
+Description: simple web server providing an HTTP interface to Redis
+ Webdis is a simple web server providing HTTP interface to Redis. Some features
+ include:
+  * Support for GET and POST requests.
+  * JSON output by default, optional JSONP parameter (?jsonp=myFunction).
+  * Raw Redis 2.0 protocol output with .raw suffix
+  * HTTP 1.1 pipelining (50,000 http requests per second on a desktop Linux
+    machine.)
+  * Restricted commands by IP range (CIDR subnet + mask) or HTTP Basic Auth,
+    returning 403 errors.
+  * Possible Redis authentication in the config file.
+  * Pub/Sub using Transfer-Encoding: chunked, works with JSONP as well. Webdis
+    can be used as a Comet server.
+  * Custom Content-Type using a pre-defined file extension, or with
+    ?type=some/thing.
+  * URL-encoded parameters for binary data or slashes.
+  * Logs, with a configurable verbosity.
+  * Cross-origin XHR, if compiled with libevent2 (for OPTIONS support).
+  * File upload with PUT.
+  * With the JSON output, the return value of INFO is parsed and transformed
+    into an object.
+
+Package: webdis-dbg
+Priority: extra
+Architecture: any
+Section: debug
+Depends: ${misc:Depends}, webdis (= ${binary:Version})
+Description: webdis debugging symbols
+ Webdis is a simple web server providing HTTP interface to Redis.
+ .
+ This package provides debug symbols for webdis.
diff --git a/copyright b/copyright
new file mode 100644 (file)
index 0000000..f4e188b
--- /dev/null
+++ b/copyright
@@ -0,0 +1,182 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: webdis
+Upstream-Contact: Nicolas Favre-Félix <n.favrefelix@gmail.com>
+Source: https://github.com/nicolasff/webdis/blob/master/COPYING
+
+Files: *
+Copyright: 2010-2011, Nicolas Favre-Felix <n.favrefelix@gmail.com>
+License: bsd-2-clause
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+ . 
+  * Redistributions of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+ . 
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Files: hiredis/*
+Copyright:
+ 2009-2011, Salvatore Sanfilippo <antirez@gmail.com>
+ 2010-2011, Pieter Noordhuis <pcnoordhuis@gmail.com>
+License: BSD-3-Clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the University nor the names of its contributors
+    may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+
+Files: jansson/*
+Copyright: 2009, 2010 Petri Lehtinen <petri@digip.org>
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+
+Files: debian/*
+Copyright: 2011, Andriy Senkovych <jolly_roger@itblog.org.ua>
+License: GPL-2+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
+Files: md5/*
+Copyright: 1999, 2000, 2002, Aladdin Enterprises
+           1999, 2000, 2002, L. Peter Deutsch <ghost@aladdin.com>
+License: bsd-3-clause
+ This software is provided 'as-is', without any express or implied
+ warranty.  In no event will the authors be held liable for any damages
+ arising from the use of this software.
+ .
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+ .
+ 1. The origin of this software must not be misrepresented; you must not
+    claim that you wrote the original software. If you use this software
+    in a product, an acknowledgment in the product documentation would be
+    appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+    misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+Files: sha1/*
+Copyright: 1998, 2009, Paul E. Jones <paulej@packetizer.com>
+License: FPL
+ This software is licensed as "freeware."  Permission to distribute
+ this software in source and binary forms, including incorporation 
+ into other products, is hereby granted without a fee.  THIS SOFTWARE 
+ IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES, 
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
+ AND FITNESS FOR A PARTICULAR PURPOSE.  THE AUTHOR SHALL NOT BE HELD 
+ LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE, EITHER 
+ DIRECTLY OR INDIRECTLY, INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA 
+ OR DATA BEING RENDERED INACCURATE.
+
+Files: http-parser/*
+Copyright: 2009, 2010, Ryan Dahl <ry@tinyclouds.org>
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
+Files: b64/*
+Copyright: none
+License: public-domain
+ Copyright-Only Dedication (based on United States law)
+ or Public Domain Certification
+ .
+ The person or persons who have associated work with this document (the
+ "Dedicator" or "Certifier") hereby either (a) certifies that, to the best of
+ his knowledge, the work of authorship identified is in the public domain of
+ the country from which the work is published, or (b) hereby dedicates whatever
+ copyright the dedicators holds in the work of authorship identified below (the
+ "Work") to the public domain. A certifier, moreover, dedicates any copyright
+ interest he may have in the associated work, and for these purposes, is
+ described as a "dedicator" below.
+ .
+ A certifier has taken reasonable steps to verify the copyright status of this
+ work. Certifier recognizes that his good faith efforts may not shield him from
+ liability if in fact the work certified is not in the public domain.
+ .
+ Dedicator makes this dedication for the benefit of the public at large and to
+ the detriment of the Dedicator's heirs and successors. Dedicator intends this
+ dedication to be an overt act of relinquishment in perpetuity of all present
+ and future rights under copyright law, whether vested or contingent, in the
+ Work. Dedicator understands that such relinquishment of all rights includes
+ the relinquishment of all rights to enforce (by lawsuit or otherwise) those
+ copyrights in the Work.
+ .
+ Dedicator recognizes that, once placed in the public domain, the Work may be
+ freely reproduced, distributed, transmitted, used, modified, built upon, or
+ otherwise exploited by anyone for any purpose, commercial or non-commercial,
+ and in any way, including by methods that have not yet been invented or
+ conceived.
diff --git a/docs b/docs
new file mode 100644 (file)
index 0000000..8d526b9
--- /dev/null
+++ b/docs
@@ -0,0 +1 @@
+README.markdown
diff --git a/gbp.conf b/gbp.conf
new file mode 100644 (file)
index 0000000..3a338bd
--- /dev/null
+++ b/gbp.conf
@@ -0,0 +1,4 @@
+# ex: set ft=dosini:
+[DEFAULT]
+debian-branch = debian
+upstream-tag = %(version)s
diff --git a/patches/series b/patches/series
new file mode 100644 (file)
index 0000000..6726658
--- /dev/null
@@ -0,0 +1 @@
+tests.patch
diff --git a/patches/tests.patch b/patches/tests.patch
new file mode 100644 (file)
index 0000000..9820f3d
--- /dev/null
@@ -0,0 +1,38 @@
+Description: Pass tests with python-msgpack >= 0.3
+ Current test suite pass with python-msgpack v0.2 but fails with python-msgpack
+ v0.3 and later due to changes in the library. Currently Debian ships v0.3 
+ for jessie and wheezy-backports.
+Author: Andriy Senkovych <jolly_roger@itblog.org.ua>
+Bug: https://github.com/nicolasff/webdis/issues/92
+Last-Update: 2014-08-03
+diff --git a/tests/basic.py b/tests/basic.py
+index 89d664e..c70babe 100755
+--- a/tests/basic.py
++++ b/tests/basic.py
+@@ -154,7 +154,7 @@ class TestMsgPack(TestWebdis):
+               f = self.query('SET/hello/world.msg')
+               self.assertTrue(f.headers.getheader('Content-Type') == 'application/x-msgpack')
+               obj = msgpack.loads(f.read())
+-              self.assertTrue(obj == {'SET': (True, 'OK')})
++              self.assertTrue(obj == {'SET': [True, 'OK']})
+       @need_msgpack
+       def test_get(self):
+@@ -180,7 +180,7 @@ class TestMsgPack(TestWebdis):
+               self.query('RPUSH/hello/def')
+               f = self.query('LRANGE/hello/0/-1.msg')
+               obj = msgpack.loads(f.read())
+-              self.assertTrue(obj == {'LRANGE': ('abc', 'def')})
++              self.assertTrue(obj == {'LRANGE': ['abc', 'def']})
+       @need_msgpack
+       def test_error(self):
+@@ -189,7 +189,7 @@ class TestMsgPack(TestWebdis):
+               obj = msgpack.loads(f.read())
+               self.assertTrue('UNKNOWN' in obj)
+               self.assertTrue(isinstance(obj, dict))
+-              self.assertTrue(isinstance(obj['UNKNOWN'], tuple))
++              self.assertTrue(isinstance(obj['UNKNOWN'], list))
+               self.assertTrue(obj['UNKNOWN'][0] == False)
+               self.assertTrue(isinstance(obj['UNKNOWN'][1], str))
diff --git a/redis-test.conf b/redis-test.conf
new file mode 100644 (file)
index 0000000..9a3bf30
--- /dev/null
@@ -0,0 +1,4 @@
+daemonize yes
+pidfile REDIS_PID
+port 0
+unixsocket REDIS_SOCK
diff --git a/rules b/rules
new file mode 100755 (executable)
index 0000000..35ba15e
--- /dev/null
+++ b/rules
@@ -0,0 +1,46 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+#export DH_VERBOSE=1
+
+export PREFIX = /usr
+export DESTDIR = $(CURDIR)/debian/tmp
+export CONFDIR = $(DESTDIR)/etc/webdis
+
+CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
+CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
+LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+
+# Add CPPFLAGS TO CFLAGS since build system does not know about them.
+CFLAGS += $(CPPFLAGS)
+
+# Objects to be removed from build procedure
+export HIREDIS_OBJ=
+export JANSSON_OBJ=
+export B64_OBJS=
+
+export CFLAGS += -I. -Ihttp-parser
+export LDFLAGS += -levent -pthread -lhiredis -ljansson -lb64
+
+build: build-arch
+build-arch: tests/pubsub tests/websocket
+
+tests/% :
+       $(MAKE) -C tests $*
+
+%:
+       dh $@
+
+override_dh_strip:
+       dh_strip --dbg-package=webdis-dbg
+
+override_dh_auto_clean:
+       $(MAKE) clean
+       $(MAKE) -C tests clean
+
+override_dh_auto_test:
+ifneq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
+       @echo "Skipping check (disabled in DEB_BUILD_OPTIONS)."
+else
+       $(CURDIR)/debian/test.sh $(MAKE) test
+endif
diff --git a/source/format b/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/test.sh b/test.sh
new file mode 100755 (executable)
index 0000000..f15c1aa
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+# This script runs redis server and webdis server and launches the test
+# suite. It avoids race condition while obtaining a port to listen by
+# binding to random available port. The port is then found via netstat -nlp
+# using PID-file.
+
+TMPDIR=`mktemp -d`
+
+WEBDIS_PID=${TMPDIR}/webdis.pid
+WEBDIS_CONF=${TMPDIR}/webdis.json
+
+REDIS_CONF=${TMPDIR}/redis.conf
+REDIS_PID=${TMPDIR}/redis.pid
+REDIS_SOCK=${TMPDIR}/redis.sock
+
+if [ -n "$WEBDIS_BIN" ] ; then
+    if [ ! -x "$WEBDIS_BIN" ] ; then
+        echo "webdis binary $WEBDIS_BIN is not executable" 
+        exit 1
+    fi
+else
+    WEBDIS_BIN="$PWD/webdis"
+fi
+
+set_up() {
+    echo "Generating config files.."
+       sed -e "s|REDIS_SOCK|${REDIS_SOCK}|" -e "s|WEBDIS_PID|${WEBDIS_PID}|" \
+        debian/webdis-test.json > ${WEBDIS_CONF}
+       sed -e "s|REDIS_PID|${REDIS_PID}|" -e "s|REDIS_SOCK|${REDIS_SOCK}|" \
+        debian/redis-test.conf > ${REDIS_CONF}
+
+    echo "Starting redis-server.."
+       /sbin/start-stop-daemon --start --verbose \
+               --pidfile ${REDIS_PID} \
+               --exec `which redis-server` -- ${REDIS_CONF} || return 1
+
+    echo "Starting webdis.."
+       /sbin/start-stop-daemon --start --verbose \
+               --pidfile ${WEBDIS_PID} \
+               --exec $WEBDIS_BIN -- ${WEBDIS_CONF} || return 2
+
+    MATCH_STR="`cat $WEBDIS_PID`\\/webdis"
+    export WEBDIS_PORT=`netstat -ntlp 2>/dev/null| \
+        awk "/$MATCH_STR/ {print \\$4}"|cut -d: -f2`
+    [ "$WEBDIS_PORT" -gt 0 ] || return 3
+    echo webdis is listening on port "$WEBDIS_PORT"
+}
+
+tear_down() {
+    echo "Shutting down webdis.."
+       /sbin/start-stop-daemon --stop --verbose \
+               --retry=TERM/1/KILL/1 \
+               --pidfile ${WEBDIS_PID} \
+               --name webdis
+    echo "Shutting down redis-server.."
+       /sbin/start-stop-daemon --stop --verbose \
+               --retry=TERM/1/KILL/1 \
+               --pidfile ${REDIS_PID} \
+               --name redis-server
+}
+
+if ! set_up ; then
+    echo "Setting up redis/webdis server FAILED."
+    tear_down
+    exit 1
+fi
+
+echo Running test commands: $*
+
+$*
+EXIT_CODE=$?
+
+tear_down
+rm -fR $TMPDIR
+
+exit $EXIT_CODE
diff --git a/tests/control b/tests/control
new file mode 100644 (file)
index 0000000..5af70dd
--- /dev/null
@@ -0,0 +1,4 @@
+Tests: webdis
+Depends: @, redis-server, build-essential, libevent-dev,
+ python-unittest2, python-msgpack, net-tools
+Restrictions: isolation-container, allow-stderr
diff --git a/tests/webdis b/tests/webdis
new file mode 100644 (file)
index 0000000..dc2cc97
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+
+make -C tests
+WEBDIS_BIN=/usr/bin/webdis debian/test.sh make test
diff --git a/watch b/watch
new file mode 100644 (file)
index 0000000..5466d9c
--- /dev/null
+++ b/watch
@@ -0,0 +1,4 @@
+version=3
+opts=dversionmangle=s/\+(dfsg|ds)$// \
+    https://github.com/nicolasff/webdis/releases \
+    .*\/([0-9.]+)\.tar\.gz
diff --git a/webdis-test.json b/webdis-test.json
new file mode 100644 (file)
index 0000000..218ee1e
--- /dev/null
@@ -0,0 +1,29 @@
+{
+       "redis_host":   "REDIS_SOCK",
+
+       "http_host":    "127.0.0.1",
+       "http_port":    0,
+
+       "threads":      2,
+       "pool_size": 5,
+
+       "daemonize":    true,
+    "pidfile":       "WEBDIS_PID",
+       "websockets":   false,
+
+       "database":     0,
+
+       "acl": [
+               {
+                       "disabled":     ["DEBUG"]
+               },
+
+               {
+                       "http_basic_auth":      "user:password",
+                       "enabled":              ["DEBUG"]
+               }
+       ],
+
+        "verbosity": 3,
+        "logfile": "/dev/null"
+}
diff --git a/webdis.1 b/webdis.1
new file mode 100644 (file)
index 0000000..5639961
--- /dev/null
+++ b/webdis.1
@@ -0,0 +1,25 @@
+.TH WEBDIS 1 "August 29, 2013"
+.SH NAME
+webdis \- fast HTTP interface for redis-server(1)
+.SH SYNOPSIS
+.B webdis
+.RI configfile
+.SH DESCRIPTION
+Webdis is a Webdis is a simple HTTP server which forwards commands to Redis and
+sends the reply back using a format of your choice. Accessing
+/COMMAND/arg0/arg1/.../argN[.ext] on Webdis executes the command on Redis and
+returns the response; the reply format can be changed with the optional
+extension (.json, .txt).
+.PP
+.SH OPTIONS
+.IP "configfile"
+Read options from specified configuration file.
+.SH NOTES
+On Debian GNU/Linux systems, \fBwebdis\fP is typically started via the
+\fB/etc/init.d/webdis\fP initscript, not manually. This defaults to using
+\fB/etc/webdis/webdis.json\fP as a configuration file.
+.SH AUTHOR
+\fBwebdis\fP was written by Nicolas Favre-Félix.
+.PP
+This manual page was written by Andriy Senkovych <jolly_roger@itblog.org.ua> for
+the Debian project (but may be used by others).
diff --git a/webdis.default b/webdis.default
new file mode 100644 (file)
index 0000000..c764a07
--- /dev/null
@@ -0,0 +1,5 @@
+# Webdis configuration file used at startup. 
+CONFFILE="/etc/webdis/webdis.json"
+
+# Additional options that are passed to the Daemon.
+DAEMON_OPTS=""
diff --git a/webdis.dirs b/webdis.dirs
new file mode 100644 (file)
index 0000000..6ded28a
--- /dev/null
@@ -0,0 +1 @@
+/var/log/webdis
diff --git a/webdis.init b/webdis.init
new file mode 100644 (file)
index 0000000..7e5e729
--- /dev/null
@@ -0,0 +1,175 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          webdis
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Should-Start:      redis-server
+# Should-Stop:       redis-server
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Starts webdis daemon
+# Description:       Starts webdis daemon
+### END INIT INFO
+
+# Author: Andriy Senkovych <jolly_roger@itblog.org.ua>
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="webdis server"
+NAME=webdis
+DAEMON=/usr/bin/$NAME
+PIDDIR=/var/run/$NAME
+PIDFILE=$PIDDIR/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+USER=webdis
+CONFFILE="/etc/webdis/webdis.json"
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+    if [ ! -e $PIDDIR ] ; then
+        mkdir $PIDDIR
+        chown webdis: $PIDDIR
+    elif [ ! -d $PIDDIR ] ; then
+        log_action_cont_msg \ $PIDDIR exists but is not a directory
+        return 2
+    fi
+       # Return
+       #   0 if daemon has been started
+       #   1 if daemon was already running
+       #   2 if daemon could not be started
+       start-stop-daemon --start --quiet --test \
+        --pidfile $PIDFILE \
+        --user $USER --chuid $USER \
+        --exec $DAEMON > /dev/null \
+               || return 1
+       /sbin/start-stop-daemon --start --quiet \
+               --pidfile $PIDFILE \
+        --user $USER --chuid $USER \
+        --exec $DAEMON -- $CONFFILE $DAEMON_OPTS\
+               || return 2
+       # Add code here, if necessary, that waits for the process to be ready
+       # to handle requests from services started subsequently which depend
+       # on this one.  As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+       # Return
+       #   0 if daemon has been stopped
+       #   1 if daemon was already stopped
+       #   2 if daemon could not be stopped
+       #   other if a failure occurred
+       start-stop-daemon --stop --quiet \
+        --pidfile $PIDFILE \
+        --user $USER \
+        --retry=TERM/1/KILL/1 \
+        --name $NAME
+       RETVAL="$?"
+       [ "$RETVAL" = 2 ] && return 2
+       # Wait for children to finish too if this is a daemon that forks
+       # and if the daemon is only ever run from this initscript.
+       # If the above conditions are not satisfied then add some other code
+       # that waits for the process to drop all resources that could be
+       # needed by services started subsequently.  A last resort is to
+       # sleep for some time.
+       start-stop-daemon --stop --quiet --oknodo \
+        --pidfile $PIDIFLE \
+        --user $USER \
+        --retry=0/1/KILL/1 \
+        --exec $DAEMON
+       [ "$?" = 2 ] && return 2
+       # Many daemons don't delete their pidfiles when they exit.
+       rm -f $PIDFILE
+       return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+       #
+       # If the daemon can reload its configuration without
+       # restarting (for example, when it is sent a SIGHUP),
+       # then implement that here.
+       #
+       start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+       return 0
+}
+
+case "$1" in
+  start)
+       log_daemon_msg "Starting $DESC" "$NAME"
+       do_start
+       case "$?" in
+               0|1) log_end_msg 0 ;;
+               2) log_end_msg 1 ;;
+       esac
+       ;;
+  stop)
+       log_daemon_msg "Stopping $DESC" "$NAME"
+       do_stop
+       case "$?" in
+               0|1) log_end_msg 0 ;;
+               2) log_end_msg 1 ;;
+       esac
+       ;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
+  #reload|force-reload)
+       #
+       # If do_reload() is not implemented then leave this commented out
+       # and leave 'force-reload' as an alias for 'restart'.
+       #
+       #log_daemon_msg "Reloading $DESC" "$NAME"
+       #do_reload
+       #log_end_msg $?
+       #;;
+  restart|force-reload)
+       #
+       # If the "reload" option is implemented then remove the
+       # 'force-reload' alias
+       #
+       log_daemon_msg "Restarting $DESC" "$NAME"
+       do_stop
+       case "$?" in
+         0|1)
+               do_start
+               case "$?" in
+                       0) log_end_msg 0 ;;
+                       1) log_end_msg 1 ;; # Old process is still running
+                       *) log_end_msg 1 ;; # Failed to start
+               esac
+               ;;
+         *)
+               # Failed to stop
+               log_end_msg 1
+               ;;
+       esac
+       ;;
+  *)
+       #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+       echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+       exit 3
+       ;;
+esac
+
+:
diff --git a/webdis.install b/webdis.install
new file mode 100644 (file)
index 0000000..b25d53d
--- /dev/null
@@ -0,0 +1,2 @@
+debian/webdis.json /etc/webdis/
+/usr/bin/webdis
diff --git a/webdis.json b/webdis.json
new file mode 100644 (file)
index 0000000..19a67a7
--- /dev/null
@@ -0,0 +1,29 @@
+{
+    "redis_host": "127.0.0.1",
+
+    "redis_port": 6379,
+    "redis_auth": null,
+
+    "http_host": "127.0.0.1",
+    "http_port": 7379,
+    "threads": 2,
+
+    "daemonize": true,
+    "pidfile": "/var/run/webdis/webdis.pid",
+
+    "database": 0,
+
+    "acl": [
+        {
+            "disabled":["DEBUG"]
+        },
+
+        {
+            "http_basic_auth": "user:password",
+            "enabled": ["DEBUG"]
+        }
+    ],
+
+        "verbosity": 3,
+        "logfile": "/var/log/webdis/webdis.log"
+}
diff --git a/webdis.logrotate b/webdis.logrotate
new file mode 100644 (file)
index 0000000..7ff7c3d
--- /dev/null
@@ -0,0 +1,11 @@
+/var/log/webdis/webdis.log {
+    missingok
+    rotate 5
+    weekly
+    size 10M
+    compress
+    notifempty
+    postrotate
+        /usr/bin/killall -HUP webdis
+    endscript
+}
diff --git a/webdis.manpages b/webdis.manpages
new file mode 100644 (file)
index 0000000..d588228
--- /dev/null
@@ -0,0 +1 @@
+debian/webdis.1
diff --git a/webdis.postinst b/webdis.postinst
new file mode 100644 (file)
index 0000000..8e0b4cb
--- /dev/null
@@ -0,0 +1,33 @@
+#! /bin/sh
+
+set -e
+WEBDIS_LOG=/var/log/webdis
+
+case "$1" in
+    configure)
+           adduser --system --group \
+            --home /var/lib/webdis \
+            --no-create-home \
+            --gecos "webdis system user" \
+            --disabled-login \
+            --disabled-password webdis
+        if ! dpkg-statoverride --list $WEBDIS_LOG >/dev/null 2>&1 ; then
+            dpkg-statoverride --update --add webdis webdis 0750 $WEBDIS_LOG
+        fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/webdis.postrm b/webdis.postrm
new file mode 100644 (file)
index 0000000..416644b
--- /dev/null
@@ -0,0 +1,29 @@
+#! /bin/sh
+
+set -e
+WEBDIS_LOG=/var/log/webdis
+
+case "$1" in
+    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear|remove)
+        ;;
+
+    purge)
+        # Since no data is stored in the webdis home directory, the package is
+        # not affected by bug #621833 and thus homedir can be safely removed
+        if dpkg-statoverride --list $WEBDIS_LOG >/dev/null 2>&1 ; then
+            dpkg-statoverride --remove /var/log/webdis
+        fi
+        rm -rf $WEBDIS_LOG
+
+        deluser --system webdis
+        ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+
+esac
+
+#DEBHELPER#
+
+exit 0