Verified Commit 17489608 authored by Jakob Moser's avatar Jakob Moser
Browse files

Add minor deployment explanation

parent c6045175
Loading
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -11,3 +11,28 @@ We see your [Matomo](https://matomo.org) (jap. “honesty”) and raise you our
Obakasan is a very simple web analytics tool, designed to work together with WordPress websites and the [WP-PostViews](https://wordpress.org/plugins/wp-postviews/) plugin.

Given at least read-only database access, it regularly extracts the post views data from the database, so that statistics can be built with it.

## How to deploy

Without Docker, it works basically like this:

1. Clone this repository on a server with access to the WordPress database
2. Create a venv (or something like this) and install the requirements (`pip install -r requirements.txt`)
3. Set the environment variables `DB_HOST`, `DB_USER`, `DB_PASSWORD` and `DB_NAME`
4. Launch `./obakasan.py` and keep it running in the background

Now, every day at midnight (00:00 UTC), a JSON file will be created containing the actual stats for every post, page and attachement as calculated by WP-PostViews.

With Docker, add the following service to your Docker Compose file you already have for the website:

```yaml
obakasan:
    image: gitlab.cl.uni-heidelberg.de:5050/fachschaft/obakasan:latest
    volumes:
        - /some/path/on/your/server/where/you/want/the/data:/app/instance
    environment:
        DB_HOST: name_of_the_db_container:3306
        DB_NAME: name_of_the_database
        DB_USER: name_of_database_user
        DB_PASSWORD: password_for_database_user
```