refstack/doc/refstack.md
Vladislav Kuzmin 4e390ee67b Add oslo libraries and command-line utility
Add oslo libraries for works with database and config.
Refactor database relation code. Move it in refstack/db.

Now after istallation of refstack available a command-line
utility: `refstack-manage` and `refstack-api`.

`refstack-manage`

This utlity provide commands for manipulation of database
migrations and setup config file through
--config-file /path/to/refstack.conf option.

Config file should contain database connection string.
For example:

[DEFAULT]
sql_connection = mysql://root:passw0rd@127.0.0.1/refstack

Add ability to runtime updrade/downgrade db through command-line utillity.

`refstack-api`

This utility allow to launch api on gunicorn server. Specify config through
--env REFSTACK_OSLO_CONFIG=/path/to/refstack.conf

Change-Id: Ibea97d433d54d307233aa04e9487f1a1230e7487
2015-02-04 16:54:59 +04:00

2.1 KiB
Executable File

Refstack Quickstart

####Install dependencies (on ubuntu 14.x)..

  • sudo apt-get install git python-dev libssl-dev python-setuptools

  • sudo apt-get install mysql-server python-mysqldb

  • sudo easy_install -U pip

  • sudo easy_install -U virtualenv

####Setup the refstack database

  • Log into MySQL: mysql -u root -p

  • After authentication, create the database:

    CREATE DATABASE refstack;

  • Create a refstack user:

    CREATE USER 'refstack'@'localhost' IDENTIFIED BY '<your password>';

    or using hash value for your password

    CREATE USER 'refstack'@'localhost' IDENTIFIED BY PASSWORD '<hash value of your password';

  • Grant privileges:

    GRANT ALL PRIVILEGES ON refstack . * TO 'refstack'@'localhost';

  • Reload privileges:

    FLUSH PRIVILEGES;

  • Exit MySQL: quit

####Git you clonin'

  • git clone http://github.com/stackforge/refstack

  • cd refstack

  • Creare virtual environment: virtualenv .venv --system-site-package

  • Source to virtual environment: source .venv/bin/activate

####Install Refstack application (on ubuntu 14.x)..

  • python setup.py install

####Configuration file preparation

  • Make a copy of the sample config and update it with the correct information of your environment. Example of config file available in etc directory.

####Database sync

  • Check current revision:

    refstack-manage --config-file /path/to/refstack.conf version

    The response will show the current database revision. If the revision is None (indicating a clear database), the following command should be performed to upgrade the database to the latest revision:

  • Upgrade database to latest revision:

    refstack-manage --config-file /path/to/refstack.conf upgrade --revision head

  • Check current revision:

    refstack-manage --config-file /path/to/refstack.conf version

    Now it should be 42278d6179b9.

####Start Refstack

For the most basic setup that you can try right now, just kick off gunicorn:

  • refstack-api --env REFSTACK_OSLO_CONFIG=/path/to/refstack.conf

Now available http://localhost:8000/ with JSON response {'Root': 'OK'} and http://localhost:8000/v1/results/ with JSON response {'Results': 'OK'}.