💻

Mga server ng code

Mga Kagamitan sa Pag-unlad

Tumatakbo ang VS Code sa browser para sa remote development kahit saan

Impormasyon sa Pag-deploy

Pag-deploy: 2-5 minuto
kategorya: Mga Kagamitan sa Pag-unlad
Min: 1024MB
Suporta: Ticket at email

Ibahagi ang gabay na ito

Pangkalahatang-ideya

Ang code-server ay VS Code na tumatakbo sa iyong browser, na nagbibigay sa iyo ng lakas ng sikat na desktop IDE ng Microsoft na maa-access mula sa anumang device na may web browser. Binuo at pinapanatili ng Coder, hinahayaan ka ng code-server na magsulat, mag-debug, at mag-deploy ng code kahit saan, ito man ay tablet, Chromebook, o anumang computer, habang tumatakbo ang iyong development environment sa malakas na remote server.

Ang galing ng code-server ay ibinibigay nito ang eksaktong karanasan sa VS Code na kilala at minamahal mo, pero maa-access ito sa pamamagitan ng web browser. Naroon lahat ng feature: IntelliSense code completion, debugging, integrated terminal, integrasyon sa Git, extension marketplace na may libu-libong plugin, at pamilyar na interface. Ang pagkakaiba lang ay nag-a-access ka sa pamamagitan ng HTTPS sa halip na patakbuhin ito nang lokal, pero parang native at mabilis tumugon ang karanasan sa pag-edit.

Malaki ang bentahe ng pagpapatakbo ng development environment sa isang server. Makakakuha ka ng pare-pareho at mauulit na environment sa buong team, kaya nawawala nang tuluyan ang problemang 'gumagana sa makina ko.' Mas mabilis ang compilation, testing, at build dahil sa malakas na hardware ng server kumpara sa mga laptop. Laging available ang iyong code at estado ng development mula sa anumang device, kaya mainam ito para sa remote work, paglipat-lipat ng device, o pair programming kasama ang mga kasamahan.

Built-in sa disenyo ng code-server ang seguridad at privacy. Naka-encrypt ang lahat ng komunikasyon sa pagitan ng iyong browser at ng server sa pamamagitan ng TLS/SSL. Pinoprotektahan ang access ng password authentication at opsyonal na OAuth2 sa pamamagitan ng reverse proxy. Hindi umaalis sa server ang iyong code maliban kung tahasan mo itong i-push sa version control, kaya mainam ito para sa mga sensitibong codebase o para sa pagsunod sa mga patakarang nagbabawal sa code sa lokal na makina.

Mahusay ang code-server sa mga cloud development workflow. I-deploy ito sa malakas na cloud instance na may mabilis na internet, at makakakuha ka ng agarang pag-synchronize ng code, mabilis na pag-install ng package, at kakayahang mag-SSH sa mga production server mula sa integrated terminal. Hinahayaan ka ng built-in na port forwarding na i-preview ang mga web application direkta sa browser, na may awtomatikong HTTPS at authentication. Maaari ka ring magtrabaho sa malalaking codebase nang hindi nag-aalala tungkol sa espasyo sa lokal na disk o limitasyon ng memory.

Malawak ang ecosystem ng extension. Karamihan sa mga extension ng VS Code ay gumagana nang maayos sa code-server. Available ang suporta sa wika, linter, formatter, tema, at mga productivity tool. Maaari mong i-sync ang iyong mga setting at extension sa maraming instance sa pamamagitan ng pag-mount ng direktoryo ng configuration ng VS Code. Maaaring mangailangan ng kaunting pagbabago ang ilang extension, pero nag-aalok ang core marketplace ng libu-libong handang gamitin na extension.

Kung ikaw man ay freelance developer na nagtatrabaho sa mga coffee shop, remote team na nangangailangan ng pare-parehong development environment, educator na nagtuturo ng coding online, o enterprise na nagpapatupad ng zero-trust na patakaran sa seguridad, nagbibigay ang code-server ng propesyonal na antas ng development tool na maa-access kahit saan nang hindi isinasakripisyo ang mga feature o performance.

Mga Susing Katangian

Buong VS Code sa Browser

Kumpletong karanasan sa VS Code na may lahat ng feature: IntelliSense, debugging, extension, tema, at integrated terminal

Magtrabaho Kahit Saan

I-access ang iyong development environment mula sa anumang device na may browser: tablet, Chromebook, o anumang computer

Malakas na Remote Development

Gamitin ang hardware ng server para sa compilation, testing, at build, habang mabilis na nae-edit ang code sa browser

Malawak na Suporta sa Extension

I-access ang libu-libong extension ng VS Code, kabilang ang language server, linter, formatter, at productivity tool

Secure bilang Default

TLS encryption, password authentication, opsyonal na OAuth2 sa pamamagitan ng reverse proxy, at nananatili sa server ang code para sa pagsunod sa regulasyon

Built-in na Port Forwarding

I-preview ang mga web application na may awtomatikong HTTPS at authentication tunneling sa pamamagitan ng code-server

Gamitin ang mga kaso

• Remote Development Teams: Pare-parehong development environment para sa mga distributed na team, na may mabilis na setup
• Cloud-Native Development: Bumuo at subukan ang mga cloud application nang direkta sa mga cloud server na malapit sa production
• Edukasyon at Pagsasanay: Magturo ng coding gamit ang mga paunang na-configure na environment na maa-access sa pamamagitan ng browser link
• Kontrata at Consulting na Trabaho: Ligtas na i-access ang mga codebase ng kliyente nang hindi dina-download sa personal na device
• Mobile Development: Mag-code sa iPad o tablet gamit ang buong kakayahan ng IDE, habang nasa biyahe o sa pagbiyahe papasok sa trabaho
• High-Performance Computing: Gamitin ang malalakas na cloud instance para sa malalaking codebase, AI/ML, o mga proyektong mabigat sa compilation
• Zero Trust Security: Sumunod sa mga patakarang nangangailangan na manatili ang code sa corporate infrastructure

Panuntunan ng Pag-install

Pag-install sa Ubuntu 22.04 LTS:

1. I-install gamit ang Install Script (Inirerekomenda):
curl -fsSL https://code-server.dev/install.sh | sh
2. O i-install nang manu-mano:
# Download latest release
VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest | grep -oP '"tag_name": "v\K[^"]+')
wget https://github.com/coder/code-server/releases/download/v${VERSION}/code-server_${VERSION}_amd64.deb

# Install package
sudo dpkg -i code-server_${VERSION}_amd64.deb
3. I-configure ang code-server:
# Edit config file
nano ~/.config/code-server/config.yaml
Itakda ang configuration:
bind-addr: 0.0.0.0:8080
auth: password
password: your_secure_password_here
cert: false  # We'll use reverse proxy for SSL
4. Gumawa ng Systemd Service:
sudo systemctl enable --now code-server@$USER
sudo systemctl status code-server@$USER
5. I-configure ang Nginx Reverse Proxy:
sudo apt install nginx -y
sudo nano /etc/nginx/sites-available/code-server
Idagdag ang configuration:
server {
    listen 80;
    server_name code.yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
I-enable ang site:
sudo ln -s /etc/nginx/sites-available/code-server /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
6. Kumuha ng SSL Certificate:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d code.yourdomain.com
7. I-access ang code-server:
Buksan ang browser sa https://code.yourdomain.com
- Mag-login gamit ang password mula sa config.yaml

8. I-install ang mga Extension:
# Via command line
code-server --install-extension ms-python.python
code-server --install-extension esbenp.prettier-vscode

# Or use Extensions panel in UI
9. I-configure ang Firewall:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 22/tcp  # SSH
10. Opsyonal: Pag-install ng Docker:
# Run code-server in Docker
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
    -v "$HOME/.config:/home/coder/.config" \
    -v "$HOME/projects:/home/coder/projects" \
    -u "$(id -u):$(id -g)" \
    -e "DOCKER_USER=$USER" \
    codercom/code-server:latest

Mga Tip sa Konfigurasyon

Mahalagang Configuration:

1. Pangunahing config file (~/.config/code-server/config.yaml):
bind-addr: 0.0.0.0:8080
auth: password
password: secure_password_here
cert: false
proxy-domain: code.yourdomain.com
2. Mga Paraan ng Authentication:
# Password authentication (default)
auth: password
password: your_password

# Disable authentication (dangerous, use with reverse proxy auth)
auth: none

# Use hashed password
hashed-password: "$argon2i$v=19$m=4096,t=3,p=1$..."
3. Mga Environment Variable:
# Set password via env
export PASSWORD="your_password"

# Disable telemetry
export TELEMETRY_LEVEL="off"

# Custom extensions directory
export EXTENSIONS_GALLERY='{"serviceUrl": "https://open-vsx.org/vscode/gallery"}'
4. Configuration ng Port Forwarding:
# Forward local dev server to public URL
# In code-server terminal:
npm run dev  # Starts on localhost:3000

# code-server automatically detects and offers to forward
# Access at: https://code.yourdomain.com/proxy/3000/
5. Configuration ng Extension:
# Install from marketplace
code-server --install-extension publisher.extension-name

# Install from VSIX
code-server --install-extension /path/to/extension.vsix

# List installed extensions
code-server --list-extensions

# Uninstall extension
code-server --uninstall-extension publisher.extension-name
6. Pag-sync ng Settings:
// settings.json location: ~/.local/share/code-server/User/settings.json
{
    "workbench.colorTheme": "Default Dark+",
    "editor.fontSize": 14,
    "editor.formatOnSave": true,
    "files.autoSave": "afterDelay",
    "terminal.integrated.shell.linux": "/bin/bash"
}
7. Multi-User na Setup:
# Create service for user1
sudo systemctl enable --now code-server@user1

# Create service for user2  
sudo systemctl enable --now code-server@user2

# Each user gets own config in their home directory
# ~/.config/code-server/config.yaml
8. Pagpapatibay ng Seguridad:
# Limit network access
bind-addr: 127.0.0.1:8080  # Only localhost

# Use strong password (20+ chars)
password: $(openssl rand -base64 32)

# Enable HTTPS on reverse proxy
# Use fail2ban for brute force protection
sudo apt install fail2ban

# Configure fail2ban for code-server
sudo nano /etc/fail2ban/jail.local
Idagdag:
[nginx-code-server]
enabled = true
port = 80,443
filter = nginx-code-server
logpath = /var/log/nginx/access.log
maxretry = 3
bantime = 3600
9. Pag-tune ng Performance:
# Increase file watcher limit
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

# Disable telemetry
export TELEMETRY_LEVEL=off

# Use faster protocol
# In settings.json:
{
    "terminal.integrated.rendererType": "dom"
}
10. Backup at Migration:
# Backup user data
tar -czf code-server-backup.tar.gz \
    ~/.local/share/code-server \
    ~/.config/code-server

# Restore on new server
tar -xzf code-server-backup.tar.gz -C ~
Mga Best Practice:
- Gumamit ng reverse proxy (Nginx/Caddy) para sa SSL termination
- I-enable ang awtomatikong HTTPS gamit ang Let's Encrypt
- Magtakda ng malalakas na password (20+ karakter)
- Regular na i-update ang code-server: curl -fsSL https://code-server.dev/install.sh | sh
- I-mount nang hiwalay ang projects directory para madaling ma-backup
- Gumamit ng systemd para sa awtomatikong pag-restart kapag may failure
- I-configure ang rate limiting sa reverse proxy
- I-enable ang fail2ban para sa proteksyon laban sa brute force
- Gumamit ng OAuth2 proxy para sa SSO integration
- Maghiwalay ng dev/staging/prod na instance kada user o team
- Bantayan ang log: journalctl -u code-server@$USER -f
- Mag-set up ng automated na backup ng data at configuration ng user

Teknolohiya Requirements

Mga Requirement ng System

  • Memorya: 1024MB RAM

I-rate ang Artikulo na Ito

★★★★★
-
Pag-load ng pahina...

Handa ka na bang i-deploy ang iyong aplikasyon? Mga server ng code?

Magsimula sa loob ng ilang minuto sa aming simpleng proseso ng pag-deploy VPS

I-deploy sa tungkol sa2minuto • Buong root access • Suporta sa pamamagitan ng tiket at email