Skip to content
Analytics platform for Reddit
Python HTML JavaScript CSS Other
Branch: master
Clone or download
Latest commit 9b9b9c3 Oct 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci switch from codecov to codacy Mar 6, 2019
res update logo and header May 7, 2019
web update dependencies Oct 5, 2019
.env move debug env var to .env file Aug 11, 2017
.gitignore add pytest cache to gitignore Jul 10, 2019
LICENSE initial Jun 3, 2017
README.md remove codecov remnants Mar 6, 2019
docker-compose.yml move debug env var to .env file Aug 11, 2017

README.md

AlienDB Header

CircleCI Codacy Grade Codacy Coverage

About

https://aliendb.info

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.

Project structure

AlienDB is structured as 4 Docker services. 3 of these, PostgreSQL, Redis, and 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 web/aliendb/apps/analytics.

Configuration

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.

Praw

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.

  1. Register a Reddit application. You should use the "script" classification.
  2. Identify the client_id and client_secret keys from the app's information panel.
  3. Fill in the necessary information in your env file.

Building

  1. Install Docker and docker-compose.
  2. Build the Docker services:
docker-compose -f docker-compose-dev.yml build --no-cache
  1. Create and start the Docker containers:
docker-compose -f docker-compose-dev.yml up [-d]
  1. Connect to the website at http://localhost
  2. Make any necessary changes to the code.
  3. Stop and remove the web container.
docker-compose -f docker-compose-dev.yml stop web
docker-compose -f docker-compose-dev.yml rm web
  1. Build the new image and create+start a new container.
docker-compose -f docker-compose-dev.yml up [-d] --build

Testing

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.

  1. Start the containers using the above Building instructions.
  2. Run the appropriate manage.py test command on the running web container:
docker-compose -f docker-compose-dev.yml run --rm web \
    python manage.py test aliendb.apps.analytics.tests

License

3-Clause BSD License

You can’t perform that action at this time.