Commit 66405f79 authored by Bernard Quatermass's avatar Bernard Quatermass

Initial Commit

parents
# object files
*.o
# the target
jpigd
This diff is collapsed.
LDLIBS=-lfcgi -ljson-c -lpq -lz
all:: jpigd
clean::
@rm -f *.o jpigd
# jpigd - The FastCGI JSON Postgresql Gateway
A tool to aid the elimination of CGI scripts on web servers and moving all the business functionality into the database server along with the rest the business storage logic.
## What ?
Classic LAMP-like deployments consist of a machine, apache web server, MySQL & PHP. Apart from the obvious variations where the database is PostgreSQL or the scripting language is Perl or Python the pattern has been consistent for some time.
Whilst this makes for a simple deployment there are drawbacks that have been addressed in various manners.
* The scripts were instantiated on demand, but interpreted scripts are slow to start
* modules were developed to run as part of the apache process to allow persistence of scripts eliminating startup issues
* these persistent scripts more often than not would leak memory like a sieve and bloat the apache processes
* FastCGI was developed to allow a non-apache resident persistent script handler that could be restarted without the web server being seen to be down.
* Alternative techniques like tomcat servers were developed for java that meant the apache was simply used as a proxy.
All of these solutions were useful at the time but the one problem that was never tackled was the split of the business logic between the structures and enforcement of constraints in the database and the validation logic in the scripts.
jpigd is a component to aid in the resolution of this conceptual split.
* All modern browsers can handle json data in a sane manner.
* A lot of script work is simply interpreting the json, applying business logic and submitting it to the db and then converting the result back to json to return to the browser.
* Postgresql 9.4 and greater can handle json data without any external assistance
So, jpigd does a few simple things.
* runs as a fastCGI handler to receive non-static requests from the webserver
* converts the supplied CGI environment to json
* validates that the POST data is json (or blank)
* calls a PostgreSQL function with the postdata, and the encoded environment
* returns the result of the function as the fastCGI output.
This diff is collapsed.
#
#
#
#
Summary: fastcgi daemon to connect to postgresql
Name: jpigd
Version: 0.1
Release: 1
License: GPLv3+
Group: System Environment/Daemons
URL: https://tidymail.co.uk/
Source0: %name-%version.tgz
BuildRoot: %_tmppath/%name-%version-%release-root
Requires: fcgi
Requires: json-c
Requires: postgresql-libs
BuildRequires: fcgi-devel
BuildRequires: json-c-devel
BuildRequires: postgresql-devel
BuildRequires: zlib-devel
%description
jpigd is a fastcgi service that takes in json, calls a nominated
postgresql function and returns its output
## ------------------------------------------------------------
%prep
%setup -q -n %{name}-%{version}%{?prerelease}
## ------------------------------------------------------------
%build
make
## ------------------------------------------------------------
%install
install -d -m755 \
${RPM_BUILD_ROOT}%_libexecdir
install -m755 jpigd ${RPM_BUILD_ROOT}%_libexecdir
## ------------------------------------------------------------
%clean
rm -rf "$RPM_BUILD_ROOT"
## ------------------------------------------------------------
## -----------------------
%files
%defattr(-,root,root,-)
%_libexecdir/*
## -----------------------
## -----------------------
%changelog
* Sun Feb 11 2018 The Toolsmith <toolsmith@quatermass.co.uk> - 0.1-1
- Initial rpm build
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment