/devops-day-at-the-office-service

Sample service for Devops Engineer - Day at the office assignment

Primary LanguagePython

Trips Service

Day at the office assignment - DevOps Engineer

This is a very simple service for querying and saving trips.

Requirements

  • Python 3 (>= 3.10)

Setting up

pip install -r requirements.txt

# For local test environments:
export DATABASE_URL="sqlite:///./sqlite.db"
# For other environments:
# export DATABASE_URL = "postgresql://user:password@dbserver/db"

Help

python manage.py --help

Running the service

API

export DATABASE_URL=...
python manage.py run

Scripts

These two scripts need to be run once a day:

python manage.py start-todays-trips
python manage.py end-yesterdays-trips

Testing

For tests, the DATABASE_URL is hardcoded in tests to use a sqlite database.

pytest