Skip to content

Commit c2d3c8e

Browse files
feat: improve coder/devcontainer dual-setup experience (#420)
* fix: remove unnecessary coder binary move step in deployment workflow * fix: suppress traefik warning in coder workspaces Skips Traefik connection attempt when running in Coder to suppress unnecessary warning about dev-devuser container not found. Coder uses its own networking, so local Traefik integration is not needed or applicable in Coder environments. Fixes: ⚠️ Dev container dev-devuser not found warning * docs: add development environment guide Clarifies the dual development environment setup: - Coder Cloud: Pre-configured cloud workspace - Local Devcontainer: Docker Desktop for offline work Prevents confusion about nested containers and when to use each. Resolves common VS Code "Reopen in Container" issue in Coder. * docs: add development guide and vscode settings Implements recommended dual-setup approach: - Keep both .devcontainer/ (local) and .coder/ (cloud) - Add .vscode/settings.json to prevent conflicts - Document when to use each environment Changes: - Added DEVELOPMENT.md: Complete guide for both setups - Added .vscode/settings.json: Prevents devcontainer in Coder - Updated .gitignore: Allow settings.json exception - Fixed post-start.sh: Suppress Traefik warning in Coder Resolves nested container issues when connecting to Coder. --------- Co-authored-by: Mohsin Hashmi <mhashmi@wiser.com>
1 parent 85193bd commit c2d3c8e

4 files changed

Lines changed: 234 additions & 6 deletions

File tree

.devcontainer/post-start.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,16 @@ get_server_ip() {
152152
echo "${IP:-localhost}"
153153
}
154154

155-
# Try to connect to Traefik
155+
# Try to connect to Traefik (skip in Coder - uses its own networking)
156156
TRAEFIK_ENABLED=false
157-
if connect_to_traefik; then
158-
TRAEFIK_ENABLED=true
159-
SERVER_IP=$(get_server_ip)
160-
NIP_IP=$(echo "$SERVER_IP" | tr '.' '-')
161-
DEV_USER="${DEV_USER:-devuser}"
157+
if [ -z "$CODER_AGENT_TOKEN" ]; then
158+
# Only try Traefik connection in local devcontainer (not Coder)
159+
if connect_to_traefik; then
160+
TRAEFIK_ENABLED=true
161+
SERVER_IP=$(get_server_ip)
162+
NIP_IP=$(echo "$SERVER_IP" | tr '.' '-')
163+
DEV_USER="${DEV_USER:-devuser}"
164+
fi
162165
fi
163166

164167
# =============================================================================

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ target/
1515
.idea/
1616
*.iml
1717
.vscode/
18+
!.vscode/settings.json
1819

1920
# Claude Code local settings
2021
.claude/

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Disable devcontainer features when connecting to Coder workspace
3+
// The Coder workspace already has all tools configured
4+
"remote.containers.defaultExtensions": [],
5+
6+
// Don't automatically reopen in container
7+
"dev.containers.executeInWSL": false,
8+
9+
// Workspace-specific settings
10+
"files.autoSave": "onFocusChange",
11+
"editor.formatOnSave": true,
12+
13+
// Help developers understand the setup
14+
"workbench.startupEditor": "readme"
15+
}

DEVELOPMENT.md

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# Development Environment Guide
2+
3+
SimpleAccounts-UAE supports **two development environments**. Choose the one that fits your workflow:
4+
5+
## 🚀 Quick Start
6+
7+
| Environment | When to Use | Setup Time |
8+
| ---------------------- | -------------------------------------- | ------------ |
9+
| **Coder Cloud** | Remote development, team collaboration | 2 minutes |
10+
| **Local Devcontainer** | Offline development, full control | 5-10 minutes |
11+
12+
---
13+
14+
## ☁️ Option 1: Coder Cloud Workspace (Recommended)
15+
16+
### Prerequisites
17+
18+
- Coder account at https://coder.dev.simpleaccounts.io
19+
- VS Code or Cursor IDE
20+
- Coder extension installed
21+
22+
### Setup Steps
23+
24+
1. **Install Coder Extension**
25+
26+
```
27+
VS Code/Cursor → Extensions → Search "Coder" → Install
28+
```
29+
30+
2. **Connect to Coder**
31+
32+
```
33+
Command Palette (Cmd+Shift+P)
34+
→ "Coder: Login"
35+
→ URL: https://coder.dev.simpleaccounts.io
36+
→ Paste your session token
37+
```
38+
39+
3. **Open Workspace**
40+
```
41+
→ "Coder: Open Workspace"
42+
→ Select: SimpleAccounts-UAE
43+
```
44+
45+
### ⚠️ Important: Don't Use Devcontainer in Coder
46+
47+
When connecting to Coder:
48+
49+
-**DO NOT** click "Reopen in Container" if prompted
50+
-**DO NOT** use Remote-Containers extension
51+
-**DO** use Coder extension or plain Remote-SSH
52+
53+
**Why?** The Coder workspace is already a fully configured container. Using devcontainer creates nested containers and causes permission errors.
54+
55+
### What's Included
56+
57+
- ✅ PostgreSQL (auto-configured)
58+
- ✅ Redis (auto-configured)
59+
- ✅ All CLI tools (Maven, npm, gh, etc.)
60+
- ✅ VS Code extensions pre-installed
61+
- ✅ Automatic updates
62+
63+
### Quick Commands
64+
65+
```bash
66+
# Frontend
67+
cd apps/frontend && npm run dev
68+
69+
# Backend
70+
cd apps/backend && ./mvnw spring-boot:run
71+
```
72+
73+
---
74+
75+
## 🏠 Option 2: Local Devcontainer
76+
77+
### Prerequisites
78+
79+
- Docker Desktop installed and running
80+
- VS Code with Remote-Containers extension
81+
- At least 8GB RAM available
82+
83+
### Setup Steps
84+
85+
1. **Open in VS Code**
86+
87+
```
88+
code /path/to/SimpleAccounts-UAE
89+
```
90+
91+
2. **Reopen in Container**
92+
93+
```
94+
Command Palette → "Dev Containers: Reopen in Container"
95+
OR
96+
Click "Reopen in Container" when prompted
97+
```
98+
99+
3. **Wait for Setup** (5-10 minutes first time)
100+
- Downloads Docker images
101+
- Installs dependencies
102+
- Configures database
103+
104+
### What Happens
105+
106+
- Creates PostgreSQL container
107+
- Creates Redis container
108+
- Creates devcontainer with all tools
109+
- Runs post-create setup scripts
110+
111+
### Configuration Files
112+
113+
- `.devcontainer/devcontainer.json` - VS Code config
114+
- `.devcontainer/docker-compose.yml` - Container setup
115+
- `.devcontainer/Dockerfile` - Container image
116+
- `.devcontainer/post-create.sh` - One-time setup
117+
- `.devcontainer/post-start.sh` - Runs on each start
118+
119+
---
120+
121+
## 🔧 Troubleshooting
122+
123+
### "Reopen in Container" in Coder
124+
125+
**Problem:** VS Code prompts to reopen in container when connected to Coder
126+
**Solution:** Click "Cancel" or "Don't Reopen" - you're already in a container!
127+
128+
### Permission Denied Errors
129+
130+
**Problem:** `mkdir: cannot create directory: Permission denied`
131+
**Solution:**
132+
133+
- In Coder: Should be fixed by PR #419
134+
- In Local: Rebuild container (`Dev Containers: Rebuild Container`)
135+
136+
### Maven 403 Forbidden
137+
138+
**Problem:** Maven can't download dependencies
139+
**Solution:** Fixed by PR #418 (Maven settings.xml auto-installed)
140+
141+
### npm EACCES Errors
142+
143+
**Problem:** npm can't write files
144+
**Solution:** Fixed by PR #419 (workspace ownership)
145+
146+
---
147+
148+
## 🏗️ Architecture
149+
150+
### Local Devcontainer Stack
151+
152+
```
153+
┌─────────────────────────────────┐
154+
│ VS Code (your machine) │
155+
└────────────┬────────────────────┘
156+
157+
┌────────────▼────────────────────┐
158+
│ Docker Desktop │
159+
│ ┌──────────────────────────┐ │
160+
│ │ Devcontainer │ │
161+
│ │ - Node.js, Java, Tools │ │
162+
│ └──────────────────────────┘ │
163+
│ ┌──────────────────────────┐ │
164+
│ │ PostgreSQL Container │ │
165+
│ └──────────────────────────┘ │
166+
│ ┌──────────────────────────┐ │
167+
│ │ Redis Container │ │
168+
│ └──────────────────────────┘ │
169+
└─────────────────────────────────┘
170+
```
171+
172+
### Coder Cloud Stack
173+
174+
```
175+
┌─────────────────────────────────┐
176+
│ VS Code (your machine) │
177+
│ + Coder Extension │
178+
└────────────┬────────────────────┘
179+
│ SSH/WebSocket
180+
┌────────────▼────────────────────┐
181+
│ Coder Workspace (cloud) │
182+
│ ┌──────────────────────────┐ │
183+
│ │ Main Container │ │
184+
│ │ - All tools included │ │
185+
│ │ - PostgreSQL │ │
186+
│ │ - Redis │ │
187+
│ └──────────────────────────┘ │
188+
└─────────────────────────────────┘
189+
```
190+
191+
**Key Difference:** Coder uses a **single container** with everything pre-configured. Local uses **multiple containers** orchestrated by docker-compose.
192+
193+
---
194+
195+
## 🤝 Team Recommendations
196+
197+
- **Onboarding**: Start with Coder (faster, no local setup)
198+
- **Daily Development**: Use Coder (consistent environment)
199+
- **Offline Work**: Use local devcontainer
200+
- **Custom Experiments**: Use local devcontainer
201+
202+
---
203+
204+
## 📚 Additional Resources
205+
206+
- [Coder Documentation](https://coder.com/docs)
207+
- [VS Code Devcontainers](https://code.visualstudio.com/docs/devcontainers/containers)
208+
- [SimpleAccounts Coder Setup](.coder/README.md)
209+
- [Devcontainer Config](.devcontainer/README.md)

0 commit comments

Comments
 (0)