Skip to content
Open

Dokploy #7893

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Code v1.127.0

- Update to Code 1.127.0

### Fixed

- Prevent non-stop "parent process died" output by clearing the parent-check interval after first detection

## [4.126.0](https://github.com/coder/code-server/releases/tag/v4.126.0) - 2026-06-24

Code v1.126.0
Expand Down
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM codercom/code-server:latest

USER root

# Create directories for persistent volumes and set ownership
RUN mkdir -p /home/coder/.local/share/code-server/extensions \
/home/coder/.config \
/home/coder/.local/share/code-server/logs \
/home/coder/.local/share/code-server/User && \
chown -R coder:coder /home/coder/.local /home/coder/.config

# Install Node.js and npm (code-server bundles its own Node.js, but we need a global npm for opencode)
RUN apt-get update && apt-get install -y --no-install-recommends \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*

# Install opencode CLI globally
RUN npm install -g opencode-ai@latest

USER coder
46 changes: 46 additions & 0 deletions dokploy/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Code-Server Environment Variables
# Update these values before deployment

# Authentication
PASSWORD: "your-secure-password-here"
PASSWORD_HINT: "set-a-password"

# User Configuration
USER: admin
GROUP: admin

# Timezone
TZ: America/New_York

# Domain (if using reverse proxy)
PROXY_DOMAIN: ""

# Password Policy
PASSWORD_EXPIRY_DAYS: 30
PASSWORD_MINIMUM_LENGTH: 8
PASSWORD_MINIMUM_DIFFERENT_CHARS: 3

# Feature Flags
DISABLE_GUEST_ACCESS: "true"
DISABLE_USER_SWITCHING: "true"
DISABLE_TERMINAL: "false"
DISABLE_SSH: "true"
DISABLE_UPDATE_CHECK: "true"
DISABLE_UPDATE_NOTIFICATION: "true"
DISABLE_UPDATE_POPUP: "true"
DISABLE_DASHBOARD: "false"
DISABLE_FILE_BROWSER: "false"
DISABLE_STARTUP_PAGE: "true"
DISABLE_EXTENSIONS: "false"

# File Browser Permissions
DISABLE_FILE_BROWSER_UPLOAD: "true"
DISABLE_FILE_BROWSER_DOWNLOAD: "true"
DISABLE_FILE_BROWSER_DELETE: "true"
DISABLE_FILE_BROWSER_CREATE: "true"
DISABLE_FILE_BROWSER_RENAME: "true"
DISABLE_FILE_BROWSER_MOVE: "true"
DISABLE_FILE_BROWSER_COPY: "true"
DISABLE_FILE_BROWSER_SEARCH: "true"
DISABLE_FILE_BROWSER_ZIP: "true"
DISABLE_FILE_BROWSER_UNZIP: "true"
156 changes: 156 additions & 0 deletions dokploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Code-Server Deployment Guide for Dokploy

## Quick Start

1. **Set Environment Variables**
- Edit `.env` file with your desired configuration
- Set a strong `PASSWORD`
- Configure feature flags as needed

2. **Deploy in Dokploy**
- Create a new Dokploy project
- Upload the entire `dokploy/` directory (or configure the git source to point to this repo)
- Set the environment variables from `.env`
- Deploy the service — the `Dockerfile` will build a custom image with opencode pre-installed

3. **Access Code-Server**
- URL: `https://your-domain.com:8080`
- Username: `admin`
- Password: (from .env)

4. **Use OpenCode**
- Open the integrated terminal in code-server
- Run `opencode` to start the AI coding agent

## Directory Structure

```
code-server/
├── Dockerfile # Custom image with opencode pre-installed
├── dokploy/
│ ├── docker-compose.yml # Dokploy deployment config
│ ├── .env # Environment variables
│ ├── code-server-data/ # Persisted data (created automatically)
│ └── fix-permissions.sh # Permission fix helper (run once on host)
└── README.md # This file
```

## Environment Variables Reference

### Authentication
- `PASSWORD` - Admin password (required)
- `PASSWORD_HINT` - Password hint for users

### User Management
- `USER` - Username (default: admin)
- `GROUP` - User group (default: admin)
- `DISABLE_GUEST_ACCESS` - Block guest access (true/false)

### Features
- `DISABLE_TERMINAL` - Disable terminal (true/false)
- `DISABLE_SSH` - Disable SSH access (true/false)
- `DISABLE_DASHBOARD` - Hide dashboard (true/false)
- `DISABLE_FILE_BROWSER` - Disable file browser (true/false)
- `DISABLE_STARTUP_PAGE` - Skip the startup page (true/false)
- `DISABLE_EXTENSIONS` - Disable all extensions including opencode (true/false)

### File Browser
- `DISABLE_FILE_BROWSER_UPLOAD` - Disable uploads
- `DISABLE_FILE_BROWSER_DOWNLOAD` - Disable downloads
- `DISABLE_FILE_BROWSER_DELETE` - Disable deletes
- `DISABLE_FILE_BROWSER_CREATE` - Disable file creation
- `DISABLE_FILE_BROWSER_RENAME` - Disable renaming
- `DISABLE_FILE_BROWSER_MOVE` - Disable moving files
- `DISABLE_FILE_BROWSER_COPY` - Disable copying
- `DISABLE_FILE_BROWSER_SEARCH` - Disable search
- `DISABLE_FILE_BROWSER_ZIP` - Disable zipping
- `DISABLE_FILE_BROWSER_UNZIP` - Disable unzipping

### Updates
- `DISABLE_UPDATE_CHECK` - Disable update checks (true/false)
- `DISABLE_UPDATE_NOTIFICATION` - Disable update notifications
- `DISABLE_UPDATE_POPUP` - Disable update popups

## OpenCode

[OpenCode](https://opencode.ai) is an open-source AI coding agent pre-installed in this image.

- Run `opencode` in the code-server integrated terminal
- Use `Tab` to switch between **build** (full-access) and **plan** (read-only) agents
- Configure via `~/.opencode/config.json` or the `.opencode/` directory in your project

The fork is maintained at [kt-production-repo/opencode](https://github.com/kt-production-repo/opencode).

## Volume Mounts

To ensure persistence of code-server data, extensions, settings, logs, and user-specific data, mount the following directories:

| Host Path | Container Path | Description |
|---|---|---|
| `./code-server-data` | `/home/coder/.local/share/code-server` | Main code-server data (storage, etc.) |
| `./code-server-extensions` | `/home/coder/.local/share/code-server/extensions` | Installed VS Code extensions |
| `./code-server-settings` | `/home/coder/.config` | User configuration (includes opencode config) |
| `./code-server-logs` | `/home/coder/.local/share/code-server/logs` | Application logs |
| `./code-server-user` | `/home/coder/.local/share/code-server/User` | User-specific data (globalStorage, Machine, history) |

**Why separate mounts?** Separating these directories makes it easier to back up specific parts (e.g., just extensions or settings) and avoids potential permission conflicts when code-server creates files in parent directories on startup.

If you prefer a single volume mount, you can still use:
- `./code-server-data:/home/coder/.local/share/code-server`

However, the multi-mount approach above is recommended for better organization and backup flexibility.

**If you previously used the old single-volume layout, migrate existing data:**
```bash
# Stop the container first, then:
mkdir -p code-server-data code-server-extensions code-server-settings code-server-logs code-server-user
cp -r code-server-data/* code-server-data/ 2>/dev/null || true # if you had the old single volume named code-server-data
# Adjust paths as needed based on your previous setup
chown -R 1001:1001 code-server-data code-server-extensions code-server-settings code-server-logs code-server-user
```

## Resource Limits

- CPU: 2 cores (limit), 0.5 cores (reservation)
- Memory: 2GB (limit), 512MB (reservation)

## Troubleshooting

### Cannot Access Code-Server
- Check if port 8080 is not in use
- Verify the service is running in Dokploy
- Check firewall settings

### Password Reset
- Edit the `.env` file with a new password
- Redeploy the service in Dokploy
- Or access via SSH and reset: `coder --password <new-password>`

### Performance Issues
- Reduce resource limits in `docker-compose.yml`
- Increase available memory on host
- Check disk I/O on mounted volumes

## Security Recommendations

1. Use a strong, unique password
2. Enable HTTPS with your reverse proxy
3. Configure firewall rules
4. Regularly update the image
5. Monitor resource usage
6. Backup the `code-server-data` directory

## Updating

To update to the latest version:

1. Pull the latest image in Dokploy
2. Redeploy with the same configuration
3. Your data and settings are preserved in volumes

## Customization

Additional settings can be configured via:
- Command line flags in the service definition
- Environment variables
- Code-server configuration files in the `settings` volume
64 changes: 64 additions & 0 deletions dokploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
version: '3.8'

services:
code-server:
build:
context: ..
dockerfile: Dockerfile
container_name: code-server
restart: unless-stopped
ports:
- "8080:8080"
environment:
- PASSWORD=${PASSWORD}
- PASSWORD_HINT=${PASSWORD_HINT:-set-a-password}
- USER=${USER:-admin}
- GROUP=${GROUP:-admin}
- TZ=${TZ:-America/New_York}
- PROXY_DOMAIN=${PROXY_DOMAIN}
- PASSWORD_EXPIRY_DAYS=${PASSWORD_EXPIRY_DAYS:-30}
- PASSWORD_MINIMUM_LENGTH=${PASSWORD_MINIMUM_LENGTH:-8}
- PASSWORD_MINIMUM_DIFFERENT_CHARS=${PASSWORD_MINIMUM_DIFFERENT_CHARS:-3}
- DISABLE_GUEST_ACCESS=${DISABLE_GUEST_ACCESS:-true}
- DISABLE_USER_SWITCHING=${DISABLE_USER_SWITCHING:-true}
- DISABLE_TERMINAL=${DISABLE_TERMINAL:-false}
- DISABLE_SSH=${DISABLE_SSH:-true}
- DISABLE_UPDATE_CHECK=${DISABLE_UPDATE_CHECK:-true}
- DISABLE_UPDATE_NOTIFICATION=${DISABLE_UPDATE_NOTIFICATION:-true}
- DISABLE_UPDATE_POPUP=${DISABLE_UPDATE_POPUP:-true}
- DISABLE_DASHBOARD=${DISABLE_DASHBOARD:-false}
- DISABLE_FILE_BROWSER=${DISABLE_FILE_BROWSER:-false}
- DISABLE_FILE_BROWSER_UPLOAD=${DISABLE_FILE_BROWSER_UPLOAD:-true}
- DISABLE_FILE_BROWSER_DOWNLOAD=${DISABLE_FILE_BROWSER_DOWNLOAD:-true}
- DISABLE_FILE_BROWSER_DELETE=${DISABLE_FILE_BROWSER_DELETE:-true}
- DISABLE_FILE_BROWSER_CREATE=${DISABLE_FILE_BROWSER_CREATE:-true}
- DISABLE_FILE_BROWSER_RENAME=${DISABLE_FILE_BROWSER_RENAME:-true}
- DISABLE_FILE_BROWSER_MOVE=${DISABLE_FILE_BROWSER_MOVE:-true}
- DISABLE_FILE_BROWSER_COPY=${DISABLE_FILE_BROWSER_COPY:-true}
- DISABLE_FILE_BROWSER_SEARCH=${DISABLE_FILE_BROWSER_SEARCH:-true}
- DISABLE_FILE_BROWSER_ZIP=${DISABLE_FILE_BROWSER_ZIP:-true}
- DISABLE_FILE_BROWSER_UNZIP=${DISABLE_FILE_BROWSER_UNZIP:-true}
- DISABLE_EXTENSIONS=${DISABLE_EXTENSIONS:-false}
- DISABLE_STARTUP_PAGE=${DISABLE_STARTUP_PAGE:-true}
volumes:
- ./code-server-data:/home/coder/.local/share/code-server
- ./code-server-extensions:/home/coder/.local/share/code-server/extensions
- ./code-server-settings:/home/coder/.config
- ./code-server-logs:/home/coder/.local/share/code-server/logs
- ./code-server-user:/home/coder/.local/share/code-server/User
networks:
- code-server-network
security_opt:
- seccomp=unconfined
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M

networks:
code-server-network:
driver: bridge
25 changes: 25 additions & 0 deletions dokploy/fix-permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Code-Server Dokploy Permission Fix Script
# Run this in the dokploy directory: /etc/dokploy/compose/<project-name>/code/dokploy

set -e

echo "Fixing code-server permissions..."

# Create the single volume directory
echo "Creating directory..."
mkdir -p code-server-data

# Set correct ownership (coder user is typically UID 1001)
echo "Setting ownership to coder user (UID 1001)..."
chown -R 1001:1001 code-server-data

# Set read/write/execute for coder user
chmod -R 755 code-server-data

echo "Permissions fixed!"
echo ""
echo "Directory: code-server-data"
echo ""
echo "Next step: Restart the code-server container in Dokploy UI"
2 changes: 1 addition & 1 deletion src/browser/media/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/browser/pages/error.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,39 @@
box-sizing: border-box;
padding: 20px;
text-align: center;
max-width: 600px;
margin: 0 auto;
}

@media (max-width: 480px) {
.error-display {
padding: 15px;
}
}

.error-display > .header {
font-size: 6rem;
margin: 0;
}

@media (max-width: 480px) {
.error-display > .header {
font-size: 4rem;
}
}

.error-display > .body {
color: #444;
color: light-dark(#444, #ccc);
font-size: 1.2rem;
}

@media (max-width: 480px) {
.error-display > .body {
font-size: 1rem;
}
}

.error-display > .links {
margin-top: 16px;
}
Expand Down
Loading