more docs and guides

This commit is contained in:
Ben
2021-03-04 06:49:12 -05:00
parent 53dd155766
commit bd5bd2a195
12 changed files with 121 additions and 10 deletions

View File

@@ -4,9 +4,9 @@ A collection of one-click buttons and scripts for deploying code-server to vario
| Platform | Type | Cheapest Plan | Deploy |
| ----------------- | ---------------- | ------------------------------------- | -------------------------------------------------------- |
| DigitalOcean | VM | $5/mo, 1 CPU, 1 GB RAM | Test |
| Vultr | VM | $5/mo, 1 CPU, 1 GB RAM | Test |
| Linode | VM | $3.50/mo, 1 CPU, 512 MB RAM | Test |
| DigitalOcean | VM | $5/mo, 1 CPU, 1 GB RAM | [see guide](guides/digitalocean.md) |
| Vultr | VM | $5/mo, 1 CPU, 1 GB RAM | coming soon |
| Linode | VM | $3.50/mo, 1 CPU, 512 MB RAM | [see guide](guides/linode.md) |
| Railway | Deploy Container | Free, specs unknown, but very fast 🚀 | [see guide](guides/railway.md) |
| Heroku | Deploy Container | Free, 1 CPU, 512 MB RAM | [see guide](guides/heroku.md) |
| Azure App Service | Deploy Container | Free, 1 CPU, 1 GB RAM | [see guide](https://github.com/bencdr/code-server-azure) |

View File

@@ -1 +1,5 @@
yep it is coming
# Deploying `code-server` on a VM
A simple startup script to run code-server with --link on a VM, designed to run on Ubuntu 20.10.
**Coming soon:** One-click templates in popular marketplaces.

View File

@@ -0,0 +1,41 @@
#!/bin/sh
# allow us to access systemd logs to see the status of --link
sed -i.bak 's/#Storage=auto/Storage=persistent/' /etc/systemd/journald.conf
mkdir -p /var/log/journal
systemctl force-reload systemd-journald
systemctl restart systemd-journald
# install code-server service system-wide
export HOME=/root
curl -fsSL https://code-server.dev/install.sh | sh
# add our helper server to redirect to the proper URL for --link
git clone https://github.com/bpmct/coder-cloud-redirect-server
cd coder-cloud-redirect-server
cp coder-cloud-redirect.service /etc/systemd/system/
cp coder-cloud-redirect.py /usr/bin/
# create a code-server user
adduser --disabled-password --gecos "" coder
echo "coder ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/coder
usermod -aG sudo coder
# copy ssh keys from root
cp -r /root/.ssh /home/coder/.ssh
chown -R coder:coder /home/coder/.ssh
# use a more unique hostname (for Linode)
sudo hostnamectl set-hostname linode-$LINODE_ID
source /root/.bashrc
# configure code-server to use --link with the "coder" user
mkdir -p /home/coder/.config/code-server
touch /home/coder/.config/code-server/config.yaml
echo "link: true" > /home/coder/.config/code-server/config.yaml
chown -R coder:coder /home/coder/.config
# start and enable code-server and our helper service
systemctl enable code-server@coder
systemctl enable coder-cloud-redirect
systemctl start code-server@coder && systemctl start coder-cloud-redirect

30
deploy-vm/launch-code-server.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
# install code-server service system-wide
export HOME=/root
curl -fsSL https://code-server.dev/install.sh | sh
# add our helper server to redirect to the proper URL for --link
git clone https://github.com/bpmct/coder-cloud-redirect-server
cd coder-cloud-redirect-server
cp coder-cloud-redirect.service /etc/systemd/system/
cp coder-cloud-redirect.py /usr/bin/
# create a code-server user
adduser --disabled-password --gecos "" coder
echo "coder ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/coder
usermod -aG sudo coder
# copy ssh keys from root
cp -r /root/.ssh /home/coder/.ssh
chown -R coder:coder /home/coder/.ssh
# configure code-server to use --link with the "coder" user
mkdir -p /home/coder/.config/code-server
touch /home/coder/.config/code-server/config.yaml
echo "link: true" > /home/coder/.config/code-server/config.yaml
chown -R coder:coder /home/coder/.config
# start and enable code-server and our helper service
systemctl enable --now code-server@coder
systemctl enable --now coder-cloud-redirect

11
guides/digitalocean.md Normal file
View File

@@ -0,0 +1,11 @@
# deploying `code-server` on Linode
[DigitalOcean](https://digitalocean.com) is an developer-friendly platform with cloud servers. Here is the easiest way to launch code-server on Linode.
1. Log into DigitalOcean and create a new Ubuntu 20.10 droplet with any size, in any region
1. Under "Select additional options," check `User data`. This will allow you to specify a script that will run on first boot.
1. Paste in the contents of [launch-code-server.sh](../deploy-vm/launch-code-server-linode.sh) to the textarea.
1. Create your server. Feel free to add SSH keys or other preferences.
1. Once your server starts, you can simply navigate to the IP address and get forwarded to a secure version of code-server, which will be proxied behind your GitHub account. For information on how this works, see [code-server --link](https://github.com/cdr/code-server#cloud-program-%EF%B8%8F).
<img src="../img/digitalocean-launch-code-server.gif" alt="DigitalOcean launch code-server" width="800" />

View File

@@ -1,6 +1,7 @@
# Guide: Launching `code-server` on Heroku
Heroku is a managed app hosting platform. Launch code-server on Heroku to get on-demand dev environments that turn off when you don't need them! 💵
Heroku is a managed app hosting platform.
Launch code-server on Heroku to get on-demand dev environments that turn off when you don't need them! 💵
![code-server and Heroku](../img/heroku-app-create.png)
@@ -13,7 +14,9 @@ Heroku is a managed app hosting platform. Launch code-server on Heroku to get on
## Step 2: Configure & deploy your environment
`App name`: The URL and you can access code-server with
`PASSWORD`: A password you can use to log in
`GIT_REPO`: The HTTPS URL of a git repo you'd like to use in code-server. (optional)
After it has built, you can access it by pressing "View" or "Open app."
@@ -22,6 +25,8 @@ After it has built, you can access it by pressing "View" or "Open app."
<img src="../img/modify-github-template.png" alt="Modify GitHub template" width="600" />
Press the button in the top right of the repo, or or click to [use this template](https://github.com/bpmct/deploy-code-server/generate).
## Step 4: Set up automatic builds with this repo
1. In Heroku, navigate to `Deploy -> Deployment Method"

19
guides/linode.md Normal file
View File

@@ -0,0 +1,19 @@
# deploying `code-server` on Linode
[Linode](https://linode.com) is a developer-friendly platform with cloud servers. Here is the easiest way to launch code-server on Linode.
1. Log in to Linode and go to the "StackScripts" section in the sidebar
<img src="../img/linode-stackscripts-sidebar.png" alt="Linode StackScripts" width="450" />
1. Navigate to "Community Scripts" and use `bencdr/code-server` or create your own based on [../deploy-vm/launch-code-server-linode.sh](launch-code-server-linode.sh).
1. Give your server a label and deploy with Ubuntu 20.10 and any size. Once your server starts, you can simply navigate to the IP address and get forwarded to a secure version of code-server, which will be proxied behind your GitHub account. For information on how this works, see [code-server --link](https://github.com/cdr/code-server#cloud-program-%EF%B8%8F).
<img src="../img/linode-launch-code-server.gif" alt="Linode launch code-server" width="700" />
1. Optional: To change the URL in the address bar from `linode-[xxxx]` to something more descriptive, you just need to change your hostname and restart code-server:
```sh
sudo hostnamectl set-hostname bens-devbox
sudo systemctl restart code-server@coder
```

View File

@@ -1,19 +1,20 @@
# Guide: Launching `code-server` on railway.app
[Railway](https://railway.app) is a new cloud development platform! ☁️ Use Railway + code-server to get a dev environment that you can access from any device.
[Railway](https://railway.app) is a new cloud development platform! ☁️
Use Railway + code-server to get a dev environment that you can access from any device.
![code-server and railway.app](../img/code-server-railway.png)
## Step 1: Click to deploy
## Step 1: Click button to deploy
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new?template=https%3A%2F%2Fgithub.com%2Fbpmct%2Fcode-server-railway&envs=PASSWORD%2CGIT_REPO&PASSWORDDesc=Your+password+to+log+in+to+code-server+with&GIT_REPODesc=A+git+repo+to+clone+and+open+in+code-server+%28ex.+https%3A%2F%2Fgithub.com%2Fcdr%2Fdocs.git%29)
## Step 2: Configure & launch your environment
![railway launch environment screen](../img/launch-railway.gif)
You'll need to make a new repository which will contain your code-server configuration. If you push changes to this repo (to install NodeJS, for example), it will re-deploy code-server.
<img src="../img/launch-railway.gif" alt="Connected git repo" width="650" />
You also need to specity a `PASSWORD` and a `GIT_REPO` to clone in your environment :)
## Step 3: Modify your environment to add additional tools
@@ -23,7 +24,7 @@ You also need to specity a `PASSWORD` and a `GIT_REPO` to clone in your environm
<img src="../img/railway-connected.png" alt="Connected git repo" width="400" />
1. Open the source repo in GitHub and edit the `Dockerfile`
1. Add some custom tools (like NodeJS) and commit to the main branch:
1. Add some custom tools (like NodeJS) and push to the main branch:
```Dockerfile
# You can add custom software and dependencies for your environment here. Some examples:

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB