Welcome to Kefi community!#
Basic setup#
To be able to run Kefi in you own computer, for development proposes, first, you'll need the following software installed and configured:
This project uses environment variables to handle the configuration, following the twelve-factor config recommendation, and we recommend to use direnv to handle project's local environment variables.
Clone the repository#
First, just clone this repository in your machine.
Create environment variables#
Assuming you are using direnv, on the root of the project, creates a file named .envrc:
$ echo "dotenv" > .envrc
Then create an .env file with the environment variables. An example:
# PostgreSQL
# ------------------------------------------------------------------------------
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=kefi
POSTGRES_USER=pyqF6iHnFi3LjiFV
POSTGRES_PASSWORD=HGt9nkXNv6F9xkzN
# Database connection
# ------------------------------------------------------------------------------
DATABASE_URL=postgresql://pyqF6iHnFi3LjiFV:HGt9nkXNv6F9xkzN@localhost:5432/kefi
# Redis
# ------------------------------------------------------------------------------
REDIS_HOST=localhost
# Slack
# ------------------------------------------------------------------------------
SLACK_BOT_TOKEN=<put here your bot token>
SLACK_TEAM_ID=<put here your team ID>
# General
# ------------------------------------------------------------------------------
KEFI_SETTINGS_MODULE=kefi.config.local
Launch the external services#
To launch the database an Redis server, you can launch them using docker-compose:
$ docker-compose up --build
Install the dependencies#
You can install the dependencies of the project using poetry, in a local virtual environment, using the following command:
$ poetry install
Running tests#
Now, to test that everything is working, you can launch the tests using this command:
$ poetry run pytest .
Running local server#
Database migrations#
First, we have to run the migrations in order to get the last version of the database:
$ poetry run alembic upgrade head
Run server#
Then, we launch the local server with uvicorn:
$ poetry run uvicorn kefi.main:app --reload
Force load Kefis#
$ poetry run ./manage.py
from kefi.models.helpers import reset_wallets
reset_wallets(session)
session.commit()