From 93ddb2280f8c7563823a08f20f8da1ebb9fb87d4 Mon Sep 17 00:00:00 2001 From: Illia Poplawski Date: Sat, 6 Apr 2019 08:17:05 -0400 Subject: [PATCH 1/7] Update QuickStart guides to use copy/paste links that always download the latest version of code-server with no modification by the user --- doc/admin/install/aws.md | 14 +++++--------- doc/admin/install/digitalocean.md | 21 +++++++++------------ doc/admin/install/google_cloud.md | 17 ++++++----------- 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/doc/admin/install/aws.md b/doc/admin/install/aws.md index fbf896e2950e..ecb5b250a69c 100644 --- a/doc/admin/install/aws.md +++ b/doc/admin/install/aws.md @@ -33,21 +33,17 @@ If you're just starting out, we recommend [installing code-server locally](../.. >example: `ssh -i "/Users/John/Downloads/TestInstance.pem" ubuntu@ec2-3-45-678-910.compute-1.amazonaws.co` - You should see a prompt for your EC2 instance like so - At this point it is time to download the `code-server` binary. We will of course want the linux version. -- Find the latest Linux release from this URL: +- Download the latest Linux release with this command: ``` - https://github.com/codercom/code-server/releases/latest + curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz -qci - ``` -- Replace {version} in the following command with the version found on the releases page and run it (or just copy the download URL from the releases page): +- Extract the downloaded tar.gz file with this command: ``` - wget https://github.com/codercom/code-server/releases/download/{version}/code-server-{version}-linux-x64.tar.gz - ``` -- Extract the downloaded tar.gz file with this command, for example: - ``` - tar -xvzf code-server-{version}-linux-x64.tar.gz + mkdir -p ~/code-server-linux && tar -xzvf code-server-linux.tar.gz --strip 1 -C $_ ``` - Navigate to extracted directory with this command: ``` - cd code-server-{version}-linux-x64 + cd code-server-linux ``` - If you run into any permission errors, make the binary executable by running: ``` diff --git a/doc/admin/install/digitalocean.md b/doc/admin/install/digitalocean.md index 1a83d7bdb1d0..7adf9f0b723f 100644 --- a/doc/admin/install/digitalocean.md +++ b/doc/admin/install/digitalocean.md @@ -15,22 +15,19 @@ If you're just starting out, we recommend [installing code-server locally](../.. - Launch your instance - Open a terminal on your computer and SSH into your instance > example: ssh root@203.0.113.0 -- Once in the SSH session, visit code-server [releases page](https://github.com/codercom/code-server/releases/) and copy the link to the download for the latest linux release -- Find the latest Linux release from this URL: - ``` - https://github.com/codercom/code-server/releases/latest - ``` -- Replace {version} in the following command with the version found on the releases page and run it (or just copy the download URL from the releases page): +- Once in the SSH session, run the following commands to download and install the latest linux release + +- Download the latest Linux release with this command: ``` - wget https://github.com/codercom/code-server/releases/download/{version}/code-server-{version}-linux-x64.tar.gz + curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz -qci - ``` -- Extract the downloaded tar.gz file with this command, for example: +- Extract the downloaded tar.gz file with this command: ``` - tar -xvzf code-server-{version}-linux-x64.tar.gz + mkdir -p ~/code-server-linux && tar -xzvf code-server-linux.tar.gz --strip 1 -C $_ ``` -- Navigate to extracted directory with this command: +- Navigate to the extracted directory with this command: ``` - cd code-server-{version}-linux-x64 + cd code-server-linux ``` - If you run into any permission errors when attempting to run the binary: ``` @@ -39,7 +36,7 @@ If you're just starting out, we recommend [installing code-server locally](../.. > To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md) - Finally start the code-server ``` - sudo ./code-server-linux -p 80 + sudo ./code-server -p 80 ``` > For instructions on how to keep the server running after you end your SSH session please checkout [how to use systemd](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) to start linux based services if they are killed - When you visit the public IP for your Digital Ocean instance, you will be greeted with this page. Code-server is using a self-signed SSL certificate for easy setup. To proceed to the IDE, click **"Advanced"** diff --git a/doc/admin/install/google_cloud.md b/doc/admin/install/google_cloud.md index 91085910bcc6..d17571a4b2a1 100644 --- a/doc/admin/install/google_cloud.md +++ b/doc/admin/install/google_cloud.md @@ -25,24 +25,19 @@ If you're just starting out, we recommend [installing code-server locally](../.. gcloud compute ssh --zone [region] [instance name] ``` -- Find the latest Linux release from this URL: +- Download the latest Linux release with this command: ``` -https://github.com/codercom/code-server/releases/latest +curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz -qci - ``` -- Replace {version} in the following command with the version found on the releases page and run it (or just copy the download URL from the releases page): +- Extract the downloaded tar.gz file with this command: ``` -wget https://github.com/codercom/code-server/releases/download/{version}/code-server-{version}-linux-x64.tar.gz +mkdir -p ~/code-server-linux && tar -xzvf code-server-linux.tar.gz --strip 1 -C $_ ``` -- Extract the downloaded tar.gz file with this command, for example: +- Navigate to the extracted directory with this command: ``` -tar -xvzf code-server-{version}-linux-x64.tar.gz -``` - -- Navigate to extracted directory with this command: -``` -cd code-server-{version}-linux-x64 +cd code-server-linux ``` - Make the binary executable if you run into any errors regarding permission: From 2560dc5c8ab33ee8d4d52681400f05227ff6cdfb Mon Sep 17 00:00:00 2001 From: Illia Poplawski Date: Sat, 6 Apr 2019 08:38:49 -0400 Subject: [PATCH 2/7] Show download progress while downloading release --- doc/admin/install/aws.md | 2 +- doc/admin/install/digitalocean.md | 2 +- doc/admin/install/google_cloud.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/admin/install/aws.md b/doc/admin/install/aws.md index ecb5b250a69c..2be19d72d3b1 100644 --- a/doc/admin/install/aws.md +++ b/doc/admin/install/aws.md @@ -35,7 +35,7 @@ If you're just starting out, we recommend [installing code-server locally](../.. - At this point it is time to download the `code-server` binary. We will of course want the linux version. - Download the latest Linux release with this command: ``` - curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz -qci - + curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qci - ``` - Extract the downloaded tar.gz file with this command: ``` diff --git a/doc/admin/install/digitalocean.md b/doc/admin/install/digitalocean.md index 7adf9f0b723f..514b8af4853a 100644 --- a/doc/admin/install/digitalocean.md +++ b/doc/admin/install/digitalocean.md @@ -19,7 +19,7 @@ If you're just starting out, we recommend [installing code-server locally](../.. - Download the latest Linux release with this command: ``` - curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz -qci - + curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qci - ``` - Extract the downloaded tar.gz file with this command: ``` diff --git a/doc/admin/install/google_cloud.md b/doc/admin/install/google_cloud.md index d17571a4b2a1..356a3302597a 100644 --- a/doc/admin/install/google_cloud.md +++ b/doc/admin/install/google_cloud.md @@ -27,7 +27,7 @@ gcloud compute ssh --zone [region] [instance name] - Download the latest Linux release with this command: ``` -curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz -qci - +curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qci - ``` - Extract the downloaded tar.gz file with this command: From 2fc4c9b7bd621253a68fb9c45b3e8dc4dcfee91d Mon Sep 17 00:00:00 2001 From: Illia Poplawski Date: Sat, 6 Apr 2019 09:05:39 -0400 Subject: [PATCH 3/7] Removed c (continue) option from wget as the download file is relatively small to download and if the user has not deleted the old version download then the new version would not overwrite it. Could also be fixed by downloading the file with a version number but would complicate the commands. --- doc/admin/install/aws.md | 2 +- doc/admin/install/digitalocean.md | 2 +- doc/admin/install/google_cloud.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/admin/install/aws.md b/doc/admin/install/aws.md index 2be19d72d3b1..e4db808b450b 100644 --- a/doc/admin/install/aws.md +++ b/doc/admin/install/aws.md @@ -35,7 +35,7 @@ If you're just starting out, we recommend [installing code-server locally](../.. - At this point it is time to download the `code-server` binary. We will of course want the linux version. - Download the latest Linux release with this command: ``` - curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qci - + curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - ``` - Extract the downloaded tar.gz file with this command: ``` diff --git a/doc/admin/install/digitalocean.md b/doc/admin/install/digitalocean.md index 514b8af4853a..05f2c671b84c 100644 --- a/doc/admin/install/digitalocean.md +++ b/doc/admin/install/digitalocean.md @@ -19,7 +19,7 @@ If you're just starting out, we recommend [installing code-server locally](../.. - Download the latest Linux release with this command: ``` - curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qci - + curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - ``` - Extract the downloaded tar.gz file with this command: ``` diff --git a/doc/admin/install/google_cloud.md b/doc/admin/install/google_cloud.md index 356a3302597a..a76a0acc00ad 100644 --- a/doc/admin/install/google_cloud.md +++ b/doc/admin/install/google_cloud.md @@ -27,7 +27,7 @@ gcloud compute ssh --zone [region] [instance name] - Download the latest Linux release with this command: ``` -curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qci - +curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - ``` - Extract the downloaded tar.gz file with this command: From 479eea0436290b15d730b53d43a75d3fe28ef91e Mon Sep 17 00:00:00 2001 From: Illia Poplawski Date: Tue, 9 Apr 2019 18:34:16 -0400 Subject: [PATCH 4/7] Add update script --- scripts/update.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 scripts/update.sh diff --git a/scripts/update.sh b/scripts/update.sh new file mode 100755 index 000000000000..f4ae97ab6155 --- /dev/null +++ b/scripts/update.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Updates Code Server to the latest version +curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - +mkdir -p ~/code-server-linux && tar -xzvf ~/code-server-linux.tar.gz --strip 1 -C "$_" +cd ~/code-server-linux || return +chmod +x code-server \ No newline at end of file From 3c60218a9a6e64373693718f6db9891ae7ce0f0b Mon Sep 17 00:00:00 2001 From: Illia Poplawski Date: Tue, 9 Apr 2019 18:58:07 -0400 Subject: [PATCH 5/7] Update links to point to an update script --- doc/admin/install/aws.md | 14 +++---------- doc/admin/install/digitalocean.md | 14 +++---------- doc/admin/install/google_cloud.md | 33 +++++++++---------------------- 3 files changed, 15 insertions(+), 46 deletions(-) diff --git a/doc/admin/install/aws.md b/doc/admin/install/aws.md index e4db808b450b..11cb2eab32df 100644 --- a/doc/admin/install/aws.md +++ b/doc/admin/install/aws.md @@ -35,19 +35,11 @@ If you're just starting out, we recommend [installing code-server locally](../.. - At this point it is time to download the `code-server` binary. We will of course want the linux version. - Download the latest Linux release with this command: ``` - curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - + bash <(curl -s https://raw.githubusercontent.com/codercom/code-server/master/scripts/update.sh) ``` -- Extract the downloaded tar.gz file with this command: +- Navigate to the `code-server` directory with this command: ``` - mkdir -p ~/code-server-linux && tar -xzvf code-server-linux.tar.gz --strip 1 -C $_ - ``` -- Navigate to extracted directory with this command: - ``` - cd code-server-linux - ``` -- If you run into any permission errors, make the binary executable by running: - ``` - chmod +x code-server + cd ~/code-server-linux ``` > To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md) - Finally, run diff --git a/doc/admin/install/digitalocean.md b/doc/admin/install/digitalocean.md index 05f2c671b84c..23eb5fedd157 100644 --- a/doc/admin/install/digitalocean.md +++ b/doc/admin/install/digitalocean.md @@ -19,19 +19,11 @@ If you're just starting out, we recommend [installing code-server locally](../.. - Download the latest Linux release with this command: ``` - curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - + bash <(curl -s https://raw.githubusercontent.com/codercom/code-server/master/scripts/update.sh) ``` -- Extract the downloaded tar.gz file with this command: +- Navigate to the `code-server` directory with this command: ``` - mkdir -p ~/code-server-linux && tar -xzvf code-server-linux.tar.gz --strip 1 -C $_ - ``` -- Navigate to the extracted directory with this command: - ``` - cd code-server-linux - ``` -- If you run into any permission errors when attempting to run the binary: - ``` - chmod +x code-server + cd ~/code-server-linux ``` > To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md) - Finally start the code-server diff --git a/doc/admin/install/google_cloud.md b/doc/admin/install/google_cloud.md index a76a0acc00ad..d8d67a048a9c 100644 --- a/doc/admin/install/google_cloud.md +++ b/doc/admin/install/google_cloud.md @@ -24,35 +24,20 @@ If you're just starting out, we recommend [installing code-server locally](../.. ``` gcloud compute ssh --zone [region] [instance name] ``` - - Download the latest Linux release with this command: -``` -curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - -``` - -- Extract the downloaded tar.gz file with this command: -``` -mkdir -p ~/code-server-linux && tar -xzvf code-server-linux.tar.gz --strip 1 -C $_ -``` - -- Navigate to the extracted directory with this command: -``` -cd code-server-linux -``` - -- Make the binary executable if you run into any errors regarding permission: -``` -chmod +x code-server -``` - -> To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../security/ssl.md) - + ``` + bash <(curl -s https://raw.githubusercontent.com/codercom/code-server/master/scripts/update.sh) + ``` +- Navigate to the `code-server` directory with this command: + ``` + cd ~/code-server-linux + ``` + > To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../security/ssl.md) - Start the code-server ``` sudo ./code-server -p 80 ``` - -> For instructions on how to keep the server running after you end your SSH session please checkout [how to use systemd](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) to start linux based services if they are killed + > For instructions on how to keep the server running after you end your SSH session please checkout [how to use systemd](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) to start linux based services if they are killed - Access code-server from the public IP of your Google Cloud instance we noted earlier in your browser. > example: 32.32.32.234 From 56d9f219c187876d9326a0d9119570a3d1f7fdc7 Mon Sep 17 00:00:00 2001 From: Illia Poplawski Date: Tue, 9 Apr 2019 18:59:15 -0400 Subject: [PATCH 6/7] Update update script --- scripts/update.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/update.sh b/scripts/update.sh index f4ae97ab6155..8dc5db5f1c1b 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -3,5 +3,4 @@ # Updates Code Server to the latest version curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - mkdir -p ~/code-server-linux && tar -xzvf ~/code-server-linux.tar.gz --strip 1 -C "$_" -cd ~/code-server-linux || return -chmod +x code-server \ No newline at end of file +chmod +x ~/code-server-linux/code-server \ No newline at end of file From 0755e28699576feb3d770c362b1c416fd106cd19 Mon Sep 17 00:00:00 2001 From: Illia Poplawski Date: Wed, 10 Apr 2019 16:11:17 -0400 Subject: [PATCH 7/7] Make update script OS aware for mac and linux --- scripts/update.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/scripts/update.sh b/scripts/update.sh index 8dc5db5f1c1b..5d72ae37d3a1 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -1,6 +1,23 @@ #!/bin/bash + # Updates Code Server to the latest version -curl -s https://api.github.com/repos/codercom/code-server/releases/latest | grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | wget -O ~/code-server-linux.tar.gz --show-progress -qi - -mkdir -p ~/code-server-linux && tar -xzvf ~/code-server-linux.tar.gz --strip 1 -C "$_" -chmod +x ~/code-server-linux/code-server \ No newline at end of file +case $(uname -s) in + Darwin) # Mac + curl -s https://api.github.com/repos/codercom/code-server/releases/latest | \ + grep "browser_download_url.*code-server.*darwin-x64.zip" | cut -d '"' -f 4 | \ + awk '{print "url = "$1""}' | curl --create-dirs -o ~/code-server-darwin.zip --progress-bar -LK - + mkdir -p ~/code-server-darwin && tar -C "$_" xpvf ~/code-server-darwin.zip + chmod +x ~/code-server-darwin/code-server + ;; + Linux) + curl -s https://api.github.com/repos/codercom/code-server/releases/latest | \ + grep "browser_download_url.*code-server.*linux-x64.tar.gz" | cut -d '"' -f 4 | \ + wget -O ~/code-server-linux.tar.gz --show-progress -qi - + mkdir -p ~/code-server-linux && tar -xzvf ~/code-server-linux.tar.gz --strip 1 -C "$_" + chmod +x ~/code-server-linux/code-server + ;; + *) + echo "Unsupported operating system" + ;; +esac