2023-09-25 03:13:17 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#! /bin/bash
							 | 
						
					
						
							
								
									
										
										
										
											2024-04-26 16:52:19 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								### To be run from the root of the repository
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								### Prepares and builds MapComplete, uploads it to hetzner for hosted.mapcomplete.org. Will upload about 500MB to this computer
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-25 03:13:17 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Some pointers to get started:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# apt install npm
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# apt install unzip
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# npm i -g csp-logger
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# wget https://github.com/pietervdvn/latlon2country/raw/main/tiles.zip
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# unzip tiles.zip
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-27 22:21:35 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								cp config.json config.json.bu &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cp ./scripts/hetzner/config.json . && # Copy the config _before_ building, as the config might contain some needed URLs
							 | 
						
					
						
							
								
									
										
										
										
											2024-02-12 16:38:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								npm run reset:layeroverview
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								npm run test &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								npm run prepare-deploy &&
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-25 03:13:17 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								zip dist.zip -r dist/* &&
							 | 
						
					
						
							
								
									
										
										
										
											2023-10-15 01:14:55 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								mv config.json.bu config.json &&
							 | 
						
					
						
							
								
									
										
										
										
											2024-02-20 02:01:08 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								scp ./Docs/ServerConfig/hetzner/* hetzner:/root/ &&
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-27 22:21:35 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								rsync -rzh --progress dist.zip hetzner:/root/ &&
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-28 03:00:22 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								echo "Upload completed, deploying config and booting" &&
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-27 22:21:35 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ssh hetzner -t "unzip dist.zip && rm dist.zip && rm -rf public/ && mv dist public && caddy stop && caddy start" &&
							 | 
						
					
						
							
								
									
										
										
										
											2024-04-26 16:52:19 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								rm dist.zip
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-26 01:27:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								npm run clean
							 |