Skip to content

Commit

Permalink
scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Nov 29, 2016
1 parent 77c5071 commit d0e8a1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
16 changes: 9 additions & 7 deletions script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@ export LC_ALL=en_US.UTF-8;
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );

export TIMESTAMP=$(date +"%m-%d-%Y-%H:%M:%S");
export PBF2JSON_BIN="/var/www/pelias/pbf2json/build/pbf2json.linux-x64";

# location of data files
export POLYLINE_FILE="/data/polyline/planet.polylines"; # the file containing all the streets
export OAPATH="/data/oa"; # base path of openaddresses file system
export PBF2JSON_FILE="/data/pbf/planet.osm.pbf";

# a directory where all builds will live
BUILDS="/data/builds";

# ensure builds dir exists
[ -d $BUILDS ] || mkdir -p $BUILDS;

# update openaddresses data (optional)
$DIR/update_oa.sh;

# a directory where this specific build will live
export BUILDDIR="$BUILDS/$TIMESTAMP";
[ -d $BUILDDIR ] || mkdir -p $BUILDDIR;

# a directory with enough free space to store sqlite tmp files
export SQLITE_TMPDIR="$BUILDDIR/tmp";
# location of temp files
export SQLITE_TMPDIR="$BUILDDIR/tmp"; # a directory with enough free space to store sqlite tmp files
export PBF2JSON_TMPDIR="$BUILDDIR/tmp/leveldb"; # a directory with enough free space to store leveldb tmp files

# run polyline importer
$DIR/import.sh;
Expand All @@ -56,14 +58,14 @@ if type pigz >/dev/null
fi

# clean up
rm -rf "$SQLITE_TMPDIR"; # remove tmp files
rm -rf "$SQLITE_TMPDIR" "$PBF2JSON_TMPDIR"; # remove tmp files

# record build meta data
METAFILE="$BUILDDIR/build.meta";

echo "-- file system --" > "$METAFILE";
ls -lah "$BUILDDIR" >> "$METAFILE";
shasum "$BUILDDIR/*.db*" >> "$METAFILE";
shasum $BUILDDIR/*.db* >> "$METAFILE";

echo "-- street db --" >> "$METAFILE";
sqlite3 -echo "$BUILDDIR/street.db" "SELECT * FROM sqlite_master;" >> "$METAFILE";
Expand Down
3 changes: 1 addition & 2 deletions script/conflate_osm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ STREET_DB=${STREET_DB:-"$BUILDDIR/street.db"};
# location of stdio files
PROC_STDOUT=${PROC_STDOUT:-"$BUILDDIR/conflate_osm.out"};
PROC_STDERR=${PROC_STDERR:-"$BUILDDIR/conflate_osm.err"};
PROC_CONFERR=${PROC_CONFERR:-"$BUILDDIR/conflate_osm.skip"};

# a directory with enough free space to store sqlite tmp files
export SQLITE_TMPDIR=${SQLITE_TMPDIR:-"$BUILDDIR/tmp"};
Expand All @@ -59,4 +58,4 @@ rm -f $PROC_STDOUT $PROC_STDERR $PROC_CONFERR;

# run import
$PBF2JSON_BIN -tags="$PBF2JSON_TAGS" -leveldb="$PBF2JSON_TMPDIR" $PBF2JSON_FILE |\
time -p node $DIR/../cmd/osm.js $ADDRESS_DB $STREET_DB 1>$PROC_STDOUT 2>$PROC_STDERR 3>$PROC_CONFERR;
time -p node $DIR/../cmd/osm.js $ADDRESS_DB $STREET_DB 1>$PROC_STDOUT 2>$PROC_STDERR;
4 changes: 4 additions & 0 deletions script/cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ git pull -q origin master;
# update npm dependencies
npm --loglevel=silent install;

# update openaddresses data (optional)
export OAPATH="/data/oa"; # base path of openaddresses file system
$DIR/update_oa.sh;

# run build
$DIR/build.sh &> build.log;

0 comments on commit d0e8a1c

Please sign in to comment.