Compare commits
	
		
			7 Commits
		
	
	
		
			chore/terr
			...
			feature/si
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ![mergify[bot]](/assets/img/avatar_default.png)  | 72bf833702 | ||
|   | 43e3fe8aaa | ||
|   | adfccfb1b0 | ||
|   | 0c4f4d6f59 | ||
|   | 4ba30f0ff7 | ||
|   | bd63279e59 | ||
|   | 5f05561f3d | 
| @@ -1,7 +1,7 @@ | |||||||
| version: "2.1" | version: "2.1" | ||||||
| services: | services: | ||||||
|   tink-server: |   tink-server: | ||||||
|     image: quay.io/tinkerbell/tink:sha-adb49da |     image: ${TINKERBELL_TINK_SERVER_IMAGE} | ||||||
|     restart: unless-stopped |     restart: unless-stopped | ||||||
|     environment: |     environment: | ||||||
|       FACILITY: ${FACILITY:-onprem} |       FACILITY: ${FACILITY:-onprem} | ||||||
| @@ -52,7 +52,7 @@ services: | |||||||
|       retries: 30 |       retries: 30 | ||||||
|  |  | ||||||
|   tink-cli: |   tink-cli: | ||||||
|     image: quay.io/tinkerbell/tink-cli:sha-adb49da |     image: ${TINKERBELL_TINK_CLI_IMAGE} | ||||||
|     restart: unless-stopped |     restart: unless-stopped | ||||||
|     environment: |     environment: | ||||||
|       TINKERBELL_GRPC_AUTHORITY: 127.0.0.1:42113 |       TINKERBELL_GRPC_AUTHORITY: 127.0.0.1:42113 | ||||||
| @@ -89,7 +89,7 @@ services: | |||||||
|     network_mode: host |     network_mode: host | ||||||
|  |  | ||||||
|   boots: |   boots: | ||||||
|     image: quay.io/tinkerbell/boots:327-58ab49913b5498908b16e2607d265a61a05f73b6 |     image: ${TINKERBELL_TINK_BOOTS_IMAGE} | ||||||
|     restart: unless-stopped |     restart: unless-stopped | ||||||
|     network_mode: host |     network_mode: host | ||||||
|     command: -dhcp-addr 0.0.0.0:67 -tftp-addr $TINKERBELL_HOST_IP:69 -http-addr $TINKERBELL_HOST_IP:80 -log-level DEBUG |     command: -dhcp-addr 0.0.0.0:67 -tftp-addr $TINKERBELL_HOST_IP:69 -http-addr $TINKERBELL_HOST_IP:80 -log-level DEBUG | ||||||
| @@ -133,7 +133,7 @@ services: | |||||||
|       - ./state/webroot:/usr/share/nginx/html/ |       - ./state/webroot:/usr/share/nginx/html/ | ||||||
|  |  | ||||||
|   hegel: |   hegel: | ||||||
|     image: quay.io/tinkerbell/hegel:196-fa897aa020769db8becb9be29adaeb6be92a7fc7 |     image: ${TINKERBELL_TINK_HEGEL_IMAGE} | ||||||
|     restart: unless-stopped |     restart: unless-stopped | ||||||
|     network_mode: host |     network_mode: host | ||||||
|     environment: |     environment: | ||||||
|   | |||||||
| @@ -1 +0,0 @@ | |||||||
| https://tinkerbell.org/docs/setup/packet-with-terraform/ |  | ||||||
| @@ -1,17 +0,0 @@ | |||||||
| variable "packet_api_token" { |  | ||||||
|   description = "Packet user api token" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| variable "project_id" { |  | ||||||
|   description = "Project ID" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| variable "facility" { |  | ||||||
|   description = "Packet facility to provision in" |  | ||||||
|   default     = "sjc1" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| variable "device_type" { |  | ||||||
|   description = "Type of device to provision" |  | ||||||
|   default     = "c3.small.x86" |  | ||||||
| } |  | ||||||
| @@ -13,9 +13,10 @@ declare -a YUM_LIST=("https://download.docker.com/linux/centos/7/x86_64/stable/P | |||||||
| 	"docker-ce" | 	"docker-ce" | ||||||
| 	"docker-ce-cli" | 	"docker-ce-cli" | ||||||
| 	"epel-release" | 	"epel-release" | ||||||
|  | 	"pass" | ||||||
| 	"python3") | 	"python3") | ||||||
| declare -a APT_LIST=("docker" | declare -a APT_LIST=("docker" | ||||||
| 	"docker-compose") | 	"docker-compose" "pass") | ||||||
|  |  | ||||||
| add_yum_repo() ( | add_yum_repo() ( | ||||||
| 	$YUM_CONFIG_MGR --add-repo https://download.docker.com/linux/centos/docker-ce.repo | 	$YUM_CONFIG_MGR --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||||||
| @@ -34,7 +35,6 @@ update_apt() ( | |||||||
| restart_docker_service() ( | restart_docker_service() ( | ||||||
| 	service docker restart | 	service docker restart | ||||||
| ) | ) | ||||||
|  |  | ||||||
| install_yum_packages() ( | install_yum_packages() ( | ||||||
| 	$YUM_INSTALL "${YUM_LIST[@]}" -y | 	$YUM_INSTALL "${YUM_LIST[@]}" -y | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -1,33 +1,83 @@ | |||||||
| # Configure the Packet Provider. | # Configure the Packet Provider. | ||||||
|  | terraform { | ||||||
|  |   required_providers { | ||||||
|  |     packet = { | ||||||
|  |       source  = "packethost/packet" | ||||||
|  |       version = "~> 3.0.1" | ||||||
|  |     } | ||||||
|  |     null = { | ||||||
|  |       source = "hashicorp/null" | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
| provider "packet" { | provider "packet" { | ||||||
|   auth_token = var.packet_api_token |   auth_token = var.packet_api_token | ||||||
|   version    = "~> 2.9" |  | ||||||
| } | } | ||||||
|  |  | ||||||
| # Create a new VLAN in datacenter "ewr1" | # Create a new VLAN in datacenter "ewr1" | ||||||
| resource "packet_vlan" "provisioning-vlan" { | resource "packet_vlan" "provisioning_vlan" { | ||||||
|   description = "provisioning-vlan" |   description = "provisioning_vlan" | ||||||
|   facility    = var.facility |   facility    = var.facility | ||||||
|   project_id  = var.project_id |   project_id  = var.project_id | ||||||
| } | } | ||||||
|  |  | ||||||
| # Create a device and add it to tf_project_1 | # Create a device and add it to tf_project_1 | ||||||
| resource "packet_device" "tink-provisioner" { | resource "packet_device" "tink_provisioner" { | ||||||
|   hostname         = "tink-provisioner" |   hostname         = "tink-provisioner" | ||||||
|   plan             = var.device_type |   plan             = var.device_type | ||||||
|   facilities       = [var.facility] |   facilities       = [var.facility] | ||||||
|   operating_system = "ubuntu_18_04" |   operating_system = "ubuntu_18_04" | ||||||
|   billing_cycle    = "hourly" |   billing_cycle    = "hourly" | ||||||
|   project_id       = var.project_id |   project_id       = var.project_id | ||||||
|   network_type     = "hybrid" |   user_data        = file("install_package.sh") | ||||||
|   user_data        = "${file("install_package.sh")}" |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | resource "null_resource" "tink_directory" { | ||||||
|  |   connection { | ||||||
|  |     type = "ssh" | ||||||
|  |     user = var.ssh_user | ||||||
|  |     host = packet_device.tink_provisioner.network[0].address | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   provisioner "remote-exec" { | ||||||
|  |     inline = [ | ||||||
|  |       "mkdir -p /root/tink/deploy" | ||||||
|  |     ] | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   provisioner "file" { | ||||||
|  |     source      = "../../setup.sh" | ||||||
|  |     destination = "/root/tink/setup.sh" | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   provisioner "file" { | ||||||
|  |     source      = "../../generate-envrc.sh" | ||||||
|  |     destination = "/root/tink/generate-envrc.sh" | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   provisioner "file" { | ||||||
|  |     source      = "../../deploy" | ||||||
|  |     destination = "/root/tink" | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   provisioner "remote-exec" { | ||||||
|  |     inline = [ | ||||||
|  |       "chmod +x /root/tink/*.sh /root/tink/deploy/tls/*.sh" | ||||||
|  |     ] | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | resource "packet_device_network_type" "tink_provisioner_network_type" { | ||||||
|  |   device_id = packet_device.tink_provisioner.id | ||||||
|  |   type      = "hybrid" | ||||||
| } | } | ||||||
|  |  | ||||||
| # Create a device and add it to tf_project_1 | # Create a device and add it to tf_project_1 | ||||||
| resource "packet_device" "tink-worker" { | resource "packet_device" "tink_worker" { | ||||||
|   hostname         = "tink-worker" |   count = var.worker_count | ||||||
|  |  | ||||||
|  |   hostname         = "tink-worker-${count.index}" | ||||||
|   plan             = var.device_type |   plan             = var.device_type | ||||||
|   facilities       = [var.facility] |   facilities       = [var.facility] | ||||||
|   operating_system = "custom_ipxe" |   operating_system = "custom_ipxe" | ||||||
| @@ -35,31 +85,57 @@ resource "packet_device" "tink-worker" { | |||||||
|   always_pxe       = "true" |   always_pxe       = "true" | ||||||
|   billing_cycle    = "hourly" |   billing_cycle    = "hourly" | ||||||
|   project_id       = var.project_id |   project_id       = var.project_id | ||||||
|   network_type     = "layer2-individual" | } | ||||||
|  |  | ||||||
|  | resource "packet_device_network_type" "tink_worker_network_type" { | ||||||
|  |   count = var.worker_count | ||||||
|  |  | ||||||
|  |   device_id = packet_device.tink_worker[count.index].id | ||||||
|  |   type      = "layer2-individual" | ||||||
| } | } | ||||||
|  |  | ||||||
| # Attach VLAN to provisioner | # Attach VLAN to provisioner | ||||||
| resource "packet_port_vlan_attachment" "provisioner" { | resource "packet_port_vlan_attachment" "provisioner" { | ||||||
|   device_id = packet_device.tink-provisioner.id |   depends_on = [packet_device_network_type.tink_provisioner_network_type] | ||||||
|  |   device_id  = packet_device.tink_provisioner.id | ||||||
|   port_name  = "eth1" |   port_name  = "eth1" | ||||||
|   vlan_vnid = packet_vlan.provisioning-vlan.vxlan |   vlan_vnid  = packet_vlan.provisioning_vlan.vxlan | ||||||
| } | } | ||||||
|  |  | ||||||
| # Attach VLAN to worker | # Attach VLAN to worker | ||||||
| resource "packet_port_vlan_attachment" "worker" { | resource "packet_port_vlan_attachment" "worker" { | ||||||
|   device_id = packet_device.tink-worker.id |   count      = var.worker_count | ||||||
|  |   depends_on = [packet_device_network_type.tink_worker_network_type] | ||||||
|  |  | ||||||
|  |   device_id = packet_device.tink_worker[count.index].id | ||||||
|   port_name = "eth0" |   port_name = "eth0" | ||||||
|   vlan_vnid = packet_vlan.provisioning-vlan.vxlan |   vlan_vnid = packet_vlan.provisioning_vlan.vxlan | ||||||
| } | } | ||||||
|  |  | ||||||
| output "provisioner_dns_name" { | data "template_file" "worker_hardware_data" { | ||||||
|   value = "${split("-", packet_device.tink-provisioner.id)[0]}.packethost.net" |   count    = var.worker_count | ||||||
|  |   template = file("${path.module}/hardware_data.tpl") | ||||||
|  |   vars = { | ||||||
|  |     id            = packet_device.tink_worker[count.index].id | ||||||
|  |     facility_code = packet_device.tink_worker[count.index].deployed_facility | ||||||
|  |     plan_slug     = packet_device.tink_worker[count.index].plan | ||||||
|  |     address       = "192.168.1.${count.index + 5}" | ||||||
|  |     mac           = packet_device.tink_worker[count.index].ports[1].mac | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| output "provisioner_ip" { | resource "null_resource" "hardware_data" { | ||||||
|   value = "${packet_device.tink-provisioner.network[0].address}" |   count      = var.worker_count | ||||||
|  |   depends_on = [null_resource.tink_directory] | ||||||
|  |  | ||||||
|  |   connection { | ||||||
|  |     type = "ssh" | ||||||
|  |     user = var.ssh_user | ||||||
|  |     host = packet_device.tink_provisioner.network[0].address | ||||||
|   } |   } | ||||||
|  |  | ||||||
| output "worker_mac_addr" { |   provisioner "file" { | ||||||
|   value = "${packet_device.tink-worker.ports[1].mac}" |     content     = data.template_file.worker_hardware_data[count.index].rendered | ||||||
|  |     destination = "/root/tink/deploy/hardware-data-${count.index}.json" | ||||||
|  |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,66 +0,0 @@ | |||||||
| #!/usr/bin/env bash |  | ||||||
|  |  | ||||||
| YUM="yum" |  | ||||||
| APT="apt" |  | ||||||
| PIP3="pip3" |  | ||||||
| YUM_CONFIG_MGR="yum-config-manager" |  | ||||||
| WHICH_YUM=$(command -v $YUM) |  | ||||||
| WHICH_APT=$(command -v $APT) |  | ||||||
| YUM_INSTALL="$YUM install" |  | ||||||
| APT_INSTALL="$APT install" |  | ||||||
| PIP3_INSTALL="$PIP3 install" |  | ||||||
| declare -a YUM_LIST=("https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm" |  | ||||||
| 	"docker-ce" |  | ||||||
| 	"docker-ce-cli" |  | ||||||
| 	"epel-release" |  | ||||||
| 	"pass" |  | ||||||
| 	"python3") |  | ||||||
| declare -a APT_LIST=("docker" |  | ||||||
| 	"docker-compose" "pass") |  | ||||||
|  |  | ||||||
| add_yum_repo() ( |  | ||||||
| 	$YUM_CONFIG_MGR --add-repo https://download.docker.com/linux/centos/docker-ce.repo |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| update_yum() ( |  | ||||||
| 	$YUM_INSTALL -y yum-utils |  | ||||||
| 	add_yum_repo |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| update_apt() ( |  | ||||||
| 	$APT update |  | ||||||
| 	DEBIAN_FRONTEND=noninteractive $APT --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| restart_docker_service() ( |  | ||||||
| 	service docker restart |  | ||||||
| ) |  | ||||||
| install_yum_packages() ( |  | ||||||
| 	$YUM_INSTALL "${YUM_LIST[@]}" -y |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| install_pip3_packages() ( |  | ||||||
| 	$PIP3_INSTALL docker-compose |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| install_apt_packages() ( |  | ||||||
| 	$APT_INSTALL "${APT_LIST[@]}" -y |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| main() ( |  | ||||||
| 	if [[ -n $WHICH_YUM ]]; then |  | ||||||
| 		update_yum |  | ||||||
| 		install_yum_packages |  | ||||||
| 		install_pip3_packages |  | ||||||
| 		restart_docker_service |  | ||||||
| 	elif [[ -n $WHICH_APT ]]; then |  | ||||||
| 		update_apt |  | ||||||
| 		install_apt_packages |  | ||||||
| 		restart_docker_service |  | ||||||
| 	else |  | ||||||
| 		echo "Unknown platform. Error while installing the required packages" |  | ||||||
| 		exit 1 |  | ||||||
| 	fi |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| main |  | ||||||
| @@ -1,141 +0,0 @@ | |||||||
| # Configure the Packet Provider. |  | ||||||
| terraform { |  | ||||||
|   required_providers { |  | ||||||
|     packet = { |  | ||||||
|       source  = "packethost/packet" |  | ||||||
|       version = "~> 3.0.1" |  | ||||||
|     } |  | ||||||
|     null = { |  | ||||||
|       source = "hashicorp/null" |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| provider "packet" { |  | ||||||
|   auth_token = var.packet_api_token |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # Create a new VLAN in datacenter "ewr1" |  | ||||||
| resource "packet_vlan" "provisioning_vlan" { |  | ||||||
|   description = "provisioning_vlan" |  | ||||||
|   facility    = var.facility |  | ||||||
|   project_id  = var.project_id |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # Create a device and add it to tf_project_1 |  | ||||||
| resource "packet_device" "tink_provisioner" { |  | ||||||
|   hostname         = "tink-provisioner" |  | ||||||
|   plan             = var.device_type |  | ||||||
|   facilities       = [var.facility] |  | ||||||
|   operating_system = "ubuntu_18_04" |  | ||||||
|   billing_cycle    = "hourly" |  | ||||||
|   project_id       = var.project_id |  | ||||||
|   user_data        = file("install_package.sh") |  | ||||||
| } |  | ||||||
|  |  | ||||||
| resource "null_resource" "tink_directory" { |  | ||||||
|   connection { |  | ||||||
|     type = "ssh" |  | ||||||
|     user = var.ssh_user |  | ||||||
|     host = packet_device.tink_provisioner.network[0].address |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   provisioner "remote-exec" { |  | ||||||
|     inline = [ |  | ||||||
|       "mkdir -p /root/tink/deploy" |  | ||||||
|     ] |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   provisioner "file" { |  | ||||||
|     source      = "../../setup.sh" |  | ||||||
|     destination = "/root/tink/setup.sh" |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   provisioner "file" { |  | ||||||
|     source      = "../../generate-envrc.sh" |  | ||||||
|     destination = "/root/tink/generate-envrc.sh" |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   provisioner "file" { |  | ||||||
|     source      = "../../deploy" |  | ||||||
|     destination = "/root/tink" |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   provisioner "remote-exec" { |  | ||||||
|     inline = [ |  | ||||||
|       "chmod +x /root/tink/*.sh /root/tink/deploy/tls/*.sh" |  | ||||||
|     ] |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| resource "packet_device_network_type" "tink_provisioner_network_type" { |  | ||||||
|   device_id = packet_device.tink_provisioner.id |  | ||||||
|   type      = "hybrid" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # Create a device and add it to tf_project_1 |  | ||||||
| resource "packet_device" "tink_worker" { |  | ||||||
|   count = var.worker_count |  | ||||||
|  |  | ||||||
|   hostname         = "tink-worker-${count.index}" |  | ||||||
|   plan             = var.device_type |  | ||||||
|   facilities       = [var.facility] |  | ||||||
|   operating_system = "custom_ipxe" |  | ||||||
|   ipxe_script_url  = "https://boot.netboot.xyz" |  | ||||||
|   always_pxe       = "true" |  | ||||||
|   billing_cycle    = "hourly" |  | ||||||
|   project_id       = var.project_id |  | ||||||
| } |  | ||||||
|  |  | ||||||
| resource "packet_device_network_type" "tink_worker_network_type" { |  | ||||||
|   count = var.worker_count |  | ||||||
|  |  | ||||||
|   device_id = packet_device.tink_worker[count.index].id |  | ||||||
|   type      = "layer2-individual" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # Attach VLAN to provisioner |  | ||||||
| resource "packet_port_vlan_attachment" "provisioner" { |  | ||||||
|   depends_on = [packet_device_network_type.tink_provisioner_network_type] |  | ||||||
|   device_id  = packet_device.tink_provisioner.id |  | ||||||
|   port_name  = "eth1" |  | ||||||
|   vlan_vnid  = packet_vlan.provisioning_vlan.vxlan |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # Attach VLAN to worker |  | ||||||
| resource "packet_port_vlan_attachment" "worker" { |  | ||||||
|   count      = var.worker_count |  | ||||||
|   depends_on = [packet_device_network_type.tink_worker_network_type] |  | ||||||
|  |  | ||||||
|   device_id = packet_device.tink_worker[count.index].id |  | ||||||
|   port_name = "eth0" |  | ||||||
|   vlan_vnid = packet_vlan.provisioning_vlan.vxlan |  | ||||||
| } |  | ||||||
|  |  | ||||||
| data "template_file" "worker_hardware_data" { |  | ||||||
|   count    = var.worker_count |  | ||||||
|   template = file("${path.module}/hardware_data.tpl") |  | ||||||
|   vars = { |  | ||||||
|     id            = packet_device.tink_worker[count.index].id |  | ||||||
|     facility_code = packet_device.tink_worker[count.index].deployed_facility |  | ||||||
|     plan_slug     = packet_device.tink_worker[count.index].plan |  | ||||||
|     address       = "192.168.1.${count.index + 5}" |  | ||||||
|     mac           = packet_device.tink_worker[count.index].ports[1].mac |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| resource "null_resource" "hardware_data" { |  | ||||||
|   count      = var.worker_count |  | ||||||
|   depends_on = [null_resource.tink_directory] |  | ||||||
|  |  | ||||||
|   connection { |  | ||||||
|     type = "ssh" |  | ||||||
|     user = var.ssh_user |  | ||||||
|     host = packet_device.tink_provisioner.network[0].address |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   provisioner "file" { |  | ||||||
|     content     = data.template_file.worker_hardware_data[count.index].rendered |  | ||||||
|     destination = "/root/tink/deploy/hardware-data-${count.index}.json" |  | ||||||
|   } |  | ||||||
| } |  | ||||||
							
								
								
									
										14
									
								
								deploy/vagrant/Vagrantfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								deploy/vagrant/Vagrantfile
									
									
									
									
										vendored
									
									
								
							| @@ -1,9 +1,15 @@ | |||||||
| ENV['VAGRANT_NO_PARALLEL'] = 'yes' | ENV['VAGRANT_NO_PARALLEL'] = 'yes' | ||||||
|  |  | ||||||
| # Returns true if `GUI` environment variable is set to a non-empty value. | # Returns true if `GUI` environment variable exists, value does not matter. | ||||||
| # Defaults to false | # Defaults to false | ||||||
| def worker_gui_enabled? | def worker_gui_enabled? | ||||||
|   ENV.fetch('VAGRANT_WORKER_GUI', '').empty? |   ENV.include?('VAGRANT_WORKER_GUI') | ||||||
|  | end | ||||||
|  |  | ||||||
|  | # Returns true if `SCALE` environment variable exists, value does not matter. | ||||||
|  | # Defaults to false | ||||||
|  | def worker_display_scale_enabled? | ||||||
|  |   ENV.include?('VAGRANT_WORKER_SCALE') | ||||||
| end | end | ||||||
|  |  | ||||||
| Vagrant.configure('2') do |config| | Vagrant.configure('2') do |config| | ||||||
| @@ -57,6 +63,10 @@ Vagrant.configure('2') do |config| | |||||||
|       vb.memory = 4*1024 |       vb.memory = 4*1024 | ||||||
|       vb.cpus = 1 |       vb.cpus = 1 | ||||||
|       vb.gui = worker_gui_enabled? |       vb.gui = worker_gui_enabled? | ||||||
|  |       vb.customize [ | ||||||
|  |         'setextradata', :id, | ||||||
|  |         'GUI/ScaleFactor', '3.0' | ||||||
|  |       ] if worker_display_scale_enabled? | ||||||
|       vb.customize [ |       vb.customize [ | ||||||
|         'modifyvm', :id, |         'modifyvm', :id, | ||||||
|         '--nic1', 'none', |         '--nic1', 'none', | ||||||
|   | |||||||
| @@ -80,12 +80,12 @@ main() ( | |||||||
| 		sudo apt-get install -y jq | 		sudo apt-get install -y jq | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	if [ ! -f ./envrc ]; then | 	if [ ! -f ./.env ]; then | ||||||
| 		./generate-envrc.sh eth1 >envrc | 		./generate-envrc.sh eth1 > .env | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	# shellcheck disable=SC1091 | 	# shellcheck disable=SC1091 | ||||||
| 	. ./envrc | 	. ./.env | ||||||
|  |  | ||||||
| 	make_certs_writable | 	make_certs_writable | ||||||
|  |  | ||||||
|   | |||||||
| @@ -52,6 +52,15 @@ generate_envrc() ( | |||||||
| 	local registry_password | 	local registry_password | ||||||
| 	registry_password=$(generate_password) | 	registry_password=$(generate_password) | ||||||
| 	cat <<EOF | 	cat <<EOF | ||||||
|  | # Tinkerbell Stack version | ||||||
|  |  | ||||||
|  | export OSIE_DOWNLOAD_LINK=https://tinkerbell-oss.s3.amazonaws.com/osie-uploads/osie-v0-n=252,c=bc454bc,b=master.tar.gz | ||||||
|  | export TINKERBELL_TINK_SERVER_IMAGE=quay.io/tinkerbell/tink:sha-adb49da | ||||||
|  | export TINKERBELL_TINK_CLI_IMAGE=quay.io/tinkerbell/tink-cli:sha-adb49da | ||||||
|  | export TINKERBELL_TINK_BOOTS_IMAGE=quay.io/tinkerbell/boots:327-58ab49913b5498908b16e2607d265a61a05f73b6 | ||||||
|  | export TINKERBELL_TINK_HEGEL_IMAGE=quay.io/tinkerbell/hegel:196-fa897aa020769db8becb9be29adaeb6be92a7fc7 | ||||||
|  | export TINKERBELL_TINK_WORKER_IMAGE=quay.io/tinkerbell/tink-worker:sha-adb49da | ||||||
|  |  | ||||||
| # Network interface for Tinkerbell's network | # Network interface for Tinkerbell's network | ||||||
| export TINKERBELL_NETWORK_INTERFACE="$tink_interface" | export TINKERBELL_NETWORK_INTERFACE="$tink_interface" | ||||||
|  |  | ||||||
| @@ -82,14 +91,12 @@ export TINKERBELL_REGISTRY_PASSWORD="$registry_password" | |||||||
| export FACILITY=onprem | export FACILITY=onprem | ||||||
| export ROLLBAR_TOKEN=ignored | export ROLLBAR_TOKEN=ignored | ||||||
| export ROLLBAR_DISABLE=1 | export ROLLBAR_DISABLE=1 | ||||||
|  |  | ||||||
| export OSIE_DOWNLOAD_LINK=https://tinkerbell-oss.s3.amazonaws.com/osie-uploads/osie-v0-n=252,c=bc454bc,b=master.tar.gz |  | ||||||
| EOF | EOF | ||||||
| ) | ) | ||||||
|  |  | ||||||
| main() ( | main() ( | ||||||
| 	if [ -z "${1:-}" ]; then | 	if [ -z "${1:-}" ]; then | ||||||
| 		err "Usage: $0 network-interface-name > envrc" | 		err "Usage: $0 network-interface-name > .env" | ||||||
| 		exit 1 | 		exit 1 | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								setup.sh
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								setup.sh
									
									
									
									
									
								
							| @@ -8,7 +8,7 @@ set -eu | |||||||
| # See https://tinkerbell.org/setup for the installation steps. | # See https://tinkerbell.org/setup for the installation steps. | ||||||
|  |  | ||||||
| # file to hold all environment variables | # file to hold all environment variables | ||||||
| ENV_FILE=envrc | ENV_FILE=.env | ||||||
|  |  | ||||||
| SCRATCH=$(mktemp -d -t tmp.XXXXXXXXXX) | SCRATCH=$(mktemp -d -t tmp.XXXXXXXXXX) | ||||||
| readonly SCRATCH | readonly SCRATCH | ||||||
| @@ -407,7 +407,7 @@ bootstrap_docker_registry() ( | |||||||
|  |  | ||||||
|     # osie looks for tink-worker:latest, so we have to play with it a bit |     # osie looks for tink-worker:latest, so we have to play with it a bit | ||||||
|     # https://github.com/tinkerbell/osie/blob/master/apps/workflow-helper.sh#L66 |     # https://github.com/tinkerbell/osie/blob/master/apps/workflow-helper.sh#L66 | ||||||
| 	docker_mirror_image "quay.io/tinkerbell/tink-worker:sha-adb49da" "${TINKERBELL_HOST_IP}/tink-worker:latest" | 	docker_mirror_image "${TINKERBELL_TINK_WORKER_IMAGE}" "${TINKERBELL_HOST_IP}/tink-worker:latest" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| setup_docker_registry() ( | setup_docker_registry() ( | ||||||
| @@ -482,7 +482,7 @@ check_prerequisites() ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| whats_next() ( | whats_next() ( | ||||||
| 	echo "$NEXT  1. Enter /vagrant/deploy and run: source ../envrc; docker-compose up -d" | 	echo "$NEXT  1. Enter /vagrant/deploy and run: source ../.env; docker-compose up -d" | ||||||
| 	echo "$BLANK 2. Try executing your fist workflow." | 	echo "$BLANK 2. Try executing your fist workflow." | ||||||
| 	echo "$BLANK    Follow the steps described in https://tinkerbell.org/examples/hello-world/ to say 'Hello World!' with a workflow." | 	echo "$BLANK    Follow the steps described in https://tinkerbell.org/examples/hello-world/ to say 'Hello World!' with a workflow." | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ func TestVagrantSetupGuide(t *testing.T) { | |||||||
| 		} | 		} | ||||||
| 	}() | 	}() | ||||||
|  |  | ||||||
| 	_, err = machine.Exec(ctx, "cd /vagrant/deploy && source ../envrc && docker-compose up -d") | 	_, err = machine.Exec(ctx, "cd /vagrant/deploy && source ../.env && docker-compose up -d") | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		t.Fatal(err) | 		t.Fatal(err) | ||||||
| 	} | 	} | ||||||
| @@ -95,7 +95,6 @@ func TestVagrantSetupGuide(t *testing.T) { | |||||||
|  |  | ||||||
| 	t.Logf("WorkflowID: %s", workflowID) | 	t.Logf("WorkflowID: %s", workflowID) | ||||||
|  |  | ||||||
| 	os.Setenv("VAGRANT_WORKER_GUI", "false") |  | ||||||
| 	worker, err := vagrant.Up(ctx, | 	worker, err := vagrant.Up(ctx, | ||||||
| 		vagrant.WithLogger(t.Logf), | 		vagrant.WithLogger(t.Logf), | ||||||
| 		vagrant.WithMachineName("worker"), | 		vagrant.WithMachineName("worker"), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user