repos
/ analytics-django master

analytics-django

mirror archived upstream

Self-hostable website analytics on Django: a straightforward collector API, dashboards, a world map, and PDF reports.

analyticsdjangodockerhandcodedpythonself-hostedsqliteviteweb-analytics

756 B · 22 lines Raw History
 1#!/bin/sh
 2#
 3# For easy server deploys you can create add this post-receive hook to your
 4# server in a bare repo somewhere like /srv/git/analytics/hooks/post-receive
 5# and make a git clone in /srv/docker/analytics. This script will then run on
 6# pushing updates to the server to build and deploy new docker images.
 7
 8
 9while read oldrev newrev ref; do
10  if [ "$ref" = "refs/heads/master" ]; then
11    unset GIT_DIR  # unset GIT_DIR so that git pull works correctly
12    START_TIME=`date +%s`
13    cd /srv/docker/analytics
14    git pull
15    docker-compose up --build --detach
16    docker-compose run web python3 manage.py migrate --noinput
17    docker system prune --force
18    END_TIME=`date +%s`
19    echo Total build time: `expr $END_TIME - $START_TIME`s
20  fi
21done