aboutsummaryrefslogtreecommitdiff
path: root/awstats/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'awstats/build.sh')
-rwxr-xr-xawstats/build.sh45
1 files changed, 0 insertions, 45 deletions
diff --git a/awstats/build.sh b/awstats/build.sh
deleted file mode 100755
index 816ae3b..0000000
--- a/awstats/build.sh
+++ /dev/null
@@ -1,45 +0,0 @@
1#!/bin/sh
2
3set -euo pipefail
4
5# Validate environment variables
6[ -z "$SITE_DOMAIN" ] && { echo "SITE_DOMAIN env variable required"; exit 1; }
7[ -z "$SITE_ALIASES" ] && { echo "SITE_DOMAIN env variable required"; exit 1; }
8[ -z "$GEOIP_LICENSE_KEY" ] && { echo "GEOIP_LICENSE_KEY env variable required"; exit 1; }
9
10# Create the config template
11cat > /etc/awstats/awstats.${SITE_DOMAIN}.conf <<EOF
12LogFile="/input/${SITE_DOMAIN}.log"
13DirData="/output"
14LogFormat = "%virtualname %host - %other %time1 %methodurl %code %bytesd %refererquot %uaquot"
15SiteDomain="${SITE_DOMAIN}"
16HostAliases="${SITE_DOMAIN} ${SITE_ALIASES}"
17#ShowScreenSizeStats=1
18DefaultFile="index.html default.html"
19AllowFullYearView=3
20
21LoadPlugin="ipv6"
22# Should be enabled for build only
23LoadPlugin="geoip2 /geoip/GeoLite2-Country.mmdb"
24LoadPlugin="geoip2_city /geoip/GeoLite2-City.mmdb"
25
26#ExtraSectionName1="Redirected Hit"
27#ExtraSectionCodeFilter1="302"
28#ExtraSectionCondition1="URL,\/offsite"
29#ExtraSectionFirstColumnTitle1="Url"
30#ExtraSectionFirstColumnValues1="QUERY_STRING,url=([^&]+)"
31#ExtraSectionStatTypes1=HL
32#MaxNbOfExtra1=500
33#MinHitExtra1=1
34#ExtraSectionAddSumRow1=1
35EOF
36
37# Download and setup GeoIP Databases
38curl -s "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&suffix=tar.gz&license_key=${GEOIP_LICENSE_KEY}" | tar -xz -C /tmp
39curl -s "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&suffix=tar.gz&license_key=${GEOIP_LICENSE_KEY}" | tar -xz -C /tmp
40curl -s "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&suffix=tar.gz&license_key=${GEOIP_LICENSE_KEY}" | tar -xz -C /tmp
41
42find /tmp -name '*.mmdb' -exec cp '{}' /geoip/ \;
43rm -rf /tmp/GeoLite2*
44
45/opt/awstats/wwwroot/cgi-bin/awstats.pl -config=${SITE_DOMAIN} -update -dir=/output