Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

algorithmwatch/unding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goliath

The Goliath project by AlgorithmWatch powering Unding.de.

This project was initially bootstrapped with Django-Cookie-Cutter but heavily modified.

Background

This software was created at the end of 2020 and in the beginning of 2021 and only maintained afterward. The main idea: People can report pre-defined cases of discrimination to the website via a chat-based form. We create text based on the form responses and that an email to a responsible organization. The organization should solve the issue. We store the whole conversation regarding the case on our website (only visible to the user). A public dashboard provides insight in which organizations resolve which cases (this was not implemented). The project was created as an MVP, some features are only implemented roughly (e.g. the email validation should be improved if you continue using the code). The forms for the cases were created with surveyjs (https://surveyjs.io/). This should enable the non-technical people on the project to create new cases. However, the surveyjs form has to follow certain standards. Check out the example files (todo).

Development setup

Get the code, create .ENV files for local development.

git clone [email protected]:algorithmwatch/goliath.git
cd goliath
mkdir .envs && cp -r docs/exampleenv .envs/.local/

Adjust .envs/.local to you needs. See docs/exampleenv.

VS Code Development Container

We recommend to use VS Code with the Docker-based VS Code Development Container.

As an alternative, see below in the following section on how to use Docker without VS Code.

To start the development server: Open a new terminal and run /start.

To run management commands: Open a new terminal and run ./manage.py $command, e.g., ./manage.py makemigrations.

Adding new extensions

VS-Code extensions are cached between rebuilds. If you add a new VS Code extension, you need to remove the named volume docker-compose -f docker-compose.local.yml down && docker volume rm goliath_goliath_extensions. (Read more)

Docker-Compose

Install and use Docker with Docker-Compose. More information.

Start development setup:

./local.sh

Some important Django management comands:

./local.sh manage makemigrations
./local.sh manage migrate
./local.sh manage createsuperuser
./local.sh manage reset_db
./local.sh manage shell_plus --print-sql
./local.sh manage importsupport
./local.sh manage fakedata

Frontend

Not supporting IE 11 because of Tailwind v2, but IE 11 usage is dropping fast.

If you add a new npm dependency, delete the volume in order to recreate it.

docker-compose -f docker-compose.local.yml down
docker volume rm goliath_local_node_modules

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 py.test

pytest

Celery

To run a celery worker:

cd goliath
celery -A config.celery_app worker -l info

Please note: For Celery's import magic to work, it is important where the celery commands are run. If you are in the same folder with manage.py, you should be right.

Viewing sent E-Mail during development

In development, to see emails that are being sent from your application. For that reason local SMTP server MailHog with a web interface is available as Docker container.

View sent emails at: http://localhost:8025

Production

Settings via environment varibales

See docs/exampleenv/.django_prod. Also the cookiecutter docs may help for some settings.

Deployment

We currently support two different Docker-based ways to deploy Goliath:

Sentry

Setup Sentry to monitor errors. Set the SENTRY_DSN as environment variable.

New Relic

Setup New Relic for gerneral APM. Set the following ENVs.

NEW_RELIC_LICENSE_KEY=
NEW_RELIC_APP_NAME=
NEW_RELIC_CONFIG_FILE=

E-Mail services

See docs/emails_mailjet.md on how to configure Mailjet. Right now, we only support Mailjet but we could make any other email service from django-anymail work.

Staging

In order to test the email receiving, you need to have Goliath deployed somewhere. So think about creating a seperate staging server to test Goliath. You take all the production settings but customize Goliath via .env files.

License

Affero General Public License 3.0