Skip to content

Commit

Permalink
Merge branch 'premaster'
Browse files Browse the repository at this point in the history
  • Loading branch information
mfthomps committed Jan 26, 2023
2 parents f9d04dc + 1fa5222 commit a32555a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ The installation script and the update-designer.sh script set environment variab
so you may want to logout/login, or start a new bash shell before using Labtainers the
first time.

January 4, 2022
January 26, 2023
- Modified powershell scripts for gcloud to use the selected zone to qualify VM names.
January 4, 2023
- Containers using systemd were failing on newer systemd present in Ubuntu 22
- Add --zone parameter to google cloud scripts, with value derived from the set\_defaults script.
December 21, 2022
Expand Down
2 changes: 1 addition & 1 deletion google/checktunnel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if ($ip -eq "FAIL"){
echo "Failed to get ip of $vm"
exit 1
}
$result=netstat -an | findstr 6901
$result=netstat -an | Select-String -pattern "6901"
If ($result -eq $null){
echo "No tunnel, create one."
$fname=$HOME+"\.ssh\id_labtainers"
Expand Down
6 changes: 4 additions & 2 deletions google/create_vm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ If ($args.Count -ne 1){
$ErrorActionPreference = "Stop"
$user_id=$args[0]
$vm_name=$user_id+"-labtainervm"
gcloud compute instances create $vm_name --image=https://www.googleapis.com/compute/v1/projects/labtainers/global/images/labtainervm `
$zone=$(./findzone.sh)
gcloud compute instances create $vm_name --image=https://www.googleapis.com/compute/v1/projects/labtainers/global/images/labtainervm5 `
--metadata-from-file=user-data=user_config.txt
gcloud compute disks resize $vm_name --size 30G --zone=$zone -q
# instances fail ssh until settled
#
./waitup.ps1 $user_id 2>$null
echo "Check keys"
gcloud compute ssh labtainer@$vm_name --command="echo VM booted" -- --strict-host-key-checking=no
gcloud compute ssh labtainer@$vm_name --command="echo VM booted" --strict-host-key-checking=no
#gcloud compute ssh labtainer@$vm_name --dry-run
echo "Back from ssh"
cp $HOME/.ssh/google_compute_engine $HOME/.ssh/id_labtainers
Expand Down
3 changes: 2 additions & 1 deletion google/delete_vm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ If ($args.Count -ne 1){
}
$user=$args[0]
$vm=$user+"-labtainervm"
gcloud -q compute instances delete $vm
$zone=$(./findzone.sh)
gcloud -q compute instances delete $vm --zone=$zone
echo "VM $vm has been deleted"
3 changes: 3 additions & 0 deletions google/findzone.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$c = (Select-String -Path "set_defaults.ps1" -Pattern "zone")
$w = ($c -split "=")
echo $w[2]
3 changes: 2 additions & 1 deletion google/getip.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
$vm=$args[0]
$result=gcloud compute instances describe $vm --format='get(networkInterfaces[0].accessConfigs[0].natIP)'
$zone=$(./findzone.sh)
$result=gcloud compute instances describe $vm --format='get(networkInterfaces[0].accessConfigs[0].natIP)' --zone=$zone
If ($result -eq $null){
echo "FAIL"
}else{
Expand Down
3 changes: 2 additions & 1 deletion google/start_vm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ If ($args.Count -ne 1){
}
$user=$args[0]
$vm=$user+"-labtainervm"
gcloud -q compute instances start $vm
$zone=$(./findzone.sh)
gcloud -q compute instances start $vm --zone=$zone
./waitup.ps1 $user
./waitdone.ps1 $user
3 changes: 2 additions & 1 deletion google/stop_vm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ If ($args.Count -ne 1){
}
$user=$args[0]
$vm=$user+"-labtainervm"
gcloud -q compute instances stop $vm
$zone=$(./findzone.sh)
gcloud -q compute instances stop $vm --zone=$zone

0 comments on commit a32555a

Please sign in to comment.