From 631f7b7856b26b4f9e4e8f2dc43e820bcf0c23ef Mon Sep 17 00:00:00 2001 From: ImreSamu Date: Wed, 30 Nov 2016 05:39:06 +0100 Subject: [PATCH] fixes , improvements --- Makefile | 65 ++++++++++++++++++++++++++----------------- QUICKSTART.md | 8 +++++- docker-compose.yml | 2 +- quickstart.sh | 69 ++++++++++++++-------------------------------- 4 files changed, 68 insertions(+), 76 deletions(-) diff --git a/Makefile b/Makefile index 547694bc..969dc642 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,37 @@ all: build/openmaptiles.tm2source/data.yml build/mapping.yaml build/tileset.sql +help: + @echo "==============================================================================" + @echo " OpenMapTiles https://github.com/openmaptiles/openmaptiles " + @echo "Hints for testing areas " + @echo " make download-geofabrik-list # list actual geofabrik OSM extracts for download -> <> " + @echo " make list # list actual geofabrik OSM extracts for download -> <> " + @echo " ./quickstart.sh <> # example: ./quickstart.sh madagascar " + @echo " " + @echo "Hints for designers:" + @echo " ....TODO.... # start Maputnik " + @echo " ....TODO.... # start Tileserver-gl-light" + @echo " make start-mapbox-studio # start Mapbox Studio" + @echo " " + @echo "Hints for developers:" + @echo " make # build source code " + @echo " make download-geofabrik area=albania # download OSM data from geofabrik, and create config file" + @echo " make psql # start PostgreSQL console " + @echo " make psql-list-tables # list all PostgreSQL tables " + @echo " make import-sql-dev # start import-sql /bin/bash terminal " + @echo " make import-osm-dev # start import-osm /bin/bash terminal (imposm3)" + @echo " make clean-docker # remove docker containers, PG data volume " + @echo " make forced-clean-sql # drop all PostgreSQL tables for clean environment " + @echo " make refresh-docker-images # refresh openmaptiles docker images from Docker HUB" + @echo " make remove-docker-images # remove openmaptiles docker images" + @echo " make pgclimb-list-views # list PostgreSQL public schema views" + @echo " make pgclimb-list-tables # list PostgreSQL public schema tabless" + @echo " cat .env # list PG database and MIN_ZOOM and MAX_ZOOM informations" + @echo " cat ./quickstart.log # backup of the last ./quickstart.sh " + @echo " ....TODO.... # start lukasmartinelli/postgis-editor" + @echo " make help # help about avaialable commands" + @echo "==============================================================================" + build/openmaptiles.tm2source/data.yml: mkdir -p build/openmaptiles.tm2source && generate-tm2source openmaptiles.yaml --host="postgres" --port=5432 --database="openmaptiles" --user="openmaptiles" --password="openmaptiles" > build/openmaptiles.tm2source/data.yml @@ -21,25 +53,10 @@ list-docker-images: docker images | grep openmaptiles refresh-docker-images: - docker pull openmaptiles/generate-vectortiles - docker pull openmaptiles/import-lakelines - docker pull openmaptiles/import-natural-earth - docker pull openmaptiles/import-osm - docker pull openmaptiles/import-sql - docker pull openmaptiles/import-water - docker pull openmaptiles/openmaptiles-tools - docker pull openmaptiles/postgis - docker pull osm2vectortiles/mapbox-studio + docker-compose pull remove-docker-images: - docker rmi openmaptiles/generate-vectortiles - docker rmi openmaptiles/import-lakelines - docker rmi openmaptiles/import-natural-earth - docker rmi openmaptiles/import-osm - docker rmi openmaptiles/import-sql - docker rmi openmaptiles/import-water - docker rmi openmaptiles/openmaptiles-tools - docker rmi openmaptiles/postgis + docker rmi -f $(docker images | grep "openmaptiles" | awk "{print \$3}") docker rmi osm2vectortiles/mapbox-studio psql: @@ -52,14 +69,9 @@ psql-pg-stat-reset: docker-compose run --rm import-osm /usr/src/app/psql.sh -P pager=off -c 'SELECT pg_stat_statements_reset();' forced-clean-sql: - docker-compose run --rm import-osm /usr/src/app/psql.sh -c "DROP SCHEMA IF EXISTS public CASCADE" - docker-compose run --rm import-osm /usr/src/app/psql.sh -c "CREATE SCHEMA IF NOT EXISTS public" - docker-compose run --rm import-osm /usr/src/app/psql.sh -c "CREATE EXTENSION hstore" - docker-compose run --rm import-osm /usr/src/app/psql.sh -c "CREATE EXTENSION postgis" - docker-compose run --rm import-osm /usr/src/app/psql.sh -c "CREATE EXTENSION pg_stat_statements" - docker-compose run --rm import-osm /usr/src/app/psql.sh -c "GRANT ALL ON SCHEMA public TO postgres;" - docker-compose run --rm import-osm /usr/src/app/psql.sh -c "GRANT ALL ON SCHEMA public TO public;" - docker-compose run --rm import-osm /usr/src/app/psql.sh -c "COMMENT ON SCHEMA public IS 'standard public schema';" + docker-compose run --rm import-osm /usr/src/app/psql.sh -c "DROP SCHEMA IF EXISTS public CASCADE ; CREATE SCHEMA IF NOT EXISTS public; " + docker-compose run --rm import-osm /usr/src/app/psql.sh -c "CREATE EXTENSION hstore; CREATE EXTENSION postgis; CREATE EXTENSION pg_stat_statements;" + docker-compose run --rm import-osm /usr/src/app/psql.sh -c "GRANT ALL ON SCHEMA public TO public;COMMENT ON SCHEMA public IS 'standard public schema';" pgclimb-list-views: docker-compose run --rm import-osm /usr/src/app/pgclimb.sh -c "select schemaname,viewname from pg_views where schemaname='public' order by viewname;" csv @@ -85,15 +97,18 @@ download-geofabrik: cat ./data/docker-compose-config.yml @echo " " +# the `download-geofabrik` error message mention `list`, if the area parameter is wrong. so I created a similar make command list: docker-compose run --rm import-osm ./download-geofabrik-list.sh +# same as a `make list` download-geofabrik-list: docker-compose run --rm import-osm ./download-geofabrik-list.sh start-mapbox-studio: docker-compose up mapbox-studio +# work in progress - please don't remove test_etlgraph: generate-etlgraph layers/boundary/boundary.yaml generate-etlgraph layers/highway/highway.yaml diff --git a/QUICKSTART.md b/QUICKSTART.md index 9a63cc05..39827cfc 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -272,6 +272,11 @@ This is generating mbtiles for your area : [ MIN_ZOOM: "0" - MAX_ZOOM: "7" ] ./quickstart.sh yukon ``` +### Check other commands + +`make help` + + ### Change MIN_ZOOM and MAX_ZOOM modify the settings in the `.env` file @@ -280,9 +285,10 @@ modify the settings in the `.env` file and re-start `./quickstart.sh ` * the new config file re-generating to here ./data/docker-compose-config.yml +* Known problems: + * If you use same area - then the ./data/docker-compose-config.yml not re-generating, so you have to modify by hand! Hints: * Small increments! Never starts with the MAX_ZOOM = 14 * The suggested MAX_ZOOM = 14 - use only with small extracts - diff --git a/docker-compose.yml b/docker-compose.yml index fd79506c..194fbdd1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: links: - postgres import-osm: - image: "openmaptiles/import-osm" + image: "openmaptiles/import-osm:add_tools" env_file: .env environment: DIFF_MODE: "false" diff --git a/quickstart.sh b/quickstart.sh index 1050e59c..b3f9d2dd 100755 --- a/quickstart.sh +++ b/quickstart.sh @@ -110,19 +110,18 @@ docker info | grep Space echo " " echo "-------------------------------------------------------------------------------------" echo "====> : Pulling or Refreshing OpenMapTiles docker images " -#for developers is not perfect ... -#make refresh-docker-images - -echo " " -echo "-------------------------------------------------------------------------------------" -echo "====> : Checking OpenMapTiles docker images " -docker images | grep openmaptiles +make refresh-docker-images echo " " echo "-------------------------------------------------------------------------------------" echo "====> : Stopping running services & removing old containers " make clean-docker +echo " " +echo "-------------------------------------------------------------------------------------" +echo "====> : Checking OpenMapTiles docker images " +docker images | grep openmaptiles + echo " " echo "-------------------------------------------------------------------------------------" echo "====> : Making directories - if they don't exist ( ./build ./data ./pgdata ) " @@ -135,13 +134,6 @@ echo "-------------------------------------------------------------------------- echo "====> : Removing old MBTILES if exists ( ./data/*.mbtiles ) " rm -f ./data/*.mbtiles -echo " " -echo "-------------------------------------------------------------------------------------" -echo "====> : Removing pgdata " -# rm -rf ./pgdata/* - - - if [ ! -f ./data/${testdata} ]; then echo " " echo "-------------------------------------------------------------------------------------" @@ -170,7 +162,6 @@ if [ ! -f ./data/${testdata} ]; then exit 404 fi - echo " " echo "-------------------------------------------------------------------------------------" echo "====> : Remove old generated source files ( ./build/* ) ( if they exist ) " @@ -190,7 +181,11 @@ echo " : Source code: https://github.com/openmaptiles/postgis " echo " : Thank you: https://www.postgresql.org ! Thank you http://postgis.org !" docker-compose up -d postgres -# Drop all PostgreSQL tables ... +echo " " +echo "-------------------------------------------------------------------------------------" +echo "====> : Drop and Recreate PostgreSQL public schema " +# Drop all PostgreSQL tables +# This is add an extra safe belt , if the user modify the docker volume seetings make forced-clean-sql echo " " @@ -281,12 +276,12 @@ echo "====> : (disk space) We have created a lot of docker images: " echo " : Hint: you can remove with: docker rmi IMAGE " docker images | grep openmaptiles -# -# echo " " -# echo "-------------------------------------------------------------------------------------" -# echo "====> : (disk space) We have created this new docker volume for PostgreSQL data:" -# echo " : Hint: you can remove with : docker volume rm openmaptiles_pgdata " -# docker volume ls -q | grep openmaptiles + +echo " " +echo "-------------------------------------------------------------------------------------" +echo "====> : (disk space) We have created this new docker volume for PostgreSQL data:" +echo " : Hint: you can remove with : docker volume rm openmaptiles_pgdata " +docker volume ls -q | grep openmaptiles echo " " echo "-------------------------------------------------------------------------------------" @@ -303,33 +298,9 @@ echo "It takes $(($ENDTIME - $STARTTIME)) seconds to complete" echo "We saved the log file to $log_file ( for debugging ) You can compare with the travis log !" echo " " echo "Start experimenting ! And check the QUICKSTART.MD file !" -echo " " -echo "Hints for testing other areas" -echo " make download-geofabrik-list # list actual geofabrik OSM extracts for download -> <> " -echo " make list # list actual geofabrik OSM extracts for download -> <> " -echo " ./quickstart.sh <> # example: ./quickstart.sh madagascar " -echo " " -echo "Hints for designers:" -echo " .... # start Maputnik " -echo " .... # start Tileserver-gl-light" -echo " make start-mapbox-studio # start Mapbox Studio" -echo " " -echo "Hints for developers:" -echo " make download-geofabrik area=albania # download OSM data from geofabrik, and create config file" -echo " make psql # start PostgreSQL console " -echo " make psql-list-tables # list all PostgreSQL tables " -echo " make import-sql-dev # start import-sql /bin/bash terminal " -echo " make import-osm-dev # start import-osm /bin/bash terminal (imposm3)" -echo " make clean-docker # remove docker containers, PG data volume " -echo " make forced-clean-sql # drop all PostgreSQL tables for clean environment " -echo " make refresh-docker-images # refresh openmaptiles docker images from Docker HUB" -echo " make remove-docker-images # remove openmaptiles docker images" -echo " make pgclimb-list-views # list PostgreSQL public schema views" -echo " make pgclimb-list-tables # list PostgreSQL public schema tabless" -echo " cat .env # list PG database and MIN_ZOOM and MAX_ZOOM informations" -echo " cat ./quickstart.log # backup of the last ./quickstart.sh " -echo " .... # start lukasmartinelli/postgis-editor" -echo " " +echo "Avaialable help commands ( make help ) " +make help + echo "-------------------------------------------------------------------------------------" echo " Acknowledgments " echo " Thanks to all free, open source software developers and Open Data Contributors ! "