Wiki v1.0
Added a wiki
This commit is contained in:
@@ -0,0 +1,428 @@
|
||||
====== Code Server ======
|
||||
|
||||
Code Server is a web-based version of Visual Studio Code that runs in your browser, providing a full development environment accessible from anywhere. It includes all VS Code features, extensions, and integrates with your homelab development workflow.
|
||||
|
||||
===== Overview =====
|
||||
|
||||
**Purpose:** Browser-based code editor
|
||||
**URL:** https://code.yourdomain.duckdns.org
|
||||
**Authentication:** Authelia SSO protected
|
||||
**Deployment:** Infrastructure stack
|
||||
**Interface:** Full VS Code web interface
|
||||
|
||||
===== Key Features =====
|
||||
|
||||
**VS Code Features:**
|
||||
* **Full IDE**: Complete Visual Studio Code experience
|
||||
* **Extensions**: Access to VS Code marketplace
|
||||
* **Themes**: All VS Code themes and customization
|
||||
* **Git Integration**: Built-in Git version control
|
||||
|
||||
**Web Access:**
|
||||
* **Browser-based**: Access from any device
|
||||
* **Responsive Design**: Works on desktop and mobile
|
||||
* **Persistent Sessions**: Maintain work sessions
|
||||
* **File Synchronization**: Sync across devices
|
||||
|
||||
**Development Tools:**
|
||||
* **Terminal Integration**: Built-in terminal access
|
||||
* **Debugging**: Full debugging capabilities
|
||||
* **Extensions**: Python, Docker, GitHub Copilot
|
||||
* **Language Support**: 50+ programming languages
|
||||
|
||||
===== Configuration =====
|
||||
|
||||
**Container Configuration:**
|
||||
```yaml
|
||||
services:
|
||||
code-server:
|
||||
image: lscr.io/linuxserver/code-server:latest
|
||||
container_name: code-server
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=${TZ}
|
||||
- PASSWORD=${CODE_SERVER_PASSWORD}
|
||||
- SUDO_PASSWORD=${CODE_SERVER_PASSWORD}
|
||||
- PROXY_DOMAIN=${DOMAIN}
|
||||
- DEFAULT_WORKSPACE=/config/workspace
|
||||
volumes:
|
||||
- ./code-server/config:/config
|
||||
- /opt/stacks:/opt/stacks:ro
|
||||
- /home/kelin/AI-Homelab:/workspace
|
||||
networks:
|
||||
- traefik-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.0'
|
||||
memory: 1G
|
||||
reservations:
|
||||
cpus: '0.2'
|
||||
memory: 256M
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.code-server.rule=Host(`code.${DOMAIN}`)"
|
||||
- "traefik.http.routers.code-server.entrypoints=websecure"
|
||||
- "traefik.http.routers.code-server.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.routers.code-server.middlewares=authelia@docker"
|
||||
- "traefik.http.services.code-server.loadbalancer.server.port=8443"
|
||||
- "x-dockge.url=https://code.${DOMAIN}"
|
||||
```
|
||||
|
||||
**Environment Variables:**
|
||||
```bash
|
||||
# User permissions
|
||||
PUID=1000
|
||||
PGID=1000
|
||||
|
||||
# Authentication
|
||||
PASSWORD=your-secure-password
|
||||
SUDO_PASSWORD=your-secure-password
|
||||
|
||||
# Domain configuration
|
||||
PROXY_DOMAIN=yourdomain.duckdns.org
|
||||
|
||||
# Default workspace
|
||||
DEFAULT_WORKSPACE=/config/workspace
|
||||
```
|
||||
|
||||
===== Getting Started =====
|
||||
|
||||
**Initial Access:**
|
||||
1. **Access URL**: Visit https://code.yourdomain.duckdns.org
|
||||
2. **Authelia Login**: Authenticate with SSO
|
||||
3. **Password Setup**: Enter container password
|
||||
4. **Workspace Setup**: Configure your workspace
|
||||
|
||||
**Interface Overview:**
|
||||
* **Explorer**: File and folder navigation
|
||||
* **Editor**: Code editing with syntax highlighting
|
||||
* **Terminal**: Integrated command line access
|
||||
* **Extensions**: VS Code extension marketplace
|
||||
* **Settings**: Full VS Code configuration
|
||||
|
||||
===== Workspace Configuration =====
|
||||
|
||||
**Directory Mounting:**
|
||||
```yaml
|
||||
volumes:
|
||||
# AI-Homelab repository
|
||||
- /home/kelin/AI-Homelab:/workspace
|
||||
|
||||
# Stack configurations
|
||||
- /opt/stacks:/opt/stacks:ro
|
||||
|
||||
# User configuration
|
||||
- ./code-server/config:/config
|
||||
```
|
||||
|
||||
**Workspace Settings:**
|
||||
```json
|
||||
// .vscode/settings.json in workspace
|
||||
{
|
||||
"python.defaultInterpreterPath": "/usr/bin/python3",
|
||||
"git.enableSmartCommit": true,
|
||||
"editor.formatOnSave": true,
|
||||
"terminal.integrated.shell.linux": "/bin/bash"
|
||||
}
|
||||
```
|
||||
|
||||
**Recommended Extensions:**
|
||||
* **GitHub Copilot**: AI-powered code completion
|
||||
* **Python**: Python language support
|
||||
* **Docker**: Container management
|
||||
* **GitLens**: Enhanced Git capabilities
|
||||
* **Remote SSH**: Remote development
|
||||
|
||||
===== Development Workflow =====
|
||||
|
||||
**Homelab Development:**
|
||||
* **Stack Editing**: Edit docker-compose.yml files
|
||||
* **Configuration Management**: Modify service configurations
|
||||
* **Script Development**: Create automation scripts
|
||||
* **Documentation**: Edit wiki and documentation
|
||||
|
||||
**AI Integration:**
|
||||
* **GitHub Copilot**: AI-powered code suggestions
|
||||
* **AI Toolkit**: Access to AI development tools
|
||||
* **Model Testing**: Test AI models and integrations
|
||||
* **Workflow Development**: Create AI agent workflows
|
||||
|
||||
**Version Control:**
|
||||
* **Git Integration**: Full Git repository management
|
||||
* **Branch Management**: Create and manage branches
|
||||
* **Commit Management**: Stage, commit, and push changes
|
||||
* **Conflict Resolution**: Handle merge conflicts
|
||||
|
||||
===== Extensions & Customization =====
|
||||
|
||||
**Essential Extensions:**
|
||||
```json
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-python.python",
|
||||
"ms-vscode.vscode-json",
|
||||
"ms-vscode-remote.remote-ssh",
|
||||
"GitHub.copilot",
|
||||
"ms-vscode.vscode-docker",
|
||||
"eamodio.gitlens",
|
||||
"ms-vscode.vscode-yaml",
|
||||
"redhat.vscode-yaml"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Theme Configuration:**
|
||||
```json
|
||||
// Dark theme with high contrast
|
||||
{
|
||||
"workbench.colorTheme": "Default Dark Modern",
|
||||
"editor.fontSize": 14,
|
||||
"editor.lineHeight": 1.6,
|
||||
"terminal.integrated.fontSize": 13
|
||||
}
|
||||
```
|
||||
|
||||
**Keybindings:**
|
||||
```json
|
||||
// Custom keybindings
|
||||
[
|
||||
{
|
||||
"key": "ctrl+shift+t",
|
||||
"command": "workbench.action.terminal.new"
|
||||
},
|
||||
{
|
||||
"key": "ctrl+shift+g",
|
||||
"command": "gitlens.showCommitSearch"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
===== Terminal Integration =====
|
||||
|
||||
**Terminal Configuration:**
|
||||
```json
|
||||
{
|
||||
"terminal.integrated.shell.linux": "/bin/bash",
|
||||
"terminal.integrated.cwd": "/workspace",
|
||||
"terminal.integrated.env.linux": {
|
||||
"PATH": "/usr/local/bin:/usr/bin:/bin"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Docker Commands:**
|
||||
```bash
|
||||
# Access from terminal
|
||||
docker ps
|
||||
docker logs container-name
|
||||
docker exec -it container-name /bin/bash
|
||||
```
|
||||
|
||||
**Development Commands:**
|
||||
```bash
|
||||
# Python development
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Git operations
|
||||
git status
|
||||
git add .
|
||||
git commit -m "Update"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
===== Security Considerations =====
|
||||
|
||||
**Access Control:**
|
||||
* **Authelia Protection**: SSO authentication required
|
||||
* **Password Protection**: Additional container password
|
||||
* **Network Isolation**: Container network restrictions
|
||||
* **File Permissions**: Proper user permission mapping
|
||||
|
||||
**Data Protection:**
|
||||
* **Workspace Security**: Secure workspace access
|
||||
* **Git Credentials**: Secure Git authentication
|
||||
* **Extension Security**: Verify extension sources
|
||||
* **Session Security**: Secure web sessions
|
||||
|
||||
===== Performance Optimization =====
|
||||
|
||||
**Resource Management:**
|
||||
```yaml
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.0'
|
||||
memory: 1G
|
||||
reservations:
|
||||
cpus: '0.2'
|
||||
memory: 256M
|
||||
```
|
||||
|
||||
**Performance Tuning:**
|
||||
* **Extension Management**: Limit active extensions
|
||||
* **File Watching**: Configure file watcher limits
|
||||
* **Memory Usage**: Monitor memory consumption
|
||||
* **Caching**: Enable appropriate caching
|
||||
|
||||
===== Troubleshooting =====
|
||||
|
||||
**Connection Issues:**
|
||||
```bash
|
||||
# Check service status
|
||||
docker ps | grep code-server
|
||||
|
||||
# View logs
|
||||
docker logs code-server
|
||||
|
||||
# Test web access
|
||||
curl -k https://code.yourdomain.duckdns.org
|
||||
```
|
||||
|
||||
**Extension Problems:**
|
||||
* **Installation Failures**: Check network connectivity
|
||||
* **Compatibility Issues**: Verify VS Code version compatibility
|
||||
* **Permission Errors**: Check file permissions
|
||||
* **Cache Issues**: Clear extension cache
|
||||
|
||||
**Workspace Issues:**
|
||||
* **File Access**: Verify volume mount permissions
|
||||
* **Git Problems**: Check Git configuration
|
||||
* **Python Issues**: Verify Python interpreter path
|
||||
* **Extension Sync**: Check settings synchronization
|
||||
|
||||
**Performance Issues:**
|
||||
* **High CPU Usage**: Reduce active extensions
|
||||
* **Memory Problems**: Increase memory limits
|
||||
* **Slow Loading**: Clear browser cache
|
||||
* **Network Latency**: Check network performance
|
||||
|
||||
**Troubleshooting Steps:**
|
||||
1. **Check logs**: `docker logs code-server`
|
||||
2. **Verify configuration**: Check environment variables
|
||||
3. **Test connectivity**: Access web interface
|
||||
4. **Clear cache**: Clear browser and extension cache
|
||||
5. **Restart service**: `docker restart code-server`
|
||||
|
||||
===== Integration with Homelab =====
|
||||
|
||||
**Stack Management:**
|
||||
* **Compose Editing**: Edit docker-compose.yml files
|
||||
* **Configuration Management**: Modify service settings
|
||||
* **Script Development**: Create deployment scripts
|
||||
* **Documentation**: Update wiki and docs
|
||||
|
||||
**AI Development:**
|
||||
* **Model Testing**: Test AI models in isolated environment
|
||||
* **Workflow Development**: Create AI agent workflows
|
||||
* **API Integration**: Develop API integrations
|
||||
* **Tool Development**: Build custom tools and extensions
|
||||
|
||||
**Monitoring & Debugging:**
|
||||
* **Log Analysis**: Analyze service logs
|
||||
* **Performance Monitoring**: Monitor system performance
|
||||
* **Network Debugging**: Debug network connectivity
|
||||
* **Container Debugging**: Debug containerized applications
|
||||
|
||||
===== Best Practices =====
|
||||
|
||||
**Workspace Organization:**
|
||||
* **Project Structure**: Maintain clean project structure
|
||||
* **Version Control**: Use Git for all projects
|
||||
* **Documentation**: Document code and configurations
|
||||
* **Backup**: Regular workspace backups
|
||||
|
||||
**Development Workflow:**
|
||||
* **Branch Strategy**: Use feature branches
|
||||
* **Code Reviews**: Review code changes
|
||||
* **Testing**: Test changes before deployment
|
||||
* **Documentation**: Update documentation
|
||||
|
||||
**Security:**
|
||||
* **Access Control**: Limit workspace access
|
||||
* **Credential Management**: Secure sensitive credentials
|
||||
* **Extension Verification**: Only trusted extensions
|
||||
* **Session Management**: Proper session handling
|
||||
|
||||
**Performance:**
|
||||
* **Resource Limits**: Appropriate resource allocation
|
||||
* **Extension Management**: Keep extensions updated
|
||||
* **Cache Management**: Regular cache cleanup
|
||||
* **Optimization**: Optimize for your use case
|
||||
|
||||
===== Use Cases =====
|
||||
|
||||
**Homelab Management:**
|
||||
* **Service Configuration**: Edit service configurations
|
||||
* **Script Development**: Create automation scripts
|
||||
* **Documentation**: Maintain project documentation
|
||||
* **Troubleshooting**: Debug homelab issues
|
||||
|
||||
**Development Work:**
|
||||
* **Code Development**: Full-stack development
|
||||
* **API Development**: Build and test APIs
|
||||
* **Testing**: Unit and integration testing
|
||||
* **Debugging**: Application debugging
|
||||
|
||||
**Remote Development:**
|
||||
* **Mobile Development**: Code on mobile devices
|
||||
* **Travel Access**: Access code while traveling
|
||||
* **Collaborative Work**: Share development environment
|
||||
* **Backup Access**: Access code from any location
|
||||
|
||||
**Education & Learning:**
|
||||
* **Tutorial Following**: Follow coding tutorials
|
||||
* **Experimentation**: Test new technologies
|
||||
* **Documentation**: Create learning materials
|
||||
* **Project Development**: Build personal projects
|
||||
|
||||
===== Advanced Configuration =====
|
||||
|
||||
**Custom Extensions:**
|
||||
```json
|
||||
// Install custom extensions
|
||||
{
|
||||
"extensions": {
|
||||
"recommendations": [
|
||||
"ms-python.python",
|
||||
"GitHub.copilot"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Remote Development:**
|
||||
```json
|
||||
// SSH configuration for remote development
|
||||
{
|
||||
"remote.SSH.configFile": "~/.ssh/config",
|
||||
"remote.SSH.remotePlatform": {
|
||||
"homelab-server": "linux"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Task Automation:**
|
||||
```json
|
||||
// tasks.json for automation
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Deploy Stack",
|
||||
"type": "shell",
|
||||
"command": "docker-compose",
|
||||
"args": ["up", "-d"],
|
||||
"group": "build"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Code Server provides a full-featured development environment in your browser, perfectly integrated with your homelab workflow and AI development tools.
|
||||
|
||||
**Next:** Learn about [[services:infrastructure:docker-proxy|Docker Proxy]] or explore [[getting_started:access|Access Guide]].
|
||||
Reference in New Issue
Block a user