| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # TODO:
 | 
					
						
							|  |  |  | # - cleanup/destroy
 | 
					
						
							|  |  |  | # - update
 | 
					
						
							|  |  |  | # - backup
 | 
					
						
							|  |  |  | # - pull config
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2024-09-21 22:57:42 +03:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-20 18:37:20 +03:00
										 |  |  | EDITOR ?= vim | 
					
						
							| 
									
										
										
										
											2024-01-20 18:36:57 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-04 17:55:26 +03:00
										 |  |  | # CTs...
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | # NOTE: The order here is important: 
 | 
					
						
							|  |  |  | # 	- to avoid bootstrapping network connections gate must be the 
 | 
					
						
							|  |  |  | # 	  first CT to get built to route the rest of CT's to the WAN 
 | 
					
						
							|  |  |  | # 	  connection during the build process.
 | 
					
						
							|  |  |  | # 	- ns should be the second to be built to provide the rest of the
 | 
					
						
							|  |  |  | # 	  CT's with DHCP network configuration.
 | 
					
						
							|  |  |  | # 	- the rest of the CT's are created in order of importance, strting 
 | 
					
						
							|  |  |  | # 	  from CT's needed for access and ending with services.
 | 
					
						
							| 
									
										
										
										
											2024-01-13 00:04:09 +03:00
										 |  |  | CORE_CTs := \
 | 
					
						
							|  |  |  | 	gate ns | 
					
						
							|  |  |  | MINIMAL_CTs := \
 | 
					
						
							|  |  |  | 	ssh wireguard  | 
					
						
							|  |  |  | APP_CTs := \
 | 
					
						
							|  |  |  | 	syncthing nextcloud #gitea | 
					
						
							| 
									
										
										
										
											2024-02-05 23:16:24 +03:00
										 |  |  | # Optional (see dev target)...
 | 
					
						
							| 
									
										
										
										
											2024-01-13 00:04:09 +03:00
										 |  |  | DEV_CTs := \
 | 
					
						
							|  |  |  | 	gitea | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-12 17:11:38 +03:00
										 |  |  | DEPENDENCIES = make git dig pct | 
					
						
							| 
									
										
										
										
											2024-01-12 17:10:43 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | # dependency checking...
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require(%): | 
					
						
							|  |  |  | 	@printf "%-20s %s\n" \
 | 
					
						
							|  |  |  | 		"$*" \
 | 
					
						
							|  |  |  | 		"`which $* &> /dev/null && echo '- OK' || echo '- FAIL'`" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: check-message | 
					
						
							|  |  |  | check-message: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: check | 
					
						
							|  |  |  | check: check-message $(foreach dep,$(DEPENDENCIES),require($(dep))) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: FORCE | 
					
						
							|  |  |  | FORCE: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-17 15:53:57 +03:00
										 |  |  | # XXX should thisbe an env var or an arg to make.sh???
 | 
					
						
							| 
									
										
										
										
											2024-10-17 14:38:01 +03:00
										 |  |  | %-bootstrap: export BOOTSTRAP=1 | 
					
						
							|  |  |  | %-bootstrap: % | 
					
						
							| 
									
										
										
										
											2024-10-18 17:32:19 +03:00
										 |  |  | 	@true | 
					
						
							| 
									
										
										
										
											2024-10-17 14:25:02 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-17 14:38:01 +03:00
										 |  |  | %-bootstrap-clean: export BOOTSTRAP_CLEAN=1 | 
					
						
							|  |  |  | %-bootstrap-clean: % | 
					
						
							| 
									
										
										
										
											2024-10-18 17:32:19 +03:00
										 |  |  | 	@true | 
					
						
							| 
									
										
										
										
											2024-10-17 14:25:02 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-15 01:06:15 +03:00
										 |  |  | %: config %/make.sh FORCE | 
					
						
							|  |  |  | 	$*/make.sh | 
					
						
							| 
									
										
										
										
											2024-01-10 16:14:59 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-13 00:04:09 +03:00
										 |  |  | %.config: %/config.example | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | config.global: config.global.example | 
					
						
							| 
									
										
										
										
											2024-01-12 17:10:43 +03:00
										 |  |  | 	@ [ ! -e "$@" ] \
 | 
					
						
							|  |  |  | 		&& cat "$<" > "$@" \
 | 
					
						
							|  |  |  | 		&& $(EDITOR) "$@" \
 | 
					
						
							|  |  |  | 	|| true | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | # Shorthands...
 | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | .PHONY: config | 
					
						
							|  |  |  | config: config.global | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | .PHONY: gate | 
					
						
							|  |  |  | gate: gate-traefik | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-07 16:18:27 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-19 17:13:49 +03:00
										 |  |  | # XXX goal:
 | 
					
						
							|  |  |  | # 	- build minimal system
 | 
					
						
							|  |  |  | # 		- bootstrap bridge
 | 
					
						
							|  |  |  | # 		- gate
 | 
					
						
							|  |  |  | # 		- ns
 | 
					
						
							| 
									
										
										
										
											2024-09-22 22:46:16 +03:00
										 |  |  | # 	...not yet sure of the best way to do this...
 | 
					
						
							| 
									
										
										
										
											2024-09-19 17:13:49 +03:00
										 |  |  | # 	
 | 
					
						
							|  |  |  | .PHONY: bootstrap | 
					
						
							| 
									
										
										
										
											2024-10-17 14:25:02 +03:00
										 |  |  | bootstrap: host-bootstrap gate-bootstrap \ | 
					
						
							|  |  |  | 		ns \
 | 
					
						
							| 
									
										
										
										
											2024-10-19 13:59:43 +03:00
										 |  |  | 		ssh \
 | 
					
						
							| 
									
										
										
										
											2024-10-18 17:32:19 +03:00
										 |  |  | 		wireguard \
 | 
					
						
							| 
									
										
										
										
											2024-10-17 14:25:02 +03:00
										 |  |  | 		bootstrap-clean | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-19 13:59:43 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | # NOTE: host-bootstrap-clean will drop all connections to the server...
 | 
					
						
							| 
									
										
										
										
											2024-10-17 14:25:02 +03:00
										 |  |  | .PHONY: bootstrap-clean | 
					
						
							| 
									
										
										
										
											2024-10-19 13:59:43 +03:00
										 |  |  | bootstrap-clean: gate-bootstrap-clean #host-bootstrap-clean
 | 
					
						
							| 
									
										
										
										
											2024-09-19 17:13:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2024-01-13 00:04:09 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | .PHONY: core | 
					
						
							| 
									
										
										
										
											2024-01-18 16:21:51 +03:00
										 |  |  | core: config $(CORE_CTs) | 
					
						
							| 
									
										
										
										
											2024-01-13 00:04:09 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: minimal | 
					
						
							| 
									
										
										
										
											2024-01-18 16:46:27 +03:00
										 |  |  | minimal: core $(MINIMAL_CTs) | 
					
						
							| 
									
										
										
										
											2024-01-13 00:04:09 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: dev | 
					
						
							|  |  |  | dev: minimal $(DEV_CTs)  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | .PHONY: all | 
					
						
							| 
									
										
										
										
											2024-01-13 00:04:09 +03:00
										 |  |  | all: minimal $(APP_CTs) | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-20 19:00:22 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: clean | 
					
						
							|  |  |  | clean: | 
					
						
							| 
									
										
										
										
											2024-01-30 03:49:06 +03:00
										 |  |  | 	-rm -rf \
 | 
					
						
							|  |  |  | 		*/staging \
 | 
					
						
							|  |  |  | 		*/traefik | 
					
						
							| 
									
										
										
										
											2024-01-20 19:00:22 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-06 18:31:13 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-17 15:07:18 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-10 17:56:40 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2024-09-19 17:13:49 +03:00
										 |  |  | # vim:set ts=4 sw=4 nowrap :
 |