Skip to content

community-supported service that allows users to ask questions and get answers to them

License

Notifications You must be signed in to change notification settings

daronenko/askme_mironenko

Repository files navigation

Ask Service

community-supported service that allows users to ask questions and get answers to them

Contents

Requirements

Important

The project supports docker compose v2 by default, but if you want to use v1, then you need to add the DOCKER_COMPOSE = docker-compose line in the Makefile.local.

Getting Started

MacOS & Linux

Local

  1. Setup virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
  1. Start postgres database

  2. Apply migrations:

make migrate
  1. Fill db with generated data:
make fill-db ratio=100
  1. Warm up cache:
make warmup-cache
  1. Run centrifugo server (available on 127.0.0.1:8001):
make cent
  1. Run project:
make run
  1. Open the 127.0.0.1:8000 path in the browser

Docker

  1. Set the IN_DOCKER variable in app/core/local_settings.py to True
IN_DOCKER = True
  1. Build the container:
make docker-build
  1. Apply migrations:
make docker-migrate

Important

If you see in the logs that the database does not accept requests, it means that the database container started later than the application container. In this case, you need to run the command again or manually launch the database container first (docker start postgres-service-container).

  1. Fill db with generated data:
make docker-fill-db ratio=100
  1. Run project:
make docker-run
  1. Open the 0.0.0.0:8000 path in the browser (centrifugo server available on 0.0.0.0:8001)

  2. Stop and remove docker containers:

make clear-docker

Commands

Local

  • make migrations - create migrations
  • make migrate - apply migrations
  • make fill-db ratio=<ratio> - fill database with generated data
  • make warmup-cache - warm up the cache
  • make cent - start centrifugo server
  • make run - start gunicorn server
  • make superuser - create superuser
  • make clear-db - remove data from database
  • make clear-db-schema - remove database schema and data in it

Docker

  • make docker-migrations - create migrations
  • make docker-migrate - apply migrations
  • make docker-fill-db ratio=<ratio> - fill database with generated data
  • make docker-run - start gunicorn server
  • make docker-superuser - create superuser
  • make docker-clear-db - remove data from database
  • make docker-clear-db-schema - remove database schema and data in it
  • make clear-docker - stop and remove containers

Benchmarks

The results of the service's benchmarks are here.