MaZderMind / replicate-sequences

A small and simple tool to resolve timestamps to replication numbers used on http://planet.osm.org/replication/ (see http://wiki.openstreetmap.org/wiki/Planet.osm/diffs for mor information)

Home Page:http://osm.personalwerk.de/replicate-sequences/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

replicate-sequences

a small and simple tool to get the correct replicate sequence id of OpenStreetMap's replation-diffs from a timestamp. Currently deployed on a server near you: https://osm.mazdermind.de/replicate-sequences/

API

Besides the Web-Form the tool can handle the following API-Call:

https://replicate-sequencesosm.mazdermind.de?2013-01-01T10:00:00Z

This can be used to always fetch the latest state.file in conjunction with some unix-foo:

curl "https://replicate-sequences.osm.mazdermind.de/?$(date --utc "+%FT%TZ")"

And with even more unix-foo it can be used to fetch the right state.file for a given planet file, assuming that its modification time was preserved when downloading it ("curl" and "wget" usually do):

curl "https://replicate-sequences.osm.mazdermind.de/?$(date -u -d "@$(stat -c "%Y" planet-latest.osm.pbf)" +"%FT%TZ")"

Setting up you own

Setting up your own copy of this service is quite easy. Check out into a PHP-Enabled docroot. Create a MySQL-Database and a User that has INSERT and SELECT permissions on it. Copy conf.php.tpl to conf.php and fill in your database name and user credentials. You also MUST FILL IN an E-Mail-Adress where admins of planet.osm.org can contact you, in case this script runs crazy on your server. Now populate your database with schema.sql to get the empty tables. You could now start running update.php and it will download >750000 state.txt-files to populate your database. This would take at least one complete day. Instead, i'd suggest to also import initial.sql.gz, which already contains the first 750000 state-files and pre-loads your database with this information. You can then use update.php to stay on track.

Running with Docker

This tools consists of two Containers, both running the same image (mazdermind/osm-replicate-sequenced but with different commands. When the Image is run with "apache2-foreground" it will serve Records from the MySQL-Database. When it is run without a command it will start fetching Sequence-Files from the OSM Repository, updating the MySQL Database. Both images take the following Environment-Variables:

  • DB_HOST: Hostname of the MySQL Database-Server
  • DB_NAME: Name of the Database
  • DB_USER: Username on the Database-Server
  • DB_PASSWORD: Password of the Database-User
  • ABUSE_MAIL: Your Contact Mail-Address

Contact

If you have any questions just ask at osm@mazdermind.de.

Peter

About

A small and simple tool to resolve timestamps to replication numbers used on http://planet.osm.org/replication/ (see http://wiki.openstreetmap.org/wiki/Planet.osm/diffs for mor information)

http://osm.personalwerk.de/replicate-sequences/

License:BSD 2-Clause "Simplified" License


Languages

Language:PHP 88.8%Language:Smarty 4.4%Language:Shell 4.2%Language:Dockerfile 2.6%