DEV Community

kyorohiro (kiyohiro kawamura)
kyorohiro (kiyohiro kawamura)

Posted on • Updated on

code-server deamon on your VPS

Install Code-Server and Launch Code-Cerver At Server Restart Your VPS.

install

curl -fsSL https://code-server.dev/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

kick code-server shell

/opt/code-server.sh

#!/bin/sh

while true
do
  PASSWORD=<Your Password> code-server --auth password --host 0.0.0.0 --port 8443 /app
  sleep 1
done

Enter fullscreen mode Exit fullscreen mode
$ chmod 655 /opt/code-server.sh 
Enter fullscreen mode Exit fullscreen mode

service script

/etc/systemd/system/my-code-server.service

[Unit]
Description = code-server deamon

[Service]
ExecStart = /opt/code-server.sh
Restart = always
Type = simple

[Install]
WantedBy = multi-user.target
Enter fullscreen mode Exit fullscreen mode

start command

systemctl enable my-code-server
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
kyorohiro profile image
kyorohiro (kiyohiro kawamura)

if code-server throw following error message

Unable to start the C/C++ language server. IntelliSense features will be disabled. Error: Error: Unable to read process.env.HOME
Enter fullscreen mode Exit fullscreen mode

you add a environment variable .

/opt/code-server.sh

#!/bin/sh

while true
do
  HOME=<YOUR HOME DIR PATH> PASSWORD=<Your Password> code-server --auth password --host 0.0.0.0 --port 8443 /app
  sleep 1
done
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kyorohiro profile image
kyorohiro (kiyohiro kawamura)

About C++ VSCode Extension:

you must to use 0.29.0 at ms-vscode
or install from a visx file ( github.com/microsoft/vscode-cpptoo... )

because current code-server has bug(?). github.com/cdr/code-server/issues/...