AlienDB is an analytics platform for trending Reddit threads. It stores historical data for the top threads on Reddit at any given time, including karma trends and comment stats. More information is available at https://aliendb.info/about.
AlienDB is structured as 4 Docker services. 3 of these,
RabbitMQ, use images from the public Docker repository. The final one,
web is built manually. The project makes use of docker-compose to handle service definitions.
The web container is overseen by
supervisor, which ensures that the following backend services are kept active:
- Gunicorn, the WSGI server for the Django application.
- Nginx, the public-facing web server.
- Celery, a task manager used to periodically scrape Reddit data.
- Flower, a small non-public web server for monitoring Celery tasks.
The web app itself uses Django as a backend, with the majority of the application code in the
analytics app which is found in
It is recommended that you create copies of the config files for development and production environments. For example, for a development environment:
cp docker-compose.yml docker-compose-dev.yml cp .env .env-dev
You will need to update any references from .env to .env-dev in the docker-compose-dev.yml file.
Most settings given in the provided .env file are suitable for development use. However, you will need to configure the Praw settings in order for the app to retrieve data from Reddit.
- Register a Reddit application. You should use the "script" classification.
- Identify the client_id and client_secret keys from the app's information panel.
- Fill in the necessary information in your env file.
docker-compose -f docker-compose-dev.yml build --no-cache
- Create and start the Docker containers:
docker-compose -f docker-compose-dev.yml up [-d]
- Connect to the website at
- Make any necessary changes to the code.
- Stop and remove the
docker-compose -f docker-compose-dev.yml stop web docker-compose -f docker-compose-dev.yml rm web
- Build the new image and create+start a new container.
docker-compose -f docker-compose-dev.yml up [-d] --build
This project generally uses the generic testing framework provided by Django, which is itself based on Python's built-in
unittest module. For general information about writing tests, see Django's documentation on the subject.
- Start the containers using the above Building instructions.
- Run the appropriate
manage.py testcommand on the running
docker-compose -f docker-compose-dev.yml run --rm web \ python manage.py test aliendb.apps.analytics.tests