Deploy CodeServer on EC2 - SVF-tools/WebSVF GitHub Wiki

Overview

This page demonstrates steps on how to set up WebSVF Bug Analysis tool on a remote machine with the help of CodeServer

Before you start, ensure that:

  • You have access to AWS EC2 console.
  • A domain name has been acquired

Step 1. Set up EC2 Instance on AWS

On your AWS EC2 console, click on Launch Instance and choose following options for the steps:

  1. Amazon Machine Image (AMI): Ubuntu Server 18.04 LTS (HVM), SSD Volume Type - ami-0bc49f9283d686bab (64-bit x86)
  2. Instance Type: General purpose t2.medium
  3. Add storage: Change Size to 20GiB (Free tier eligible)
  4. Add tags: optional
  5. Security: SSH, HTTP, HTTPS (click on Add rule to add each)
  6. Launch!

A keypair needs to be selected for SSH purposes. You can create a new key pair before launching your instance or use existing ones if any.

After you have successfully created the instance, you will need to allocate an Elastic IP Address and associate it with your EC2 instance. This IP needs to be added to your domain as an A type resource record. This will connect the domain to your instance which usually takes a few minutes however could take upto 48 hours.

Once you have done the above, you are ready to connect to your instance via SSH and install code server.

Step 2. Install and Run Code Server on a EC2 Instance

SSH into your instance and run the following command to install code-server.

curl -fsSL https://code-server.dev/install.sh | sh

If you just want to check the installation process or other information (e.g. running code server) run:

curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run

To have systemd start code-server now and restart on boot:

systemctl --user enable --now code-server

Or, if you don't want/need a background service you can run:

code-server

Step 3. Install and Setup Caddy

Install Caddy on your EC2 Instance using commands below:

echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
    | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt update
sudo apt install caddy

Once Caddy server is installed, you need to set up the server from the caddy file located under /etc/caddy/Caddyfile.

Open and edit the caddyfile using sudo nano /etc/caddy/Caddyfile and ensure it looks like below (you can clear all the preexisting data) :

mydomain.com

reverse_proxy 127.0.0.1:8080

Caddy needs to be reloaded by running sudo systemctl reload caddy


  • After all the above steps have been completed you can now install WebSVF using the WebSVF CLI tool.

  • To ensure that your session runs indefinitely, run screen after you have installed all required components and running code server.