Wednesday, October 29, 2014

wheezy web: RESTful API Design

In this article we are going to explore a simple RESTful API created with wheezy.web framework. The demo implements a CRUD for tasks. Includes entity validation, content caching with dependencies and functional test cases. The source code is structured with well defined actors (you can read more about it here).

Design

The following convention is used with respect to operation, HTTP method (verb) and URL:
List:   GET    /api/v1/tasks
Add:    POST   /api/v1/tasks
Get:    GET    /api/v1/task/{task_id}
Update: PUT    /api/v1/task/{task_id}
Remove: DELETE /api/v1/task/{task_id}
The task entity consists of the following attributes: task_id, title and status. The source code is available here. Please download before proceeding any further.

Monday, August 4, 2014

wheezy web: deploy nginx + uwsgi + memcached

wheezy.web is a lightweight, high performance, high concurrency WSGI web framework with the key features to build modern, efficient web. Here we will deploy quick start with nginx, uwsgi and memcached to clean debian stable installation.

Saturday, March 15, 2014

memcached statistics status

Here is a "top" emulator for memcached statistics:
watch -n 5 "echo stats | socat unix-connect:/var/tmp/memcached.sock -"
The screen will be refreshed every 5 seconds and display results of memcached stats command.

Thursday, November 14, 2013

How to build Python deb package from source

You need a newer python version that is not available with the Debian package management system. You can compile it from source and install but that usually takes a lot of time. It would be better to build a deb instead and install it on as many machines as you need. You can use checkinstall for this.
apt-get install checkinstall
The instruction how to compile python from source is here. Once you compiled python here is a simple command that does the rest for you:
checkinstall -y --pkgname=python2.7
Once it finishes you will get a deb file in the current directory. You can install it this way:
dpkg -i python2.7_2.7.6-1_i386.deb
Here is how to remove it:
apt-get remove --purge python2.7
Note, packages built with checkinstall are not updated by OS package management system, thus updates need to be provided manually.

Wednesday, October 23, 2013

PostgreSQL Streaming Replication Hot Standby

Streaming replication allows a standby server to stay up-to-date with primary. The standby connects to the primary, which streams WAL records to the standby as they're generated.

Hot standby is the term used to describe the ability to connect to the server and run read-only queries.

This method of replication is completely transparent to the client, it doesn't require any changes to database, allows query information from standby server and requires minimum administrative effort.