Openvscode: Difference between revisions

From Wiki
Jump to navigation Jump to search
(Created page with "= Overview = Deploy a full-featured '''web-based IDE''' with local AI coder (Llama 3 via Ollama), automation via n8n, secure HTTPS with Nginx & Certbot, and robust system security on a dedicated Ubuntu 24.04 LTS VPS/server. The final product delivers browser access at [https://ide.illuni.in https://ide.illuni.in] with AI chat, code generation, and workflow automation tools.<ref name="1"/><ref name="2"/><ref name="4"/><ref name="6"/> = Requirements = ; OS Ubuntu 24.04 LT...")
 
 
(12 intermediate revisions by the same user not shown)
Line 16: Line 16:
= System Preparation =
= System Preparation =
== Update System and Install Essentials ==
== Update System and Install Essentials ==
<syntaxhighlight lang="bash">
<pre> apt update && apt -y upgrade apt -y install software-properties-common git unzip curl wget tar ufw fail2ban ca-certificates </pre>
apt update && apt -y upgrade
apt -y install software-properties-common git unzip curl wget tar ufw fail2ban ca-certificates
</syntaxhighlight>


== Harden Security ==
== Harden Security ==
Configure firewall:
Configure firewall:
<syntaxhighlight lang="bash">
<pre> ufw allow 22  
ufw allow 22
ufw allow 80  
ufw allow 80
ufw allow 443  
ufw allow 443
ufw enable </pre>
ufw enable
</syntaxhighlight>


Set up Fail2Ban and enable automatic upgrades:
Set up Fail2Ban and enable automatic upgrades:
<syntaxhighlight lang="bash">
<pre>  
systemctl enable --now fail2ban
systemctl enable --now fail2ban
apt install unattended-upgrades
apt install unattended-upgrades
dpkg-reconfigure unattended-upgrades
dpkg-reconfigure unattended-upgrades
</syntaxhighlight>
</pre>


Use SSH key authentication—disable password login in <code>/etc/ssh/sshd_config</code> (<code>PasswordAuthentication no</code>).<ref name="4"/>
Use SSH key authentication—disable password login in <code>/etc/ssh/sshd_config</code> (<code>PasswordAuthentication no</code>).


= OpenVSCode Server Installation =
= OpenVSCode Server Installation =
== Create Directory & Download ==
== Create Directory & Download ==
<syntaxhighlight lang="bash">
<pre>
cd /opt
cd /opt
sudo mkdir openvscode-server
sudo mkdir openvscode-server
sudo chown $USER:$USER openvscode-server
cd openvscode-server
cd openvscode-server
curl -L https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.103.1/openvscode-server-v1.103.1-linux-x64.tar.gz -o openvscode-server.tar.gz
curl -L https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.103.1/openvscode-server-v1.103.1-linux-x64.tar.gz -o openvscode-server.tar.gz
tar -xzf openvscode-server.tar.gz --strip-components=1
tar -xzf openvscode-server.tar.gz --strip-components=1
rm openvscode-server.tar.gz
rm openvscode-server.tar.gz
</syntaxhighlight>
</pre>


== Create Service User ==
== Create Service User ==
<syntaxhighlight lang="bash">
<pre> useradd -m -s /bin/bash vscode  
useradd -m -s /bin/bash vscode
chown -R vscode:vscode /opt/openvscode-server
chown -R vscode:vscode /opt/openvscode-server
</syntaxhighlight>
</pre>


== Setup systemd Service ==
== Setup systemd Service ==
Create <code>/etc/systemd/system/openvscode.service</code>:
Create <code>/etc/systemd/system/openvscode.service</code>:
<syntaxhighlight lang="ini">
<pre>  
[Unit]
[Unit]
Description=OpenVSCode Server
Description=OpenVSCode Server
Line 74: Line 67:
[Install]
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
</syntaxhighlight>
 
</pre>


Load and start the service:
Load and start the service:
<syntaxhighlight lang="bash">
<pre> sudo systemctl daemon-reload  
sudo systemctl daemon-reload
sudo systemctl enable --now openvscode  
sudo systemctl enable --now openvscode
sudo systemctl status openvscode  
sudo systemctl status openvscode
ss -tulpn | grep 3100 </pre>
ss -tulpn | grep 3100
</syntaxhighlight>


= Ollama Installation (Local AI Models) =
= Ollama Installation (Local AI Models) =
== Install Ollama ==
== Install Ollama ==
<syntaxhighlight lang="bash">
<pre> curl -fsSL https://ollama.com/install.sh | sh </pre>
curl -fsSL https://ollama.com/install.sh | sh
</syntaxhighlight>


Confirm install:
Confirm install:
<syntaxhighlight lang="bash">
<pre> ollama --version </pre>
ollama --version
</syntaxhighlight>


== Pull AI Models ==
== Pull AI Models ==
<syntaxhighlight lang="bash">
<pre>  
/usr/local/bin/ollama pull llama3
/usr/local/bin/ollama pull llama3  
/usr/local/bin/ollama pull codellama:7b
/usr/local/bin/ollama pull codellama:7b  
/usr/local/bin/ollama pull mistral:latest
/usr/local/bin/ollama pull mistral:latest  
/usr/local/bin/ollama list
/usr/local/bin/ollama list </pre>
</syntaxhighlight>


== Configure Ollama as a Service (open to network) ==
== Configure Ollama as a Service (open to network) ==
Edit <code>/etc/systemd/system/ollama.service</code>:
Edit <code>/etc/systemd/system/ollama.service</code>:
<syntaxhighlight lang="ini">
<pre>  
[Unit]
[Unit]
Description=Ollama AI Service
Description=Ollama AI Service
Line 119: Line 106:
[Install]
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
</syntaxhighlight>
</pre>


Reload and start service:
Reload and start service:
<syntaxhighlight lang="bash">
<pre> sudo systemctl daemon-reload  
sudo systemctl daemon-reload
sudo systemctl enable --now ollama  
sudo systemctl enable --now ollama
sudo systemctl status  
sudo systemctl status ollama
ollama ss -tulpn | grep 11434 </pre>
ss -tulpn | grep 11434
</syntaxhighlight>


= Nginx Reverse Proxy with HTTPS (Certbot) =
= Nginx Reverse Proxy with HTTPS (Certbot) =
== Install Nginx ==
== Install Nginx ==
<syntaxhighlight lang="bash">
<pre> sudo apt install nginx -y  
sudo apt install nginx -y
sudo systemctl enable --now nginx  
sudo systemctl enable --now nginx
sudo systemctl status nginx </pre>
sudo systemctl status nginx
</syntaxhighlight>


== Configure Reverse Proxy ==
== Configure Reverse Proxy ==
Create <code>/etc/nginx/sites-available/openvscode.conf</code>:
Create <code>/etc/nginx/sites-available/openvscode.conf</code>:
<syntaxhighlight lang="nginx">
<pre>  
server {
server {
listen 80;
  listen 80;
server_name ide.illuni.in;
  server_name ide.illuni.in;
location / {
  location / {
proxy_pass http://127.0.0.1:3100;
    proxy_pass http://127.0.0.1:3100;
proxy_http_version 1.1;
    proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
    proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
    proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}
}
}
</pre>
</syntaxhighlight>


Enable config:
Enable config:
<syntaxhighlight lang="bash">
<pre>  
ln -sf /etc/nginx/sites-available/openvscode.conf /etc/nginx/sites-enabled/openvscode.conf
ln -sf /etc/nginx/sites-available/openvscode.conf /etc/nginx/sites-enabled/openvscode.conf  
sudo nginx -t
sudo nginx -t  
sudo systemctl reload nginx
sudo systemctl reload nginx </pre>
</syntaxhighlight>


== Install Certbot and Issue SSL ==
== Install Certbot and Issue SSL ==
<syntaxhighlight lang="bash">
<pre>sudo apt install certbot python3-certbot-nginx -y  
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d "ide.illuni.in" -m "admin@illuni.in" --agree-tos -n  
sudo certbot --nginx -d "ide.illuni.in" -m "admin@illuni.in" --agree-tos -n
sudo systemctl reload nginx </pre>
sudo systemctl reload nginx
</syntaxhighlight>


Certbot automates SSL certificate provisioning and renewal.<ref name="4"/>
Certbot automates SSL certificate provisioning and renewal.


= Install n8n (Automation Tool) =
= Install n8n (Automation Tool) =
Follow official n8n installation guide for Ubuntu. Example for npm:
Follow official n8n installation guide for Ubuntu. Example for npm:
<syntaxhighlight lang="bash"> npm install -g n8n n8n start </syntaxhighlight>
<pre> npm install -g n8n n8n start </pre>


For production, consider running n8n as a systemd service and configuring a reverse proxy.
For production, consider running n8n as a systemd service and configuring a reverse proxy.
Line 182: Line 162:


Open a terminal in OpenVSCode as vscode user:
Open a terminal in OpenVSCode as vscode user:
<syntaxhighlight lang="bash">
<pre> mkdir -p ~/.continue  
mkdir -p ~/.continue
nano ~/.continue/config.json </pre>
nano ~/.continue/config.json
 
</syntaxhighlight>
Paste (replace <code><SERVER_IP></code>):
Paste (replace <code><SERVER_IP></code>):
<syntaxhighlight lang="json"> { "models": [ { "title": "Ollama (Llama 3)", "provider": "ollama", "model": "llama3", "api_base": "http://<SERVER_IP>:11434" } ] } </syntaxhighlight>
<pre>  
{
  "models": [
    {
      "title": "Ollama (Llama 3)",
      "provider": "ollama",
      "model": "llama3",
      "api_base": "http://<SERVER_IP>:11434"
    }
  ]
}
</pre>


Confirm connection:
Confirm connection:
<syntaxhighlight lang="bash">
<pre> curl http://<SERVER_IP>:11434/api/tags </pre>
curl http://<SERVER_IP>:11434/api/tags
</syntaxhighlight>


Reload/refresh the Continue extension UI.
Reload/refresh the Continue extension UI.
Line 208: Line 196:
= Conclusion =
= Conclusion =
This setup delivers a '''secure, scalable, browser IDE''' with local AI coding assistant and workflow automation—all on Ubuntu 24.04 LTS. This workflow is suitable for remote development teams, solo devs, and anyone needing advanced code capabilities balanced with maximum data control and security.
This setup delivers a '''secure, scalable, browser IDE''' with local AI coding assistant and workflow automation—all on Ubuntu 24.04 LTS. This workflow is suitable for remote development teams, solo devs, and anyone needing advanced code capabilities balanced with maximum data control and security.
== References ==
<references/>

Latest revision as of 17:19, 30 August 2025

Overview

Deploy a full-featured web-based IDE with local AI coder (Llama 3 via Ollama), automation via n8n, secure HTTPS with Nginx & Certbot, and robust system security on a dedicated Ubuntu 24.04 LTS VPS/server. The final product delivers browser access at https://ide.illuni.in with AI chat, code generation, and workflow automation tools.<ref name="1"/><ref name="2"/><ref name="4"/><ref name="6"/>

Requirements

OS

Ubuntu 24.04 LTS (64-bit)

Hardware

Minimum 8 vCPUs, 12 GB RAM, 100 GB SSD

Network

Incoming ports 22 (SSH), 80/443 (HTTP/HTTPS)

Domain

A-record for ide.illuni.in pointed to server IP

Security

SSH key auth only, UFW firewall, Fail2Ban, unattended-upgrades enabled<ref name="4"/>

System Preparation

Update System and Install Essentials

 apt update && apt -y upgrade apt -y install software-properties-common git unzip curl wget tar ufw fail2ban ca-certificates 

Harden Security

Configure firewall:

 ufw allow 22 
ufw allow 80 
ufw allow 443 
ufw enable 

Set up Fail2Ban and enable automatic upgrades:

 
systemctl enable --now fail2ban
apt install unattended-upgrades
dpkg-reconfigure unattended-upgrades

Use SSH key authentication—disable password login in /etc/ssh/sshd_config (PasswordAuthentication no).

OpenVSCode Server Installation

Create Directory & Download

cd /opt
sudo mkdir openvscode-server
cd openvscode-server
curl -L https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.103.1/openvscode-server-v1.103.1-linux-x64.tar.gz -o openvscode-server.tar.gz
tar -xzf openvscode-server.tar.gz --strip-components=1
rm openvscode-server.tar.gz

Create Service User

 useradd -m -s /bin/bash vscode 
chown -R vscode:vscode /opt/openvscode-server
 

Setup systemd Service

Create /etc/systemd/system/openvscode.service:

 
[Unit]
Description=OpenVSCode Server
After=network.target

[Service]
Type=simple
User=vscode
WorkingDirectory=/opt/openvscode-server
ExecStart=/opt/openvscode-server/bin/openvscode-server --host 0.0.0.0 --port 3100 --without-connection-token
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Load and start the service:

 sudo systemctl daemon-reload 
sudo systemctl enable --now openvscode 
sudo systemctl status openvscode 
ss -tulpn | grep 3100 

Ollama Installation (Local AI Models)

Install Ollama

 curl -fsSL https://ollama.com/install.sh | sh 

Confirm install:

 ollama --version 

Pull AI Models

 
/usr/local/bin/ollama pull llama3 
/usr/local/bin/ollama pull codellama:7b 
/usr/local/bin/ollama pull mistral:latest 
/usr/local/bin/ollama list 

Configure Ollama as a Service (open to network)

Edit /etc/systemd/system/ollama.service:

 
[Unit]
Description=Ollama AI Service
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/ollama --host 0.0.0.0 --port 11434 serve
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Reload and start service:

 sudo systemctl daemon-reload 
sudo systemctl enable --now ollama 
sudo systemctl status 
ollama ss -tulpn | grep 11434 

Nginx Reverse Proxy with HTTPS (Certbot)

Install Nginx

 sudo apt install nginx -y 
sudo systemctl enable --now nginx 
sudo systemctl status nginx 

Configure Reverse Proxy

Create /etc/nginx/sites-available/openvscode.conf:

 
server {
  listen 80;
  server_name ide.illuni.in;
  location / {
    proxy_pass http://127.0.0.1:3100;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

Enable config:

 
ln -sf /etc/nginx/sites-available/openvscode.conf /etc/nginx/sites-enabled/openvscode.conf 
sudo nginx -t 
sudo systemctl reload nginx 

Install Certbot and Issue SSL

sudo apt install certbot python3-certbot-nginx -y 
sudo certbot --nginx -d "ide.illuni.in" -m "admin@illuni.in" --agree-tos -n 
sudo systemctl reload nginx 

Certbot automates SSL certificate provisioning and renewal.

Install n8n (Automation Tool)

Follow official n8n installation guide for Ubuntu. Example for npm:

 npm install -g n8n n8n start 

For production, consider running n8n as a systemd service and configuring a reverse proxy.

Install and Configure Continue Extension

Access OpenVSCode: Visit https://ide.illuni.in/ Install Continue Extension: In the left sidebar, find the Extensions pane, search for "Continue", and click Install.<ref name="5"/><ref name="2"/> Configure Continue for Ollama:

Open a terminal in OpenVSCode as vscode user:

 mkdir -p ~/.continue 
nano ~/.continue/config.json 

Paste (replace <SERVER_IP>):

 
{
  "models": [
    {
      "title": "Ollama (Llama 3)",
      "provider": "ollama",
      "model": "llama3",
      "api_base": "http://<SERVER_IP>:11434"
    }
  ]
}

Confirm connection:

 curl http://<SERVER_IP>:11434/api/tags 

Reload/refresh the Continue extension UI.

Final Verification

   Open https://ide.illuni.in/ in browser.
   Try out code completion, AI chat, and automation workflows.
   Confirm secure HTTPS lock; certificates should auto-renew via Certbot.
   Ensure only SSH key authentication is allowed; periodic security updates run automatically.

Conclusion

This setup delivers a secure, scalable, browser IDE with local AI coding assistant and workflow automation—all on Ubuntu 24.04 LTS. This workflow is suitable for remote development teams, solo devs, and anyone needing advanced code capabilities balanced with maximum data control and security.