Skip to content

Commit bd5bd2a

Browse files
committed
more docs and guides
1 parent 53dd155 commit bd5bd2a

12 files changed

+121
-10
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ A collection of one-click buttons and scripts for deploying code-server to vario
44

55
| Platform | Type | Cheapest Plan | Deploy |
66
| ----------------- | ---------------- | ------------------------------------- | -------------------------------------------------------- |
7-
| DigitalOcean | VM | $5/mo, 1 CPU, 1 GB RAM | Test |
8-
| Vultr | VM | $5/mo, 1 CPU, 1 GB RAM | Test |
9-
| Linode | VM | $3.50/mo, 1 CPU, 512 MB RAM | Test |
7+
| DigitalOcean | VM | $5/mo, 1 CPU, 1 GB RAM | [see guide](guides/digitalocean.md) |
8+
| Vultr | VM | $5/mo, 1 CPU, 1 GB RAM | coming soon |
9+
| Linode | VM | $3.50/mo, 1 CPU, 512 MB RAM | [see guide](guides/linode.md) |
1010
| Railway | Deploy Container | Free, specs unknown, but very fast 🚀 | [see guide](guides/railway.md) |
1111
| Heroku | Deploy Container | Free, 1 CPU, 512 MB RAM | [see guide](guides/heroku.md) |
1212
| Azure App Service | Deploy Container | Free, 1 CPU, 1 GB RAM | [see guide](https://github.com/bencdr/code-server-azure) |

deploy-vm/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
yep it is coming
1+
# Deploying `code-server` on a VM
2+
3+
A simple startup script to run code-server with --link on a VM, designed to run on Ubuntu 20.10.
4+
5+
**Coming soon:** One-click templates in popular marketplaces.
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
3+
# allow us to access systemd logs to see the status of --link
4+
sed -i.bak 's/#Storage=auto/Storage=persistent/' /etc/systemd/journald.conf
5+
mkdir -p /var/log/journal
6+
systemctl force-reload systemd-journald
7+
systemctl restart systemd-journald
8+
9+
# install code-server service system-wide
10+
export HOME=/root
11+
curl -fsSL https://code-server.dev/install.sh | sh
12+
13+
# add our helper server to redirect to the proper URL for --link
14+
git clone https://github.com/bpmct/coder-cloud-redirect-server
15+
cd coder-cloud-redirect-server
16+
cp coder-cloud-redirect.service /etc/systemd/system/
17+
cp coder-cloud-redirect.py /usr/bin/
18+
19+
# create a code-server user
20+
adduser --disabled-password --gecos "" coder
21+
echo "coder ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/coder
22+
usermod -aG sudo coder
23+
24+
# copy ssh keys from root
25+
cp -r /root/.ssh /home/coder/.ssh
26+
chown -R coder:coder /home/coder/.ssh
27+
28+
# use a more unique hostname (for Linode)
29+
sudo hostnamectl set-hostname linode-$LINODE_ID
30+
source /root/.bashrc
31+
32+
# configure code-server to use --link with the "coder" user
33+
mkdir -p /home/coder/.config/code-server
34+
touch /home/coder/.config/code-server/config.yaml
35+
echo "link: true" > /home/coder/.config/code-server/config.yaml
36+
chown -R coder:coder /home/coder/.config
37+
38+
# start and enable code-server and our helper service
39+
systemctl enable code-server@coder
40+
systemctl enable coder-cloud-redirect
41+
systemctl start code-server@coder && systemctl start coder-cloud-redirect

deploy-vm/launch-code-server.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
# install code-server service system-wide
4+
export HOME=/root
5+
curl -fsSL https://code-server.dev/install.sh | sh
6+
7+
# add our helper server to redirect to the proper URL for --link
8+
git clone https://github.com/bpmct/coder-cloud-redirect-server
9+
cd coder-cloud-redirect-server
10+
cp coder-cloud-redirect.service /etc/systemd/system/
11+
cp coder-cloud-redirect.py /usr/bin/
12+
13+
# create a code-server user
14+
adduser --disabled-password --gecos "" coder
15+
echo "coder ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/coder
16+
usermod -aG sudo coder
17+
18+
# copy ssh keys from root
19+
cp -r /root/.ssh /home/coder/.ssh
20+
chown -R coder:coder /home/coder/.ssh
21+
22+
# configure code-server to use --link with the "coder" user
23+
mkdir -p /home/coder/.config/code-server
24+
touch /home/coder/.config/code-server/config.yaml
25+
echo "link: true" > /home/coder/.config/code-server/config.yaml
26+
chown -R coder:coder /home/coder/.config
27+
28+
# start and enable code-server and our helper service
29+
systemctl enable --now code-server@coder
30+
systemctl enable --now coder-cloud-redirect

guides/digitalocean.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# deploying `code-server` on Linode
2+
3+
[DigitalOcean](https://digitalocean.com) is an developer-friendly platform with cloud servers. Here is the easiest way to launch code-server on Linode.
4+
5+
1. Log into DigitalOcean and create a new Ubuntu 20.10 droplet with any size, in any region
6+
1. Under "Select additional options," check `User data`. This will allow you to specify a script that will run on first boot.
7+
1. Paste in the contents of [launch-code-server.sh](../deploy-vm/launch-code-server-linode.sh) to the textarea.
8+
1. Create your server. Feel free to add SSH keys or other preferences.
9+
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).
10+
11+
<img src="../img/digitalocean-launch-code-server.gif" alt="DigitalOcean launch code-server" width="800" />

guides/heroku.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Guide: Launching `code-server` on Heroku
22

3-
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! 💵
3+
Heroku is a managed app hosting platform.
4+
Launch code-server on Heroku to get on-demand dev environments that turn off when you don't need them! 💵
45

56
![code-server and Heroku](../img/heroku-app-create.png)
67

@@ -13,7 +14,9 @@ Heroku is a managed app hosting platform. Launch code-server on Heroku to get on
1314
## Step 2: Configure & deploy your environment
1415

1516
`App name`: The URL and you can access code-server with
17+
1618
`PASSWORD`: A password you can use to log in
19+
1720
`GIT_REPO`: The HTTPS URL of a git repo you'd like to use in code-server. (optional)
1821

1922
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."
2225

2326
<img src="../img/modify-github-template.png" alt="Modify GitHub template" width="600" />
2427

28+
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).
29+
2530
## Step 4: Set up automatic builds with this repo
2631

2732
1. In Heroku, navigate to `Deploy -> Deployment Method"

guides/linode.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# deploying `code-server` on Linode
2+
3+
[Linode](https://linode.com) is a developer-friendly platform with cloud servers. Here is the easiest way to launch code-server on Linode.
4+
5+
1. Log in to Linode and go to the "StackScripts" section in the sidebar
6+
7+
<img src="../img/linode-stackscripts-sidebar.png" alt="Linode StackScripts" width="450" />
8+
9+
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).
10+
11+
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).
12+
13+
<img src="../img/linode-launch-code-server.gif" alt="Linode launch code-server" width="700" />
14+
15+
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:
16+
```sh
17+
sudo hostnamectl set-hostname bens-devbox
18+
sudo systemctl restart code-server@coder
19+
```

guides/railway.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# Guide: Launching `code-server` on railway.app
22

3-
[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.
3+
[Railway](https://railway.app) is a new cloud development platform! ☁️
4+
Use Railway + code-server to get a dev environment that you can access from any device.
45

56
![code-server and railway.app](../img/code-server-railway.png)
67

7-
## Step 1: Click to deploy
8+
## Step 1: Click button to deploy
89

910
[![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)
1011

1112
## Step 2: Configure & launch your environment
1213

13-
![railway launch environment screen](../img/launch-railway.gif)
14-
1514
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.
1615

16+
<img src="../img/launch-railway.gif" alt="Connected git repo" width="650" />
17+
1718
You also need to specity a `PASSWORD` and a `GIT_REPO` to clone in your environment :)
1819

1920
## 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
2324
<img src="../img/railway-connected.png" alt="Connected git repo" width="400" />
2425

2526
1. Open the source repo in GitHub and edit the `Dockerfile`
26-
1. Add some custom tools (like NodeJS) and commit to the main branch:
27+
1. Add some custom tools (like NodeJS) and push to the main branch:
2728

2829
```Dockerfile
2930
# You can add custom software and dependencies for your environment here. Some examples:

img/add-script-digitalocean.png

208 KB
Loading
8.56 MB
Loading

img/linode-launch-code-server.gif

2.18 MB
Loading

img/linode-stackscripts-sidebar.png

319 KB
Loading

0 commit comments

Comments
 (0)