Skip to content

Commit

Permalink
Include compiled manpages, include plaintext README for PyPI, add add…
Browse files Browse the repository at this point in the history
…itional setup information for PyPI
  • Loading branch information
rfinnie committed Aug 4, 2015
1 parent 4c25f68 commit a27f8ae
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
MANIFEST
doc/*.1

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
6 changes: 3 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.md
include HISTORY.md
include README
include LICENSE
include doc/*.md
include *.md
include doc/*
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
all: build

build:
python setup.py build

install: build
python setup.py install

clean:
python setup.py clean
$(RM) -r build MANIFEST

doc: README
$(MAKE) -C doc

README: README.md
pandoc -s -t plain -o $@ $<
124 changes: 124 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
dsari - Do Something and Record It
==================================

dsari is a lightweight continuous integration (CI) system. It provides
scheduling, concurrency management and trigger capabilities, and is easy
to configure. Job scheduling is handled via dsari-daemon, while
dsari-render may be used to format job run information as HTML.

Requirements
------------

dsari requires Python 2.6 or later, and will run on Unix-based
platforms. It requires the following non-core modules:

- croniter, for parsing cron-style schedule definitions
- Jinja2, for rendering HTML reports

Installation
------------

dsari may be installed as any normal Python package:

$ sudo python setup.py install

When this is done, dsari will expect its configuration file --
dsari.json -- in /usr/local/etc/dsari/, and will store its data in
/usr/local/lib/dsari/.

These locations may be customized by passing -c argument to dsari-* to
specify the configuration directory, and the data_dir configuration
option, respectively.

When dsari is installed directly in /usr/ (i.e. as part of distribution
packaging), the default configuration and data directories will be
/etc/dsari/ and /var/lib/dsari/, respectively.

dsari does not need to be installed at all, it can be run directly from
the repository directory. In this case, the default configuration and
data directories will be ~/.dsari/etc/ and ~/.dsari/var/, respectively.

The rest of these documents assume a locally-running setup, i.e.
~/.dsari/.

Configuration
-------------

A basic configuration for dsari.json looks as follows:

{
"jobs": {
"sample-job": {
"command": ["/usr/bin/env"],
"schedule": "H/5 * * * *"
}
}
}

This defines a job named "sample-job", which is run every 5 minutes.
Many more configuration options are available in the doc/ directory.

Running
-------

Once dsari is configured, run dsari-daemon. By default, dsari-daemon
will run in the foreground, and can be used with a supervisor (upstart,
systemd, supervisord, etc). If given -d, it will daemonize.

When a job is scheduled to be run, it produces a "run". Runs are
identified by a UUID, the run output is stored in ~/.dsari/var/runs/,
and data related to the run (start time, stop time, exit code, etc) is
stored in a SQLite database at ~/.dsari/var/dsari.sqlite3.

When a run is executed, several environment variables are passed to the
program to be run:

JOB_NAME=sample-job
RUN_ID=fa0490b8-7a8e-4f6b-b73c-160199a9ff75
PREVIOUS_RUN_ID=e5bd61b3-27f3-46ca-8169-372433056fc2
PREVIOUS_SCHEDULE_TIME=1437004689.27
PREVIOUS_START_TIME=1437004689.65
PREVIOUS_STOP_TIME=1437004689.71
PREVIOUS_EXIT_CODE=0

PREVIOUS_* variables are not set if there is no previous run. In
addition, several extra environment variables are present, if the job's
jenkins_environment option is set, to aid with migrations from Jenkins
setups:

BUILD_NUMBER=fa0490b8-7a8e-4f6b-b73c-160199a9ff75
BUILD_ID=fa0490b8-7a8e-4f6b-b73c-160199a9ff75
BUILD_URL=file:///home/user/.dsari/var/runs/sample-job/fa0490b8-7a8e-4f6b-b73c-160199a9ff75/
NODE_NAME=master
BUILD_TAG=dsari-sample-job-fa0490b8-7a8e-4f6b-b73c-160199a9ff75
JENKINS_URL=file:///home/user/.dsari/var/
EXECUTOR_NUMBER=0
WORKSPACE=/home/user/.dsari/var/runs/sample-job/fa0490b8-7a8e-4f6b-b73c-160199a9ff75

Reports
-------

To render HTML reports, run dsari-render occasionally. This will produce
a series of HTML files in ~/.dsari/var/html/. You may then serve these
files, rsync them to a remote server, etc.

License
-------

dsari - Do Something and Record It

Copyright (C) 2015 Ryan Finnie

This program 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 program 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Job scheduling is handled via `dsari-daemon`, while `dsari-render` may be used t
dsari requires Python 2.6 or later, and will run on Unix-based platforms. It requires the following non-core modules:

- [`croniter`](https://pypi.python.org/pypi/croniter/), for parsing cron-style schedule definitions
- [`jinja2`](http://jinja.pocoo.org/), for rendering HTML reports
- [`Jinja2`](http://jinja.pocoo.org/), for rendering HTML reports

## Installation

Expand Down
42 changes: 42 additions & 0 deletions doc/dsari-daemon.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.TH "DSARI\-DAEMON" "1" "" "" "dsari"
.SH NAME
.PP
dsari\-daemon \- dsari scheduling daemon
.SH SYNOPSIS
.PP
dsari\-daemon [\f[I]options\f[]]
.SH DESCRIPTION
.PP
\f[C]dsari\-daemon\f[] is a scheduling daemon.
It reads a configuration file containing job information, and schedules
runs of the jobs.
.SH OPTIONS
.TP
.B \-\-config\-dir=\f[I]directory\f[], \-c \f[I]directory\f[]
Base configuration directory.
A file named \f[C]dsari.json\f[] is expected in this directory.
.RS
.RE
.TP
.B \-\-fork
Fork into the background after starting.
.RS
.RE
.TP
.B \-\-debug
Print extra debugging information while running.
.RS
.RE
.TP
.B \-\-no\-timestamp
Do not show timestamps in logging output (for process supervisors which
add their own timestamps).
.RS
.RE
.SH SEE ALSO
.IP \[bu] 2
\f[C]dsari\-render\f[]
.IP \[bu] 2
dsari (https://github.com/rfinnie/dsari)
.SH AUTHORS
Ryan Finnie.
36 changes: 36 additions & 0 deletions doc/dsari-render.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.TH "DSARI\-RENDER" "1" "" "" "dsari"
.SH NAME
.PP
dsari\-render \- dsari HTML report rendering
.SH SYNOPSIS
.PP
dsari\-render [\f[I]options\f[]]
.SH DESCRIPTION
.PP
\f[C]dsari\-render\f[] takes data produced by \f[C]dsari\-daemon\f[],
and formats it as HTML reports.
.SH OPTIONS
.TP
.B \-\-config\-dir=\f[I]directory\f[], \-c \f[I]directory\f[]
Base configuration directory.
A file named \f[C]dsari.json\f[] is expected in this directory.
.RS
.RE
.TP
.B \-\-regenerate, \-r
(Re)generate all report files, even if \f[C]dsari\-render\f[] determines
regeneration is not needed.
.RS
.RE
.TP
.B \-\-debug
Print extra debugging information while running.
.RS
.RE
.SH SEE ALSO
.IP \[bu] 2
\f[C]dsari\-daemon\f[]
.IP \[bu] 2
dsari (https://github.com/rfinnie/dsari)
.SH AUTHORS
Ryan Finnie.
21 changes: 21 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
#!/usr/bin/env python

import os
from distutils.core import setup
import dsari


def read(filename):
return open(os.path.join(os.path.dirname(__file__), filename)).read()


setup(
name='dsari',
description='Do Something and Record It',
long_description=read('README'),
version=dsari.VERSION,
license='GPLv2+',
platforms=['Unix'],
author='Ryan Finnie',
author_email='[email protected]',
url='https://github.com/rfinnie/dsari',
download_url='https://github.com/rfinnie/dsari/releases',
packages=['dsari'],
package_data={'dsari': ['templates/*.html']},
scripts=['dsari-daemon', 'dsari-render'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 2 :: Only',
'Topic :: Software Development :: Build Tools',
'Topic :: Software Development :: Quality Assurance',
'Topic :: Software Development :: Testing',
],
)

0 comments on commit a27f8ae

Please sign in to comment.