habralab / sapphire-team-back

Проект для поиска IT-проектов

Home Page:https://stage.sapphire.pet-project.habr.com/backend/swagger/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collabry Backend

Stage Autotests Status

Backend for developer collaboration service

Requirements

Requirements: Docker

For running or testing all services you can use Docker. You can see instructions for installation here.

After installation you should init swarm

docker swarm init 

Requirements: Python

For running or testing all services you can use Python environment. You can install Python on your local machine directly (see here) or use any wrappers (venv, pyenv, pipenv, etc.).

Python version: 3.12 or higher

After installation Python you need install poetry (v1.8.2):

pip install poetry==1.8.2

And install all Python requirements:

poetry install --all-extras

Test

Test: Docker

For testing you should build full image

docker build -t collabry --target full . 

Lint

docker run collabry pylint collabry autotests tests

Isort

docker run collabry isort .

Unit tests

docker run collabry pytest tests

Autotests

docker run collabry pytest autotests

Test: Python

Lint

pylint collabry autotests tests

Isort

isort --check .

Unit tests

pytest tests

Autotests

pytest autotests

Run

Run: Docker

Copy .env.example to .env

cp .env.example .env

For running you should build app image

docker build -t collabry --target slim .

Create secrets (you can get any values from .env.example)

echo "any_client_id" | docker secret create oauth2_habr_client_id -
echo "any_client_secret" | docker secret create oauth2_habr_client_secret -
echo "any_api_key" | docker secret create habr_api_key -
echo "any_api_key" | docker secret create habr_career_api_key -
echo "any_access_private_key" | docker secret create jwt_access_token_private_key -
echo "any_access_public_key" | docker secret create jwt_access_token_public_key -
echo "any_refresh_private_key" | docker secret create jwt_refresh_token_private_key -
echo "any_refresh_public_key" | docker secret create jwt_refresh_token_public_key -

And run

docker stack deploy -c docker-compose.yaml collabry

Wait when all services will be running, you can check it by docker service ls.

Join to collabry service

docker exec -it $(docker ps -q -f name=collabry_app) bash

Apply migrations

poetry run python -m collabry database migrations apply

Apply fixtures

poetry run python -m collabry database fixtures apply storage autotests

About

Проект для поиска IT-проектов

https://stage.sapphire.pet-project.habr.com/backend/swagger/


Languages

Language:Python 99.6%Language:Mako 0.1%Language:Dockerfile 0.1%Language:Makefile 0.1%