forked from MapComplete/MapComplete
		
	Scripts: add script to automatically update the database
This commit is contained in:
		
							parent
							
								
									72df69a2d6
								
							
						
					
					
						commit
						602cc1f8c9
					
				
					 3 changed files with 44 additions and 47 deletions
				
			
		|  | @ -1,38 +0,0 @@ | |||
| #! /bin/bash | ||||
| 
 | ||||
| # Full database update. Downloads the latest from planet.osm.org, build update script, setup and seed it | ||||
| # Meant to be run with 'nohup' | ||||
| export NVM_DIR="$HOME/.nvm" | ||||
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm | ||||
| nvm use 20.12.2 | ||||
| npm run init # contains a 'npm run generate, which builds the layers' | ||||
| npm run generate:buildDbScript | ||||
| mv build_db.lua ~/data/ | ||||
| 
 | ||||
| 
 | ||||
| cd ~/data || exit | ||||
| rm planet-latest.osm.pbf | ||||
| 
 | ||||
| wget https://planet.osm.org/pbf/planet-latest.osm.pbf | ||||
| 
 | ||||
| TIMESTAMP=$(osmium fileinfo ~/data/planet-latest.osm.pbf -g header.option.timestamp) | ||||
| DATE=$(echo $TIMESTAMP | sed "s/T.*//") | ||||
| echo $DATE | ||||
| cd ~/git/MapComplete/ || exit | ||||
| npm run create:database -- -- ${DATE/T.*//} | ||||
| cd ~/data || exit | ||||
| 
 | ||||
| rm seeddb.log | ||||
| osm2pgsql -O flex -S build_db.lua -s --flat-nodes=import-help-file -d postgresql://user:password@localhost:5444/osm-poi.${DATE} planet-latest.osm.pbf >> seeddb.log | ||||
| 
 | ||||
| # To see the progress | ||||
| # tail -f seeddb.log | ||||
| 
 | ||||
| cd ~/git/MapComplete || exit | ||||
| npm run delete:database:old | ||||
| nohup npm run server:summary >> summary_server.log & | ||||
| cd - || exit | ||||
| 
 | ||||
| # Restart tileserver | ||||
| export DATABASE_URL=postgresql://user:password@localhost:5444/osm-poi.${DATE} | ||||
| nohup ./pg_tileserv >> pg_tileserv.log & | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue