From 2d1439aa022af1a96fe71631461aa91c946502b7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 15 Nov 2021 23:33:45 -0500 Subject: [PATCH 1/2] Add installation guide for dokku --- guides/dokku/README.md | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 guides/dokku/README.md diff --git a/guides/dokku/README.md b/guides/dokku/README.md new file mode 100644 index 0000000000000..6dd8222e6d373 --- /dev/null +++ b/guides/dokku/README.md @@ -0,0 +1,68 @@ +# Deploy OpenVSCode Server to dokku + +## Prerequisites + +To complete this guide, you need: + +- An installation of [Dokku](https://dokku.com/docs/getting-started/installation/) +- DNS for your app name pointing at your server (replace `dokku.me` in this guide for your domain name) +- (Optional) The [dokku-letsencrypt](https://github.com/dokku/dokku-letsencrypt) plugin +- (Optional) The [dokku-http-auth](https://github.com/dokku/dokku-http-auth) plugin + +## Setup + +1. Create the app: + ```shell + dokku apps:create code + ``` +2. Create the code directory. Your workspace will be mounted here + ```shell + dokku storage:ensure-directory --chown heroku code + dokku storage:mount code "/var/lib/dokku/data/storage/code:/home/workspace:cached" + ``` +3. Override the proxy ports to route requests from the host port 80 to the container 3000 + ```shell + dokku proxy:ports-set code http:80:3000 + ``` +4. Force set the connection token. Without this, each restart of VSCode will use a new connection token, requiring checking the logs for the connection token. + ```shell + dokku config:set code DOKKU_DOCKERFILE_START_CMD='--connectionToken 4f76badc-e6df-4bb0-9a39-aa1b1ceb386c' + ``` +6. Deploy OpenVSCode Server from a docker image. + ```shell + dokku git:from-image code gitpod/openvscode-server + ``` +7. (Optional) Enable http auth for your server. In the below example, the username is `root` and the password is the connection token, `4f76badc-e6df-4bb0-9a39-aa1b1ceb386c` + ```shell + dokku http-auth:on code root 4f76badc-e6df-4bb0-9a39-aa1b1ceb386c + ``` +8. (Optional) Enable ssl via letsencrypt. + ```shell + dokku letsencrypt:enable code + ``` +9. (Optional) Add a file `/home/dokku/code/nginx.conf.d/vscode.conf` with the following contents. This will transparently set the connection token on requests, allowing users to avoid needing to set a querystring token for their requests in order to access OpenVSCode. + ```nginx + # in /home/dokku/code/nginx.conf.d/vscode.conf + add_header Set-Cookie "vscode-tkn=4f76badc-e6df-4bb0-9a39-aa1b1ceb386c; Path=/"; + ``` + - Reload nginx after this is performed via `sudo service nginx reload`. + +## Start the server + +The server should be automatically started by the above commands. + +## Access OpenVSCode Server + +> This assumes your hostname + +To access OpenVSCode Server, browse to: + +- `http`: [http://code.dokku.me](http://code.dokku.me) +- `https`: [https://code.dokku.me](https://code.dokku.me) + +## Teardown + +1. Run the following command to destroy the app and all related resources: + ```shell + dokku --force apps:destroy code + ``` From cdd671b397d434c116b9dcb6d44a991b4c0de574 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 13 Jul 2022 02:12:42 -0400 Subject: [PATCH 2/2] docs: remove connection token changes These are no longer necessary due to changes upstream. --- guides/dokku/README.md | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/guides/dokku/README.md b/guides/dokku/README.md index 6dd8222e6d373..382b646cf0ea1 100644 --- a/guides/dokku/README.md +++ b/guides/dokku/README.md @@ -24,29 +24,18 @@ To complete this guide, you need: ```shell dokku proxy:ports-set code http:80:3000 ``` -4. Force set the connection token. Without this, each restart of VSCode will use a new connection token, requiring checking the logs for the connection token. - ```shell - dokku config:set code DOKKU_DOCKERFILE_START_CMD='--connectionToken 4f76badc-e6df-4bb0-9a39-aa1b1ceb386c' - ``` -6. Deploy OpenVSCode Server from a docker image. +4. Deploy OpenVSCode Server from a docker image. ```shell dokku git:from-image code gitpod/openvscode-server ``` -7. (Optional) Enable http auth for your server. In the below example, the username is `root` and the password is the connection token, `4f76badc-e6df-4bb0-9a39-aa1b1ceb386c` +5. (Optional) Enable http auth for your server. In the below example, the username is `root` and the password is whatever you would like, such as `4f76badc-e6df-4bb0-9a39-aa1b1ceb386c` ```shell dokku http-auth:on code root 4f76badc-e6df-4bb0-9a39-aa1b1ceb386c ``` -8. (Optional) Enable ssl via letsencrypt. +6. (Optional) Enable ssl via letsencrypt. ```shell dokku letsencrypt:enable code ``` -9. (Optional) Add a file `/home/dokku/code/nginx.conf.d/vscode.conf` with the following contents. This will transparently set the connection token on requests, allowing users to avoid needing to set a querystring token for their requests in order to access OpenVSCode. - ```nginx - # in /home/dokku/code/nginx.conf.d/vscode.conf - add_header Set-Cookie "vscode-tkn=4f76badc-e6df-4bb0-9a39-aa1b1ceb386c; Path=/"; - ``` - - Reload nginx after this is performed via `sudo service nginx reload`. - ## Start the server The server should be automatically started by the above commands.