Backend for developer collaboration service
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
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
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
Lint
pylint collabry autotests tests
Isort
isort --check .
Unit tests
pytest tests
Autotests
pytest autotests
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