Installation¶
By default, a Kinto-Core application persists the records and cache in a local Redis.
Using the application configuration, other backends like « in-memory » or PostgreSQL can be enabled afterwards.
Supported Python versions¶
Kinto-Core supports Python 2.7, Python 3.4 and PyPy.
Distribute & Pip¶
Installing Kinto-Core with pip:
pip install kinto
For PostgreSQL and monitoring support:
pip install kinto[postgresql,monitoring]
Note
When installing kinto-core with postgresql support in a virtualenv using the PyPy interpreter, the psycopg2cffi PostgreSQL database adapter will be installed, instead of the traditional psycopg2, as it provides significant performance improvements.
If everything is under control python-wise, jump to the next chapter. Otherwise please find more details below.
Cryptography libraries¶
Linux¶
On Debian / Ubuntu based systems:
apt-get install libffi-dev libssl-dev
On RHEL-derivatives:
yum install libffi-devel openssl-devel
Install Redis¶
Install PostgreSQL¶
Client libraries only¶
Install PostgreSQL client headers:
sudo apt-get install libpq-dev
Install Kinto-Core with related dependencies:
pip install kinto[postgresql]
Full server¶
PostgreSQL version 9.4 (or higher) is required.
To install PostgreSQL on Ubuntu/Debian use:
sudo apt-get install postgresql-9.4
If your Ubuntu/Debian distribution doesn’t include version 9.4 of PostgreSQL look at the PostgreSQL Ubuntu and PostgreSQL Debian pages. The PostgreSQL project provides an Apt Repository that one can use to install recent PostgreSQL versions.
By default, the postgres
user has no password and can hence only connect
if ran by the postgres
system user. The following command will assign it:
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
Kinto-Core requires UTC
to be used as the database timezone, and
UTF-8
as the database encoding. You can for example use the following
commands to create a database named testdb
with the appropriate timezone
and encoding:
sudo -u postgres psql -c "ALTER ROLE postgres SET TIMEZONE TO 'UTC';"
sudo -u postgres psql -c "CREATE DATABASE testdb ENCODING 'UTF-8';"
Server using Docker¶
Install docker, for example on Ubuntu:
sudo apt-get install docker.io
Run the official PostgreSQL container locally:
postgres=$(sudo docker run -d -p 5432:5432 postgres)
(optional) Create the test database:
psql -h localhost -U postgres -W
#> CREATE DATABASE "testdb";
Tag and save the current state with:
sudo docker commit $postgres kinto-empty
In the future, run the tagged version of the container
kinto=$(sudo docker run -d -p 5432:5432 kinto-empty)
...
sudo docker stop $kinto