Coder + PostgreSQL
Self-hosted remote development environments.
Overview
Coder is an open-source platform that provisions secure, standardized development environments in your cloud or datacenter. Originally developed to solve the challenges of remote development and developer onboarding, Coder creates consistent, reproducible workspaces that developers can access from anywhere using their favorite IDEs like VS Code, JetBrains, or vim. Unlike traditional local development setups, Coder workspaces run on powerful cloud infrastructure while maintaining the familiar development experience.
This stack combines Coder's workspace orchestration with PostgreSQL as the backend database, creating a production-ready remote development platform. PostgreSQL stores all workspace metadata, user sessions, audit logs, and template configurations with the reliability and ACID compliance that enterprise development teams require. The database handles complex queries for workspace analytics, user permissions, and resource tracking across potentially hundreds of concurrent development environments.
Development teams transitioning to remote work, organizations with complex onboarding processes, and companies managing developers across multiple projects will find this combination invaluable. Coder eliminates 'works on my machine' problems by standardizing development environments, while PostgreSQL ensures that workspace state, user data, and audit trails are preserved with enterprise-grade reliability. This is particularly powerful for teams working with resource-intensive applications, legacy codebases, or strict security requirements where local development isn't feasible.
Key Features
- Template-based workspace provisioning with Terraform for consistent development environments across teams
- IDE-agnostic development supporting VS Code, JetBrains IDEs, vim, and web-based terminals
- Resource quotas and automatic workspace shutdown to control cloud infrastructure costs
- Built-in SSH and port forwarding for secure access to development services and databases
- Workspace sharing and collaboration features for pair programming and code reviews
- PostgreSQL-backed audit logging with full ACID compliance for enterprise compliance requirements
- Git integration with automatic repository cloning and credential management
- Container and VM workspace support through Docker and Kubernetes providers
Common Use Cases
- 1Remote development teams needing consistent environments across macOS, Windows, and Linux developers
- 2Onboarding new developers with pre-configured workspaces containing all necessary tools and dependencies
- 3Companies with complex development stacks requiring GPU access, large datasets, or specialized hardware
- 4Organizations with strict security policies requiring air-gapped or controlled development environments
- 5Consulting firms managing multiple client projects with different technology stacks and access requirements
- 6Educational institutions providing standardized programming environments for computer science courses
- 7Open source projects enabling contributors to start coding immediately without complex local setup
Prerequisites
- Docker Engine with access to Docker socket for workspace container management
- Minimum 4GB RAM available (2GB for Coder, 1GB for PostgreSQL, 1GB for workspace overhead)
- Port 7080 available for Coder web interface access
- Basic understanding of Terraform for creating custom workspace templates
- PostgreSQL knowledge for database maintenance and backup procedures
- Network access to container registries for pulling workspace images
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 coder: 3 image: ghcr.io/coder/coder:latest4 environment: 5 - CODER_PG_CONNECTION_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/coder?sslmode=disable6 - CODER_HTTP_ADDRESS=0.0.0.0:70807 - CODER_ACCESS_URL=http://localhost:70808 volumes: 9 - /var/run/docker.sock:/var/run/docker.sock10 - coder-data:/home/coder/.config11 ports: 12 - "7080:7080"13 depends_on: 14 - postgres15 networks: 16 - coder-network17 restart: unless-stopped1819 postgres: 20 image: postgres:1521 environment: 22 - POSTGRES_USER=${POSTGRES_USER}23 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}24 - POSTGRES_DB=coder25 volumes: 26 - postgres-data:/var/lib/postgresql/data27 networks: 28 - coder-network29 restart: unless-stopped3031volumes: 32 coder-data: 33 postgres-data: 3435networks: 36 coder-network: 37 driver: bridge.env Template
.env
1# Coder2POSTGRES_USER=coder3POSTGRES_PASSWORD=secure_postgres_password45# Create first user: coder server create-admin-userUsage Notes
- 1Web UI at http://localhost:7080
- 2Create admin on first run
- 3Templates for workspaces
- 4Docker, Kubernetes providers
- 5VS Code integration
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
coder
coder:
image: ghcr.io/coder/coder:latest
environment:
- CODER_PG_CONNECTION_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/coder?sslmode=disable
- CODER_HTTP_ADDRESS=0.0.0.0:7080
- CODER_ACCESS_URL=http://localhost:7080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- coder-data:/home/coder/.config
ports:
- "7080:7080"
depends_on:
- postgres
networks:
- coder-network
restart: unless-stopped
postgres
postgres:
image: postgres:15
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=coder
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- coder-network
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 coder:5 image: ghcr.io/coder/coder:latest6 environment:7 - CODER_PG_CONNECTION_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/coder?sslmode=disable8 - CODER_HTTP_ADDRESS=0.0.0.0:70809 - CODER_ACCESS_URL=http://localhost:708010 volumes:11 - /var/run/docker.sock:/var/run/docker.sock12 - coder-data:/home/coder/.config13 ports:14 - "7080:7080"15 depends_on:16 - postgres17 networks:18 - coder-network19 restart: unless-stopped2021 postgres:22 image: postgres:1523 environment:24 - POSTGRES_USER=${POSTGRES_USER}25 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}26 - POSTGRES_DB=coder27 volumes:28 - postgres-data:/var/lib/postgresql/data29 networks:30 - coder-network31 restart: unless-stopped3233volumes:34 coder-data:35 postgres-data:3637networks:38 coder-network:39 driver: bridge40EOF4142# 2. Create the .env file43cat > .env << 'EOF'44# Coder45POSTGRES_USER=coder46POSTGRES_PASSWORD=secure_postgres_password4748# Create first user: coder server create-admin-user49EOF5051# 3. Start the services52docker compose up -d5354# 4. View logs55docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/coder-workspace/run | bashTroubleshooting
- Coder fails to connect to PostgreSQL: Verify POSTGRES_USER and POSTGRES_PASSWORD environment variables match between services
- Workspaces fail to start with 'docker socket permission denied': Ensure Docker socket has proper permissions or add coder user to docker group
- Template builds timeout or fail: Check Docker daemon resources and increase build timeout in Coder admin settings
- Users can't access workspace ports: Configure CODER_ACCESS_URL to match your actual domain/IP instead of localhost
- PostgreSQL connection pool exhausted: Increase max_connections in PostgreSQL config or reduce concurrent workspace limits
- Workspace data lost after container restart: Verify coder-data volume is properly mounted and persistent
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
coderpostgresql
Tags
#coder#remote-development#ide#workspace#cloud-dev
Category
Development ToolsAd Space
Shortcuts: C CopyF FavoriteD Download