Engineering

⌘K
  1. Home
  2. Docs
  3. Engineering
  4. Cloud IDE

Cloud IDE

Two alternatives that we can use:

  1. Gitpod: Starts at $9/user/mo. Use KEVINHQ for 30% discount for first three months. Users can also share a a running workspace or a snapshot workspace to another user. Based on Eclipse Theia so supports most Visual Studio Code extensions. Supports GitHub, GitLab, and Bitbucket. Paid account is required for private repositories. Spec: 16 Xeon vCPUs, 48 GiB free RAM.
    Note: $10/mo buys you a 2 GB instance on Lightsail or DigitalOcean, that can be used by multiple users.
  2. Coder.com. Open source version is available to host on our own (Lightsail) server.
  3. AWS Cloud9. Pricing is per (running) instance and storage, can be used collaboratively by as many IAM users as needed. Downside is it doesn’t use VS Code / Theia, so many familiar plugins will not work.

Other providers:

  • Codeanywhere. Very popular, not yet tested. Starts from $3/user/mo, to $10/user/mo, and $25/user/mo.
  • OpenShift Che (Codenvy). Formerly Codenvy, now acquired by Red Hat. When tested on July 30, 2020, got connection refused error in sso.redhat.com.
FeatureGitpodcode-server on AWS
PricingFrom $9/user/moe.g. $10/mo for Lightsail 2 GiB
or ~$11/mo for t3a 4 GB Singapore
(shareable with multiple users)
SecurityExcellentRisky / Manually managed
Ease of useEasyAdministration required, user management & server/port sharing required
Port conflictsDedicated hostname & portManually managed
Custom workspace base imagePossibleNot based on Docker
Docker / Docker Compose projectNot supportedInstall Docker/Docker Compose manually first
KubernetesNot supported, need to use remote Kubernetes clusterCan use microk8s
Workspace sharingEasy, secureShare a code-server instance/user
Multiple usersDedicated accounts (need to pay each one separately), dedicated workspacesCreate multiple code-server instances in one VM
Port numbers must be managed manually
Manual HTTP proxying & SSL configuration
Server specification16 vCPUs, Intel Xeon, 48 GiB free RAM out of 58 GiB total2 vCPUs, 2-8 GiB RAM
HTTPSAutomaticManually configured
Running timeSuspended after 30 minutes (free/Personal/Pro plans) / 60 minutes (Unlimited plan)Running 24 hours per day (including the billing), can be stopped/started manually
Gitpod vs Coder’s code-server Comparison

Gitpod

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 79
model name      : Intel(R) Xeon(R) CPU @ 2.20GHz
stepping        : 0
microcode       : 0x1
cpu MHz         : 2200.000
cache size      : 56320 KB
physical id     : 0
siblings        : 16
core id         : 0
cpu cores       : 8
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat md_clear arch_capabilities
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips        : 4400.00
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:
....16 processors....

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           58Gi        11Gi       9.1Gi        10Mi        38Gi        48Gi
Swap:            0B          0B          0B

Coder Open Source

Hendy tested this using Amazon EC2 m6g.medium on Tokyo ap-northeast-1b (only ap-northeast-1b and ap-northeast-1c supports m6g instances as of Aug 1, 2020).

  1. Ensure security group ssh-server exists, allowing SSH port from Anywhere
  2. Ensure security group code-server exists, allowing port 8080 (insecure HTTP) from Anywhere
  3. Launch instance using Ubuntu 20.04 Arm, m6g.medium
  4. Install code-server
curl -fsSL https://code-server.dev/install.sh | sh
  1. Edit ~/.config/code-server/config.yaml, change bind-addr from 127.0.0.1 to 0.0.0.0 to expose it to outside world.
bind-addr: 0.0.0.0:8080
auth: password
password: ***
cert: false

Launch code-server daemon using systemctl (user privileges, not using root):

systemctl --user enable --now code-server

Instance Types & Regions Pricing Comparison

Note: 1 GB is unusable for general Node.js development, as running Strapi’s yarn develop crashes the instance even only used by one user.

Instance & Region2 GB4 GB8 GB
Lightsail (anywhere)$10/mo incl. SSD$20/mo incl. SSD$40/mo incl. SSD
m6g TokyoRegular: $0.0495/hr => $36.83/mo
Spot: $0.0183/hr => $13.62/mo
Regular: $0.099/hr => $73.66/mo
Spot:
t3 Singapore$0.0264/hr (2 vCPU) => $19.65/mo
Spot: $0.0079/hr
$0.0528/hr(2 vCPU) => $39.29/mo
Spot: $0.0158/hr => $11.76/mo
$0.1056/hr(2 vCPU) => $78.57/mo
Spot: $0.0317/hr => $23.59/mo
t3a Singapore$0.0238/hr => $17.7/mo
Spot: $0.0071/hr => $5.29/mo
$0.0475/hr => $35.34/mo
Spot: $0.0142/hr => $10.6/mo
$0.095/hr => $70.68/mo
Spot: $0.0283/hr => $21.06/mo
m5a Singapore$0.108/hr (2 vCPU)
a1 Singapore$0.0294/hr (1 vCPU)$0.0588 (2 vCPU)$0.1176/hr (2 vCPU)
AWS Instance Types & Regions Pricing Comparison

Installing Development Tools

build-essential

Some Node.js packages and Python packages require build-essential (make, etc.):

sudo apt update && sudo apt -y install build-essential

Node.js 12 & Yarn Classic

Note: We use Node.js 12 because it is the version supported by AWS Lambda. We will upgrade to Node.js 14 after AWS Lambda supports it.

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo -E npm -g install yarn

Docker / Docker Compose

sudo apt install docker.io
sudo adduser ubuntu docker

You’ll need to relogin the user in order for “docker” group privileges to take effect.

MariaDB

To facilitate better isolation, it’s recommended to use Docker Compose / Docker instead. Each user will still need to use different ports for each service.

sudo apt install mariadb-client
docker run --name mariadb -e MYSQL_ROOT_PASSWORD=password -d -p 3306:3306 mariadb

Creating a new MariaDB database development:

mysql -h127.0.0.1 -uroot -p
CREATE DATABASE lovia_dw_dev CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Troubleshooting

Troubleshooting: UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached

Solution:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

How can we help?