This simplifies the stand-up of a sandbox:
Only 2 main Vagrant calls are now needed (`vagrant up` and `vagrant up machine1`). This PR only updates the Vagrant Virtualbox setup. The Vagrant Libvirt and Terraform still need to be updated. This uses docker-compose as the entry point for standing up the stack and makes the stand-up of the sandbox more portal. Vagrant and Terraform are only responsible for standing up infrastructure and then running docker-compose, not for running any glue scripts. The docker-compose calls out to single-shot services to do all the glue required to get the fully functional Tinkerbell stack up and running. All the single-shot services are idempotent. This increases portability and the development iteration loop. This also simplifies the required steps needed to get a fully functioning sandbox up and running. This is intended to help people looking to get started by getting them to a provisioned machine quicker and more easily. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This commit is contained in:
		
							
								
								
									
										45
									
								
								deploy/compose/ubuntu/setup_ubuntu.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										45
									
								
								deploy/compose/ubuntu/setup_ubuntu.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| set -xo pipefail | ||||
|  | ||||
| install_deps() { | ||||
| 	apt -y update | ||||
| 	DEBIAN_FRONTEND=noninteractive apt -y install qemu-utils wget gzip | ||||
| } | ||||
|  | ||||
| download_image() { | ||||
| 	local url="$1" | ||||
| 	wget "${url}" | ||||
| } | ||||
|  | ||||
| img_to_raw() { | ||||
| 	local img_file="$1" | ||||
| 	local raw_file="$2" | ||||
| 	qemu-img convert "${img_file}" -O raw "${raw_file}" | ||||
| } | ||||
|  | ||||
| compress_raw() { | ||||
| 	local raw_file="$1" | ||||
| 	gzip "${raw_file}" | ||||
| } | ||||
|  | ||||
| cleanup() { | ||||
| 	local img_file="$1" | ||||
| 	rm -rf "${img_file}" | ||||
| } | ||||
|  | ||||
| main() { | ||||
| 	local image_url="$1" | ||||
| 	local img_file="$2" | ||||
| 	local raw_file="$3" | ||||
|  | ||||
| 	if [ ! -f "${raw_file}.gz" ]; then | ||||
| 		install_deps | ||||
| 		download_image "${image_url}" | ||||
| 		img_to_raw "${img_file}" "${raw_file}" | ||||
| 		compress_raw "${raw_file}" | ||||
| 		cleanup "${img_file}" | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| main "$1" "$2" "$3" | ||||
		Reference in New Issue
	
	Block a user
	 Jacob Weinstock
					Jacob Weinstock