From 2d20a11391a829436063e0955a0ed12eca8e813c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1tvik=20Karanam?= <89281036+skara9@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:15:30 -0400 Subject: [PATCH 1/9] new worker vm instructions --- _docs/developer/getting_started/worker_vm.md | 42 ++++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index 978491b5..b939ab99 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -11,36 +11,36 @@ machines* in addition to your primary vagrant virtual machine. ## Automated Worker Installation -These steps will create a worker machine alongside the normal Submitty machine. -1. Make sure to destroy any existing vagrant machines with -``` -vagrant destroy -``` - -2. Ensure you have [Python 3](https://www.python.org/downloads/) installed on your machine - -3. Generate configuration for the desired number of worker machines +1. Make sure to destroy any existing worker machines before generating a new worker configuration. + Failure to do this could result in 'hidden' worker machines from the previous configuration + still running on your computer, taking up disk space and resources. ``` - python3 generate_workers.py [-n NUM] [--ip-range IP_RANGE] [--base-port PORT] + vagrant workers destroy ``` - This will create or update a configuration file stored at `.vagrant/workers.json`. - Now you can create the virtual machines with: + +2. Ensure you have [Python 3](https://www.python.org/downloads/) installed on your machine. + `python3 --version` + +3. Generate configuration for the worker machine(s). ``` - vagrant up + vagrant workers generate ``` + For multiple workers, use the `-n` flag. (ex. `-n 3` for 3 machines). - If you happen to encounter error messages regarding IP addresses or port conflicts, you can manually edit the `workers.json` file as needed. - - __NOTE__: Do not edit the `workers.json` configuration file or run the aforementioned python script if there are any existing vagrant machines in your project. This can result in the existing VMs continuing to run in the background or storing their data with no clean way to remove them. + If using a provider other than the default for your system, use the `--provider` flag. + (ex. `--provider parallels`) -4. To delete the worker machines and revert to a normal development setup, you can first run +4. If you are on MacOS running QEMU, make sure to restart the network socket. ``` - vagrant destroy + vagrant workers socket restart ``` - And confirm to delete all the existing virtual machines. + If the VM runs into errors when attempting to reach the internet, try starting the socket + in public mode. (`--public`) - Next, you can delete the `workers.json` file, which will remove the worker configuration from your project. - The next `vagrant up` should only create the primary development virtual machine without any workers. +5. Now you can provision the virtual machines with: + ``` + vagrant workers up + ``` --- From ae4a6a9543d8a98d099f6f08b194f9697764ab5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1tvik=20Karanam?= <89281036+skara9@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:44:45 -0400 Subject: [PATCH 2/9] Update worker_vm.md --- _docs/developer/getting_started/worker_vm.md | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index b939ab99..da3a91d0 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -27,20 +27,28 @@ machines* in addition to your primary vagrant virtual machine. ``` For multiple workers, use the `-n` flag. (ex. `-n 3` for 3 machines). + This command will generate workers for `virtualbox`, or `qemu` if you are on M-series macOS. If using a provider other than the default for your system, use the `--provider` flag. - (ex. `--provider parallels`) + (ex. `--provider my-custom-provider`) -4. If you are on MacOS running QEMU, make sure to restart the network socket. +5. If you are on MacOS running QEMU, make sure to restart the network socket. ``` vagrant workers socket restart ``` If the VM runs into errors when attempting to reach the internet, try starting the socket - in public mode. (`--public`) + in public mode. (`vagrant workers socket restart --public`) -5. Now you can provision the virtual machines with: +6. Now you can create the worker machine(s) with: ``` vagrant workers up ``` + Do not use the --provider flag with this command, since it will conflict with the + provider generated in step 3. + +7. Once all the workers are fully set up and running, `vagrant ssh` into the main VM and run: + ``` + refresh_vagrant_workers + ``` --- @@ -50,14 +58,15 @@ If you would like to ensure the worker is functioning properly, or enter the wor To connect to a worker machine through SSH, run: ``` -vagrant ssh +vagrant workers ssh ``` If you want to test the connection between the primary VM and a worker, you can first `vagrant ssh` into the primary machine and then run this command to SSH into the worker from there: ``` -su submitty_daemon -c ssh submitty@ +su submitty_daemon -c ssh ``` -The IP address of the worker machine will be indicated in the `.vagrant/workers.json` file. + +The list of worker names can be displayed with `vagrant workers status`. __NOTE__: Depending on the performance of your computer and the size of the autograding queue passed to the worker, the SSH command may hang for some time. From 5b68001a7493bf35b1ec82033ff883bfc0086a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1tvik=20Karanam?= <89281036+skara9@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:18:42 -0400 Subject: [PATCH 3/9] Update worker_vm.md --- _docs/developer/getting_started/worker_vm.md | 25 +++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index da3a91d0..9a003759 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -11,41 +11,34 @@ machines* in addition to your primary vagrant virtual machine. ## Automated Worker Installation -1. Make sure to destroy any existing worker machines before generating a new worker configuration. - Failure to do this could result in 'hidden' worker machines from the previous configuration - still running on your computer, taking up disk space and resources. - ``` - vagrant workers destroy - ``` +These instructions are intended to be followed after [configuring the main virtual machine](/developer/getting_started/vm_install_using_vagrant). -2. Ensure you have [Python 3](https://www.python.org/downloads/) installed on your machine. +1. Ensure you have [Python 3](https://www.python.org/downloads/) installed on your machine. `python3 --version` -3. Generate configuration for the worker machine(s). +2. Generate configuration for the worker machine(s). ``` vagrant workers generate ``` - For multiple workers, use the `-n` flag. (ex. `-n 3` for 3 machines). - - This command will generate workers for `virtualbox`, or `qemu` if you are on M-series macOS. - If using a provider other than the default for your system, use the `--provider` flag. - (ex. `--provider my-custom-provider`) + For multiple workers, append the `-n` flag. (ex. `-n 3` for 3 machines). -5. If you are on MacOS running QEMU, make sure to restart the network socket. +3. If you are on MacOS running QEMU, make sure to restart the network socket. ``` vagrant workers socket restart ``` If the VM runs into errors when attempting to reach the internet, try starting the socket in public mode. (`vagrant workers socket restart --public`) + + __NOTE__: Never interact with the socket while a worker machine is running. This can make the machine inaccessible. 6. Now you can create the worker machine(s) with: ``` vagrant workers up ``` Do not use the --provider flag with this command, since it will conflict with the - provider generated in step 3. + provider of the main virtual machine. -7. Once all the workers are fully set up and running, `vagrant ssh` into the main VM and run: +7. Once all the workers are fully set up and running, `vagrant ssh` into the main virtual machine and run: ``` refresh_vagrant_workers ``` From fbc0313c56b682c0cc2e55f1cedc17f1ed269310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1tvik=20Karanam?= <89281036+skara9@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:36:13 -0400 Subject: [PATCH 4/9] remove refresh workers command --- _docs/developer/getting_started/worker_vm.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index 9a003759..4165509c 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -38,11 +38,7 @@ These instructions are intended to be followed after [configuring the main virtu Do not use the --provider flag with this command, since it will conflict with the provider of the main virtual machine. -7. Once all the workers are fully set up and running, `vagrant ssh` into the main virtual machine and run: - ``` - refresh_vagrant_workers - ``` - +7. Once all the workers are fully set up and running, `vagrant ssh` into the main virtual machine and do a `submitty_install` --- ## Connecting to the Worker Machine From 4479ad3aa490f102f7d2819b78f78acbe145919a Mon Sep 17 00:00:00 2001 From: Barb Cutler Date: Thu, 15 Aug 2024 23:27:47 -0400 Subject: [PATCH 5/9] formatting typo in docs --- Gemfile.lock | 1 + _docs/developer/getting_started/worker_vm.md | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 47e66c36..8b6e7530 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -277,6 +277,7 @@ GEM PLATFORMS arm64-darwin-22 + arm64-darwin-23 x86_64-linux DEPENDENCIES diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index 4165509c..149b66be 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -31,14 +31,15 @@ These instructions are intended to be followed after [configuring the main virtu __NOTE__: Never interact with the socket while a worker machine is running. This can make the machine inaccessible. -6. Now you can create the worker machine(s) with: +4. Now you can create the worker machine(s) with: ``` vagrant workers up ``` Do not use the --provider flag with this command, since it will conflict with the provider of the main virtual machine. -7. Once all the workers are fully set up and running, `vagrant ssh` into the main virtual machine and do a `submitty_install` +5. Once all the workers are fully set up and running, `vagrant ssh` into the main virtual machine and do a `submitty_install` + --- ## Connecting to the Worker Machine From 16fddb1181f314186cb24c6a11af07a98c668b7b Mon Sep 17 00:00:00 2001 From: Barb Cutler Date: Fri, 16 Aug 2024 13:23:52 -0400 Subject: [PATCH 6/9] in progress update worker instructions --- _docs/developer/getting_started/worker_vm.md | 65 +++++++++++++++----- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index 149b66be..e0868d23 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -11,34 +11,71 @@ machines* in addition to your primary vagrant virtual machine. ## Automated Worker Installation -These instructions are intended to be followed after [configuring the main virtual machine](/developer/getting_started/vm_install_using_vagrant). +1. First set up your main/primary machine by following the normal + [VM Install using Vagrant](/developer/getting_started/vm_install_using_vagrant) instructions. -1. Ensure you have [Python 3](https://www.python.org/downloads/) installed on your machine. - `python3 --version` +2. Ensure you have [Python 3](https://www.python.org/downloads/) installed on your machinem, run: + ``` + python3 --version + ``` -2. Generate configuration for the worker machine(s). +3. Generate configuration for the worker machine(s). ``` vagrant workers generate ``` + For multiple workers, append the `-n` flag. (ex. `-n 3` for 3 machines). + ``` + vagrant workers generate -n 3 + ``` + + _NOTE: This will create the vagrant configuration file: `.vagrant/workers.json`._ -3. If you are on MacOS running QEMU, make sure to restart the network socket. + +4. If you are on MacOS running QEMU, restart the network socket in public mode: ``` - vagrant workers socket restart + vagrant workers socket restart --public ``` - If the VM runs into errors when attempting to reach the internet, try starting the socket - in public mode. (`vagrant workers socket restart --public`) - - __NOTE__: Never interact with the socket while a worker machine is running. This can make the machine inaccessible. + _NOTE: Using the `--public` flag will make your worker VMs accessible to anyone + on your local network, which may be a modest security concern. + We suggest this to minimize possibility of errors while creating the + worker machines and will revert this in a later step._ + + __NOTE__: Never interact with the socket while a worker machine is running. + This can make the machine inaccessible. -4. Now you can create the worker machine(s) with: +5. Now you can create the worker machine(s) with: ``` vagrant workers up ``` - Do not use the --provider flag with this command, since it will conflict with the - provider of the main virtual machine. + _NOTE: Do not use the --provider flag with this command, since it will conflict with the + provider of the main virtual machine._ + + When this is finished, you should see the Submitty duck ASCII art for each new worker machine. + +6. Verify that all expected machines are running + ``` + vagrant global-status + ``` + + Which should print out a line for the primary machine, and an additional line for each worker machine: + + ``` + id name provider state directory + ------------------------------------------------------------------------------------ + abab893 ubuntu-22.04 qemu running /SOMETHING/GIT_CHECKOUT/Submitty + 0fe6810 worker-1 qemu running /SOMETHING/GIT_CHECKOUT/Submitty + ``` + + +7. Connect to the primary machine and complete the + + NOTE: This is mirroring the manual connection done on the production machine + + http://localhost:4000/sysadmin/installation/worker_installation + -5. Once all the workers are fully set up and running, `vagrant ssh` into the main virtual machine and do a `submitty_install` + `vagrant ssh` into the main virtual machine and do a `submitty_install` --- From 04d941ed13d7a4cd8089fecd0e470982a8cb4c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1tvik=20Karanam?= <89281036+skara9@users.noreply.github.com> Date: Fri, 16 Aug 2024 13:43:43 -0400 Subject: [PATCH 7/9] Update worker_vm.md --- _docs/developer/getting_started/worker_vm.md | 23 +++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index e0868d23..d8d920aa 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -53,30 +53,17 @@ machines* in addition to your primary vagrant virtual machine. When this is finished, you should see the Submitty duck ASCII art for each new worker machine. -6. Verify that all expected machines are running +6. You can verify that all the worker machines are running with: ``` - vagrant global-status + vagrant workers status ``` - Which should print out a line for the primary machine, and an additional line for each worker machine: - +7. `vagrant ssh` into the main virtual machine and run: ``` - id name provider state directory - ------------------------------------------------------------------------------------ - abab893 ubuntu-22.04 qemu running /SOMETHING/GIT_CHECKOUT/Submitty - 0fe6810 worker-1 qemu running /SOMETHING/GIT_CHECKOUT/Submitty + refresh_vagrant_workers # (runs python3 /usr/local/submitty/GIT_CHECKOUT/Submitty/.setup/bin/refresh_vagrant_workers.py) + submitty_install ``` - -7. Connect to the primary machine and complete the - - NOTE: This is mirroring the manual connection done on the production machine - - http://localhost:4000/sysadmin/installation/worker_installation - - - `vagrant ssh` into the main virtual machine and do a `submitty_install` - --- ## Connecting to the Worker Machine From 404e5152a26dc59ce42ca89f2361c9ae30be87e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1tvik=20Karanam?= <89281036+skara9@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:09:10 -0400 Subject: [PATCH 8/9] Update worker_vm.md --- _docs/developer/getting_started/worker_vm.md | 26 ++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index d8d920aa..69a8ae6c 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -19,12 +19,12 @@ machines* in addition to your primary vagrant virtual machine. python3 --version ``` -3. Generate configuration for the worker machine(s). +3. To generate configuration for a worker machine, run: ``` vagrant workers generate ``` - For multiple workers, append the `-n` flag. (ex. `-n 3` for 3 machines). + If instead you need multiple workers, append the `-n` flag, ex. for 3 machines: ``` vagrant workers generate -n 3 ``` @@ -41,10 +41,12 @@ machines* in addition to your primary vagrant virtual machine. We suggest this to minimize possibility of errors while creating the worker machines and will revert this in a later step._ - __NOTE__: Never interact with the socket while a worker machine is running. - This can make the machine inaccessible. + _NOTE: Running a socket command while a worker machine is running can detach the + process, making the VM inaccessible to vagrant. If this happens and you are unable + to `vagrant workers halt`, then you may run `pkill -15 -f qemu-system-` to halt + the worker machine._ -5. Now you can create the worker machine(s) with: +6. Now you can create the worker machine(s) with: ``` vagrant workers up ``` @@ -53,17 +55,27 @@ machines* in addition to your primary vagrant virtual machine. When this is finished, you should see the Submitty duck ASCII art for each new worker machine. -6. You can verify that all the worker machines are running with: +7. You can verify that all the worker machines are running with: ``` vagrant workers status ``` -7. `vagrant ssh` into the main virtual machine and run: +8. `vagrant ssh` into the main virtual machine and run: ``` refresh_vagrant_workers # (runs python3 /usr/local/submitty/GIT_CHECKOUT/Submitty/.setup/bin/refresh_vagrant_workers.py) submitty_install ``` +9. To stop the worker machines, you can run: + ``` + vagrant workers halt + vagrant workers socket stop + ``` + + _For MacOS QEMU users: Once the virtual machine(s) are halted, if you would like to restart under + private networking, you may do so by omitting the `--public` flag from the `vagrant workers socket start` command._ + + --- ## Connecting to the Worker Machine From 36eea65c4ccd9429825b46d22eadb4be0fb47f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1tvik=20Karanam?= <89281036+skara9@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:10:43 -0400 Subject: [PATCH 9/9] Update worker_vm.md --- _docs/developer/getting_started/worker_vm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_docs/developer/getting_started/worker_vm.md b/_docs/developer/getting_started/worker_vm.md index 69a8ae6c..165bdad2 100644 --- a/_docs/developer/getting_started/worker_vm.md +++ b/_docs/developer/getting_started/worker_vm.md @@ -43,8 +43,8 @@ machines* in addition to your primary vagrant virtual machine. _NOTE: Running a socket command while a worker machine is running can detach the process, making the VM inaccessible to vagrant. If this happens and you are unable - to `vagrant workers halt`, then you may run `pkill -15 -f qemu-system-` to halt - the worker machine._ + to `vagrant workers halt`, then you may run `pkill -15 -f qemu-system-` to kill + all virtual machines running on your computer (including the main Submitty VM)._ 6. Now you can create the worker machine(s) with: ```