-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from AusDTO/geolite2
Add geoipdate job
- Loading branch information
Showing
10 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
name: geoipupdate | ||
|
||
templates: | ||
bin/geoipupdate.sh: bin/geoipupdate.sh | ||
bin/geoipupdate-cron: bin/geoipupdate-cron | ||
bin/pre-start: bin/pre-start | ||
etc/GeoIP.conf: etc/GeoIP.conf | ||
|
||
packages: | ||
- geoipupdate | ||
|
||
properties: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 9 * * Wed root /var/vcap/jobs/geoipupdate/bin/geoipupdate.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
JOB_NAME=geoipupdate | ||
JOB_DIR=/var/vcap/jobs/$JOB_NAME | ||
LOG_DIR=/var/vcap/sys/log/$JOB_NAME | ||
STORE_DIR=/var/vcap/store/$JOB_NAME | ||
|
||
mkdir -p $LOG_DIR | ||
chown vcap:vcap $LOG_DIR | ||
|
||
{ | ||
echo "$(date) running geoipupdate" | ||
|
||
# graylog looks for the geoip database at | ||
# /etc/graylog/server/GeoLite2-City.mmdb, so we download the db | ||
# to the bosh standard location and add a symlink for graylog | ||
|
||
mkdir -p $STORE_DIR | ||
mkdir -p /etc/graylog | ||
ln -sf $STORE_DIR /etc/graylog/server | true | ||
|
||
chown vcap -R $STORE_DIR | ||
|
||
chpst -u vcap:vcap /var/vcap/packages/geoipupdate/bin/geoipupdate \ | ||
-v \ | ||
-f $JOB_DIR/etc/GeoIP.conf \ | ||
-d $STORE_DIR | ||
} >>$LOG_DIR/$JOB_NAME.stdout.log \ | ||
2>>$LOG_DIR/$JOB_NAME.stderr.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# run it immediately | ||
/var/vcap/jobs/geoipupdate/bin/geoipupdate.sh | ||
|
||
# schedule the job with cron | ||
cp /var/vcap/jobs/geoipupdate/bin/geoipupdate-cron /etc/cron.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# suggested config for GeoLite2 databases | ||
# from https://dev.maxmind.com/geoip/geoipupdate/ | ||
|
||
# The following AccountID and LicenseKey are required placeholders. | ||
# For geoipupdate versions earlier than 2.5.0, use UserId here instead of AccountID. | ||
AccountID 0 | ||
LicenseKey 000000000000 | ||
|
||
# Include one or more of the following edition IDs: | ||
# * GeoLite2-City - GeoLite 2 City | ||
# * GeoLite2-Country - GeoLite2 Country | ||
# For geoipupdate versions earlier than 2.5.0, use ProductIds here instead of EditionIDs. | ||
EditionIDs GeoLite2-City GeoLite2-Country |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
set -e # exit immediately if a simple command exits with a non-zero status | ||
set -u # report the usage of uninitialized variables | ||
|
||
# Available variables | ||
# $BOSH_COMPILE_TARGET - where this package & spec'd source files are available | ||
# $BOSH_INSTALL_TARGET - where you copy/install files to be included in package | ||
|
||
VERSION=2.5.0 | ||
|
||
tar xzfv geoipupdate/geoipupdate-${VERSION}.tar.gz | ||
|
||
cd geoipupdate-${VERSION} | ||
|
||
./configure --prefix $BOSH_INSTALL_TARGET | ||
|
||
make | ||
|
||
make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
name: geoipupdate | ||
|
||
dependencies: [] | ||
|
||
files: | ||
- geoipupdate/geoipupdate-2.5.0.tar.gz # from https://github.com/maxmind/geoipupdate/releases/download/v2.5.0/geoipupdate-2.5.0.tar.gz |