diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 1105988..d52b01d 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,9 @@ { "recommendations": [ "ms-azuretools.vscode-bicep", - "ms-vscode.powershell" + "ms-vscode.powershell", + "github.vscode-github-actions", + "github.vscode-pull-request-github", + "esbenp.prettier-vscode" ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..746d86f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "editor.tabSize": 2, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": [ + "source.fixAll", + "source.organizeImports", + "source.sortMembers" + ], + "editor.defaultFormatter": "esbenp.prettier-vscode" +} diff --git a/linux-scripts/README.md b/linux-scripts/README.md new file mode 100644 index 0000000..64593e9 --- /dev/null +++ b/linux-scripts/README.md @@ -0,0 +1,4 @@ +# linux-scripts + +This folder contains scripts for remote execution on a Linux virtual machine +to update and configure the operating system. diff --git a/linux-scripts/core/README.md b/linux-scripts/core/README.md new file mode 100644 index 0000000..c5a5926 --- /dev/null +++ b/linux-scripts/core/README.md @@ -0,0 +1,4 @@ +# core + +Scripts in this folder perform core operating system configuration on a +remote Linux virtual machine. diff --git a/linux-scripts/clean-up.sh b/linux-scripts/core/clean-up.sh similarity index 100% rename from linux-scripts/clean-up.sh rename to linux-scripts/core/clean-up.sh diff --git a/linux-scripts/setup-firewall.sh b/linux-scripts/core/setup-firewall.sh similarity index 100% rename from linux-scripts/setup-firewall.sh rename to linux-scripts/core/setup-firewall.sh diff --git a/linux-scripts/setup-motd.sh b/linux-scripts/core/setup-motd.sh similarity index 100% rename from linux-scripts/setup-motd.sh rename to linux-scripts/core/setup-motd.sh diff --git a/linux-scripts/setup-node-and-yarn.sh b/linux-scripts/core/setup-node-and-yarn.sh similarity index 100% rename from linux-scripts/setup-node-and-yarn.sh rename to linux-scripts/core/setup-node-and-yarn.sh diff --git a/linux-scripts/update-base-packages.sh b/linux-scripts/core/update-base-packages.sh similarity index 100% rename from linux-scripts/update-base-packages.sh rename to linux-scripts/core/update-base-packages.sh diff --git a/linux-scripts/spot/README.md b/linux-scripts/spot/README.md new file mode 100644 index 0000000..a47d99e --- /dev/null +++ b/linux-scripts/spot/README.md @@ -0,0 +1,5 @@ +# spot + +Scripts in this folder perform configuration of features that allow +graceful shutdown of a spot instance Linux server following an eviction +from Azure. diff --git a/linux-scripts/setup-eviction-shutdown-system.sh b/linux-scripts/spot/setup-eviction-shutdown-system.sh similarity index 100% rename from linux-scripts/setup-eviction-shutdown-system.sh rename to linux-scripts/spot/setup-eviction-shutdown-system.sh diff --git a/linux-scripts/setup-sms-notifier.sh b/linux-scripts/spot/setup-sms-notifier.sh similarity index 100% rename from linux-scripts/setup-sms-notifier.sh rename to linux-scripts/spot/setup-sms-notifier.sh diff --git a/linux-scripts/update-notifier-config.sh b/linux-scripts/spot/update-notifier-config.sh similarity index 100% rename from linux-scripts/update-notifier-config.sh rename to linux-scripts/spot/update-notifier-config.sh diff --git a/scripts/create-linux-server.sh b/scripts/create-linux-server.sh index a4d3292..80838c6 100755 --- a/scripts/create-linux-server.sh +++ b/scripts/create-linux-server.sh @@ -250,14 +250,6 @@ scp-notifier-config () { else echo "WARN: Manual installation of notifier config will be required."; fi -} - -restart-vm () { - echo "Restarting VM to allow settings to take effect..."; - - az vm restart \ - -g $RESOURCE_GROUP \ - -n $SERVER_NAME; echo "---"; echo; @@ -281,24 +273,25 @@ main () { login-to-admin-acct; # copy setup scripts to server - scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/update-base-packages.sh; - scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/setup-firewall.sh; - scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/setup-motd.sh; - scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/setup-node-and-yarn.sh; - scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/setup-sms-notifier.sh; - scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/setup-eviction-shutdown-system.sh; - scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/update-notifier-config.sh; - scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/clean-up.sh; + scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/core/update-base-packages.sh; + scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/core/setup-firewall.sh; + scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/core/setup-motd.sh; + scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/core/setup-node-and-yarn.sh; + scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/spot/setup-sms-notifier.sh; + scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/spot/setup-eviction-shutdown-system.sh; + scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/spot/update-notifier-config.sh; + scp-file-to-admin-home ${CURRENT_SCRIPT_DIR}../linux-scripts/core/clean-up.sh; # execute remote setup scripts + echo "Executing base platform setup scripts..."; run-script-from-admin-home update-base-packages.sh; run-script-from-admin-home setup-firewall.sh; run-script-from-admin-home setup-motd.sh; run-script-from-admin-home setup-node-and-yarn.sh; - if [ "$IS_SPOT" = "true" ] then + echo "Executing spot instance setup scripts..."; run-script-from-admin-home setup-sms-notifier.sh; scp-notifier-config; run-script-from-admin-home setup-eviction-shutdown-system.sh;