Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsotetsi/bloodhound
Track requested agents online.
https://github.com/tsotetsi/bloodhound
allauth django docker drf postgresql pytest python3 redis unit-testing user-management
Last synced: 3 days ago
JSON representation
Track requested agents online.
- Host: GitHub
- URL: https://github.com/tsotetsi/bloodhound
- Owner: tsotetsi
- License: mit
- Created: 2024-10-24T16:31:21.000Z (4 months ago)
- Default Branch: develop
- Last Pushed: 2025-01-22T19:16:00.000Z (19 days ago)
- Last Synced: 2025-01-22T20:23:11.401Z (19 days ago)
- Topics: allauth, django, docker, drf, postgresql, pytest, python3, redis, unit-testing, user-management
- Language: Python
- Homepage: https://bh.io
- Size: 114 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bloodhound
## Getting Up and Running Locally With Docker
## Prerequisites
- Docker - follow the installation [instructions](https://docs.docker.com/get-started/get-docker/#supported-platforms) if you do not have it.
- Docker Compose - refer to the [official documentation](https://docs.docker.com/compose/install/) for the installation guide.
- Pre-commit - refer to the [official documentation](https://pre-commit.com/#install) for the pre-commit.## Build the Stack
The build command can take a while, especially the first time you run this particular command on your machine.```
$ docker compose -f docker-compose.local.yml build
```If you want to emulate production env you can use `docker-compose.production.yml` instead.
Before doing any git commit, [pre-commit](https://pre-commit.com/#install) should be installed globally on your local machine, and then:
```
$ git init
$ pre-commit install
```Failing to do so will result with a bunch of CI and Linter errors that can be avoided with pre-commit.
## Run the StackThis brings up both Django and PostgreSQL. The first time it is run it might take a while to get started, but subsequent runs will occur quickly.
Open a terminal at the project root and run the following for local development:
```
$ docker compose -f docker-compose.local.yml up
```You can also set the environment variable COMPOSE_FILE pointing to docker-compose.local.yml like this:
```
$ export COMPOSE_FILE=docker-compose.local.yml
```And then run:
```
$ docker compose up
```To check docker logs, you can run:
```
$ docker compose logs
```## Useful commands
- `pip list --not-required --format=freeze > requirements/base.txt` Add only required deps to the base file.
## Database commands.
To get the postgres image-id, use the following command:- `docker ps | grep postgres | awk '{print $1}'`
then you would get something like: `cd2057ecd4d5` which is the postgres image.- `docker exec -it psql -U dev -d postgres -c "DROP DATABASE bloodhound;"` # Delete DB.(Fix me!)
- `docker exec -it psql -U dev -d postgres -c "CREATE DATABASE bloodhound;` # Create DB.(Fix me!)### Test coverage.
To run the tests, check your test coverage, and generate an HTML coverage report:
$ coverage run -m pytest
$ coverage html
$ open htmlcov/index.html#### Running tests with pytest.
$ pytest
### Run django commands against the image.
- `docker-compose run --rm django python manage.py createsuperuser`