code-server Getting Started
code-server is a web based IDE, it help you run VS Code on any machine anywhere and access it in the browser. It is also server-powered that take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
If you have installed Websoft9 code-server, the following steps is for your quick start
Preparation
- Get the Internet IP of your Server on Cloud
- Check your Inbound of Security Group Rule of Cloud Console to ensure the TCP:80 is allowed
- Complete Five steps for Domain if you want to use Domain for code-server
- Get default username and password of code-server
code-server Initialization
Steps for you
-
Use local Chrome or Firefox to access the URL http://DNS or http://Cloud Server Internet IP. You will enter login page of code-server.
-
Log in code-server web console. (Don't have password?)
-
Open the WorkSpace directory at code-server console
Default workspace directory is: /data/apps/codeserver/data/code/workspace
-
Open the 【Terminal】windows, run the
node
command, you can view the its version -
You can install more software by yourself, refer to: Set Develop Runtime
Having trouble?
Below is for you to solve problem, and you can contact Websoft9 Support or refer to Troubleshoot + FAQ to get more.
code-server QuickStart
Coming soon...
More guide about code-server, please refer to code-server Documentation.
code-server Setup
Reset Password
You can't reset code-server by web console, you should reset it by recreate container:
- Use SFTP to login server, and modify APP_PASSWORD in the .env file code-server directory
APP_VERSION=latest
APP_PORT=9001
APP_PASSWORD=123456 - Recreate code-server container
sudo docker-compose up -d
Modify port
Modify port is same with reset password, the difference is just modify the APP_PORT value
Install software
You can install more software by code-server console, the below is installing Java for you:
-
Login to code-server console, and open the【Terminal】windows, then run the command
sudo su
Password is the same with code-server console
-
Update apt repository
apt update
-
Install Java and verify it
#1 Install JRE
apt-get install openjdk-8-jre
#2 Check Java version
java -version
Runtime Backup
Since code-server runs on containers, if you plan to back up the environment after the container is installed for a long time, you need to create a custom container image as follows:
- Login your server
- Run the docker commit command to create image
#1 Create image
sudo docker commit -m "add java" -a "your name" codeserver codeserver-java:latest
#2 Look over image
sudo docker image ls
Multi-developer
The current deployment scheme has only one code-server by default. Since it does not support multiple users, it is not suitable for multiple development scenarios of collaborative work.
So how can we support the collaborative use of code-server by multiple developers? Designed from a macro perspective, it needs to be used by multiple developers. Each developer can allocate the following resources to achieve this requirement:
- Allocate a host port separately
- Assign a code-server directory separately
- Run a code-server container separately
You can refer the below sample:
-
Run the below command to create new code-server directory for new user
# CP directory to new folder user1
cd /data/wwwroot
cp -r codeserver user1
# Delete the old data
rm -rf user1/volumes -
Edit the /data/wwwroot/user1/.env file, set the you value for APP_PORT,APP_PASSWORD,APP_CONTAINER_NAME, save it
APP_PORT=9001
APP_PASSWORD=123456
APP_CONTAINER_NAME=codeserverAPP_PORT and APP_CONTAINER_NAME must different from the already existing code-server
-
Recreate code-server for new user
cd /data/wwwroot/user1
sudo docker-compose up -d
Reference sheet
The below items and General parameter sheet is maybe useful for you manage code-server
Run docker ps
command, view all Containers when code-server is running:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
81bb4aeed134 ghcr.io/linuxserver/code-server:latest "/init" 23 minutes ago Up 23 minutes 0.0.0.0:9001->8443/tcp, :::9001->8443/tcp codeserver```
下面仅列出 code-server 本身的参数:
Path
code-server installation directory: /data/apps/codeserver
code-server data directory: /data/apps/codeserver/data/code/data
code-server workspace: /data/apps/codeserver/data/code/workspace
code-server extensions directory: /data/apps/codeserver/data/code/extensions
Port
No special port
Version
sudo docker inspect codeserver | grep org.opencontainers.image.version | cut -d: -f2
Service
sudo docker start | stop | restart | stats codeserver