From f99084e1956c566d2fa2dca6e5201a7eb1907dc5 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Mon, 29 Mar 2021 03:25:23 -0400 Subject: [PATCH 01/13] add troubleshooting --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index b9db300..87afe46 100644 --- a/README.md +++ b/README.md @@ -35,4 +35,14 @@ launch-coder launch-coder will not install or provision anything without your permission :) +## Troubleshooting + +On non-public Dev URLs: `An internal server error occurred`: + +- This is an error I get frequently with Dev URLs, GKE, and CloudFlare domains, and it always seems to go away. + - Re-create Dev URL + - Re create environment + - Wait patiently + - Last resort: Make Dev URL public + Questions? Join Slack [https://cdr.co/join-community](https://cdr.co/join-community) From 7147f95e729b9ebfc1f7ef9863ab45095f255c47 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Mon, 29 Mar 2021 03:25:38 -0400 Subject: [PATCH 02/13] fix formatting --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 87afe46..7e97edd 100644 --- a/README.md +++ b/README.md @@ -45,4 +45,6 @@ On non-public Dev URLs: `An internal server error occurred`: - Wait patiently - Last resort: Make Dev URL public +--- + Questions? Join Slack [https://cdr.co/join-community](https://cdr.co/join-community) From b475f6e386eca7201dd2599182bc25a0c65ebfae Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Mon, 29 Mar 2021 03:31:44 -0400 Subject: [PATCH 03/13] remove silly debug ending --- src/cli.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cli.js b/src/cli.js index 1c443d4..e3b0ff9 100644 --- a/src/cli.js +++ b/src/cli.js @@ -855,5 +855,4 @@ export async function cli(args) { // TODO: tell the user they can save this to a PRIVATE // repo in GIT (maybe idk if that is bad practice) - console.log("\n\nat the end with a long argv:", Object.keys(argv).length); } From 4ec2e7ab8e52c8f07e11fb7caac6e08dcebafd52 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Mon, 29 Mar 2021 09:43:05 -0400 Subject: [PATCH 04/13] add brand new account info --- README.md | 13 ++++++++++++- package.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7e97edd..91e0683 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ Preferred environment: Google Cloud Shell. It just works. No need to install: ```sh +# If you have never used GKE before: +gcloud services enable container.googleapis.com + # For a guided install: npx @bpmct/launch-coder @@ -37,7 +40,7 @@ launch-coder will not install or provision anything without your permission :) ## Troubleshooting -On non-public Dev URLs: `An internal server error occurred`: +On non-public Dev URLs: `An internal server error occurred`: - This is an error I get frequently with Dev URLs, GKE, and CloudFlare domains, and it always seems to go away. - Re-create Dev URL @@ -45,6 +48,14 @@ On non-public Dev URLs: `An internal server error occurred`: - Wait patiently - Last resort: Make Dev URL public +`Customer should enable service:container.googleapis.com before proceeding`: + +- This is for brand new acounts accounts, the script will handle this in the future. For now, enable by typing: + + ```sh + gcloud services enable container.googleapis.com + ``` + --- Questions? Join Slack [https://cdr.co/join-community](https://cdr.co/join-community) diff --git a/package.json b/package.json index 28ecdba..ceaefb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bpmct/launch-coder", - "version": "1.0.3", + "version": "1.0.4", "main": "src/index.js", "bin": { "launch-coder": "bin/launch-coder" From 325d44c9660fbd60f411d1233a7cb3f4b2a6f42b Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Mon, 29 Mar 2021 19:01:57 -0400 Subject: [PATCH 05/13] update warning --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91e0683..80d3374 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # launch-coder -⚠️: This was a hackathon project and is not recommended for production use or in sensative environments. +⚠️: This was a hackathon project and is not recommended for production deployments or in sensative environments. --- From 82ee65bf40109988cbe4f54a4f6d8669f25a4ce6 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Wed, 31 Mar 2021 16:53:07 -0400 Subject: [PATCH 06/13] add vs code settings --- .vscode/extensions.json | 5 +++++ .vscode/settings.json | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..0f148de --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "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..89d1965 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" +} \ No newline at end of file From 2d391267034f7985a1dcd36d133d8a885b87b0b3 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Wed, 31 Mar 2021 16:53:15 -0400 Subject: [PATCH 07/13] enable k8s service --- shell-helpers/googleCloudK8sEnabled.sh | 13 ++++++++ src/cli.js | 44 +++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100755 shell-helpers/googleCloudK8sEnabled.sh diff --git a/shell-helpers/googleCloudK8sEnabled.sh b/shell-helpers/googleCloudK8sEnabled.sh new file mode 100755 index 0000000..10b9957 --- /dev/null +++ b/shell-helpers/googleCloudK8sEnabled.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# thanks https://gist.github.com/pydevops/cffbd3c694d599c6ca18342d3625af97#0212-enable-service + + +SERVICE="container.googleapis.com" +if [[ $(gcloud services list --format="value(serviceConfig.name)" \ + --filter="serviceConfig.name:$SERVICE" 2>&1) != \ + "$SERVICE" ]]; then +echo "false" +else +echo "true" +fi diff --git a/src/cli.js b/src/cli.js index e3b0ff9..50e53e5 100644 --- a/src/cli.js +++ b/src/cli.js @@ -214,7 +214,10 @@ export async function cli(args) { // TODO: add better user education on what the prereqs are try { await runHelperScript("googleCloudPrereqs"); - console.log("✅", "You seem to have all the dependencies installed!"); + console.log( + "✅", + "You seem to have all the local dependencies installed!" + ); } catch (err) { console.log("❌", err.stderr); return; @@ -294,6 +297,45 @@ export async function cli(args) { } } + // check if the kubernetes service is enabled in google cloud + + const check_K8s = await runHelperScript("googleCloudK8sEnabled"); + + if (check_K8s && check_K8s != "true") { + if (!argv.skipConfirmPrompts) { + const runCommand = await inquirer.prompt({ + type: "confirm", + default: true, + name: "runIt", + message: + "Kubernetes (container.googleapis.com) is not enabled on this Google Cloud project. Enable?", + }); + + if (!runCommand.runIt) { + console.log( + `\n\nOk :) Kubernetes is required to run Coder. You can manually enable it here:\n`, + "\t👉 https://console.cloud.google.com/marketplace/product/google/container.googleapis.com\n" + ); + return; + } + } + + try { + console.log( + "⏳", + "Enabling the Kubernetes service for this project..." + ); + await execa("gcloud", [ + "services", + "enable", + "container.googleapis.com", + ]); + console.log("✅", "Enabled the Google Cloud Kubernetes service\n\n"); + } catch (err) { + console.log("❌", "Error enabling the Kubernetes service", err); + } + } + let gCloudCommand = generateGoogleClusterCommand(argv); // TODO: add info on what this cluster means From 279270371ae4c69b547787c8077fc771d05b8118 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Wed, 31 Mar 2021 19:46:29 -0400 Subject: [PATCH 08/13] remove k8s enable step --- README.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/README.md b/README.md index 80d3374..eaad82a 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,6 @@ Preferred environment: Google Cloud Shell. It just works. No need to install: ```sh -# If you have never used GKE before: -gcloud services enable container.googleapis.com - # For a guided install: npx @bpmct/launch-coder @@ -48,14 +45,6 @@ On non-public Dev URLs: `An internal server error occurred`: - Wait patiently - Last resort: Make Dev URL public -`Customer should enable service:container.googleapis.com before proceeding`: - -- This is for brand new acounts accounts, the script will handle this in the future. For now, enable by typing: - - ```sh - gcloud services enable container.googleapis.com - ``` - --- Questions? Join Slack [https://cdr.co/join-community](https://cdr.co/join-community) From f47a0a819f3fe9a157832a80a6d4f7250e28f0e8 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Wed, 31 Mar 2021 21:17:15 -0400 Subject: [PATCH 09/13] fix checker --- shell-helpers/googleCloudK8sEnabled.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell-helpers/googleCloudK8sEnabled.sh b/shell-helpers/googleCloudK8sEnabled.sh index 10b9957..4cd44c8 100755 --- a/shell-helpers/googleCloudK8sEnabled.sh +++ b/shell-helpers/googleCloudK8sEnabled.sh @@ -4,8 +4,8 @@ SERVICE="container.googleapis.com" -if [[ $(gcloud services list --format="value(serviceConfig.name)" \ - --filter="serviceConfig.name:$SERVICE" 2>&1) != \ +if [[ $(gcloud services list --format="value(config.name)" \ + --filter="config.name:$SERVICE" 2>&1) != \ "$SERVICE" ]]; then echo "false" else From 964b0c991889a221caf48e4a37253848bf2d0edc Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Wed, 31 Mar 2021 21:21:17 -0400 Subject: [PATCH 10/13] fix version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ceaefb7..992427c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bpmct/launch-coder", - "version": "1.0.4", + "version": "1.0.5", "main": "src/index.js", "bin": { "launch-coder": "bin/launch-coder" From b173904e1b2a966ff4eaa2ca09f850333db76c58 Mon Sep 17 00:00:00 2001 From: Eric Paulsen Date: Thu, 1 Apr 2021 14:58:40 -0500 Subject: [PATCH 11/13] fix: README typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eaad82a..9bbd0fb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # launch-coder -⚠️: This was a hackathon project and is not recommended for production deployments or in sensative environments. +⚠️: This was a hackathon project and is not recommended for production deployments or in sensitive environments. --- From e1698539f551fab77ecf0c9a02cc88632cd16ee6 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Mon, 5 Apr 2021 11:44:51 -0400 Subject: [PATCH 12/13] clarify "install" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bbd0fb..cde122b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Preferred environment: Google Cloud Shell. It just works. ## How to use -No need to install: +No need to install the CLI tool locally, run from NPM: ```sh # For a guided install: From 178abc5d96c6ac1d0dd39948bf1cf65dd5ed145c Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Wed, 8 Sep 2021 21:55:02 -0500 Subject: [PATCH 13/13] add 1.21 warning --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cde122b..bc48589 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ⚠️: This was a hackathon project and is not recommended for production deployments or in sensitive environments. +This does not work for Coder v1.21+. Specify a --version flag + --- Launch [Coder](https://coder.com) in a simple way. It can: