Rewrite and update documentation

This commit is contained in:
Dean Sheather
2019-08-17 05:46:37 +10:00
parent 8c39e085f4
commit 7caef7f49c
12 changed files with 703 additions and 246 deletions

View File

@@ -1,66 +1,101 @@
# Deploy on Google Cloud
# Deploy on Google Cloud Platform
This tutorial shows you how to deploy `code-server` to a single node running on Google Cloud.
This tutorial shows you how to deploy `code-server` to a single node running on
Google Cloud Platform.
If you're just starting out, we recommend [installing code-server locally](../../self-hosted/index.md). It takes only a few minutes and lets you try out all of the features.
If you're just starting out, we recommend
[installing code-server locally](self-hosted-docs). It takes only a few minutes
and lets you try out all of the features locally.
If you get stuck or need help at anytime, [file an issue](create-issue),
[tweet (@coderhq)](twitter-coderhq) or [email](email-coder).
[self-hosted-docs]: ../../self-hosted/index.md
[create-issue]: https://github.com/cdr/code-server/issues/new?title=Improve+Google+Cloud+quickstart+guide
[twitter-coderhq]: https://twitter.com/coderhq
[email-coder]: mailto:support@coder.com?subject=Google%20Cloud%20quickstart%20guide
---
## Deploy to Google Cloud VM
> Pre-requisite: Please [set up Google Cloud SDK](https://cloud.google.com/sdk/docs/) on your local machine
- [Open your Google Cloud console](https://console.cloud.google.com/compute/instances) to create a new VM instance and click **Create Instance**
- Choose an appropriate machine type (we recommend 2 vCPU and 7.5 GB RAM, more depending on team size and number of repositories/languages enabled)
- Choose Ubuntu 16.04 LTS as your boot disk
- Expand the "Management, security, disks, networking, sole tenancy" section, go to the "Networking" tab, then under network tags add "code-server"
- Create your VM, and **take note** of its public IP address.
- Visit "VPC network" in the console and go to "Firewall rules". Create a new firewall rule called "http-8443". Under "Target tags" add "code-server", and under "Protocols and ports" tick "Specified protocols and ports" and "tcp". Beside "tcp", add "8443", then create the rule.
- Copy the link to download the latest Linux binary from our [releases page](https://github.com/cdr/code-server/releases)
> Pre-requisite: Please [set up Google Cloud SDK](gcloud-sdk) on your local
> machine.
[Open your Google Cloud console](create-instance) to create a new VM instance.
1. Click **Create Instance**.
2. Choose an appropriate machine type (we recommend 2 vCPU and 7.5 GB RAM, or
more depending on team size and number of repositories/languages enabled).
3. Choose **Ubuntu 16.04 LTS** as your boot disk.
4. Expand the **Management, security, disks, networking, sole tenancy** section,
go to the **Networking** tab, then under network tags add `code-server`.
5. Create your VM, and **take note** of its public IP address.
6. Visit **VPC networks** in the console and go to **Firewall rules**. Create a
new firewall rule called `http-8443`. Under **Target tags**, add
`code-server`, and under **Protocols and ports** tick **Specified protocols and
ports** and **tcp**. Beside **tcp**, add `8443`, then create the rule.
[gcloud-sdk]: https://cloud.google.com/sdk/docs/
[create-instance]: https://console.cloud.google.com/compute/instances
---
## Final Steps
- SSH into your Google Cloud VM
```
gcloud compute ssh --zone [region] [instance name]
```
<!-- TODO: add a screenshot of the initial terminal like other guides -->
- Find the latest Linux release from this URL:
```
https://github.com/cdr/code-server/releases/latest
```
1. SSH into your Google Cloud VM:
```
gcloud compute ssh --zone [region] [instance name]
```
2. At this point it is time to download the `code-server` binary. We will, of
course, want the linux version. Find the latest code-server release from the
[GitHub releases](code-server-latest) page.
3. Right click the Linux x64 `.tar.gz` release asset and copy the URL. In the
SSH terminal, run the following command:
```
wget (paste the URL here)
```
4. Extract the downloaded file with the following command:
```
tar -xvzf code-server*.tar.gz
```
5. Navigate to extracted directory with this command:
```
cd code-server*/
```
6. Ensure the code-server binary is executable with the following command:
```
chmod +x code-server
```
7. Finally, to start code-server run this command:
```
./code-server
```
8. code-server will start up, and the password will be printed in the output.
Make sure to copy the password for the next step.
9. Open your browser and visit `https://$public_ip:8443/` (where `$public_ip`
is your Instance's public IP address). You will be greeted with a page
similar to the following screenshot. code-server is using a self-signed SSL
certificate for easy setup. In Chrome/Chromium, click **Advanced** then
click **proceed anyway**. In Firefox, click **Advanced**, then **Add
Exception**, then finally **Confirm Security Exception**.
<img src="../../assets/chrome_warning.png">
- 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):
```
wget https://github.com/cdr/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
```
- Navigate to extracted directory with this command:
```
cd code-server{version}-linux-x64
```
- 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)
- Start the code-server
```
./code-server
```
- Open your browser and visit `https://$public_ip:8443/` (where `$public_ip` is your Compute Engine instance's public IP address). You will be greeted with a page similar to the following screenshot. Code-server is using a self-signed SSL certificate for easy setup. In Chrome/Chromium, click **"Advanced"** then click **"proceed anyway"**. In Firefox, click **Advanced**, then **Add Exception**, then finally **Confirm Security Exception**.<img src ="../../assets/chrome_warning.png">
> 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
[code-server-latest]: https://github.com/cdr/code-server/releases/latest
---
> NOTE: If you get stuck or need help, [file an issue](https://github.com/cdr/code-server/issues/new?&title=Improve+self-hosted+quickstart+guide), [tweet (@coderhq)](https://twitter.com/coderhq) or [email](mailto:support@coder.com?subject=Self-hosted%20quickstart%20guide).
### Post Installation Steps
To ensure the connection between you and your server is encrypted, view our
guides on [securing your setup](security-guide).
For instructions on how to keep the server running after you end your SSH
session please checkout [how to use systemd](systemd-guide). systemd will run
code-server for you in the background as a service and restart it for you if it
crashes.
[security-guide]: ../../security/index.md
[systemd-guide]: https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/