Skip to content

Commit 1994141

Browse files
MohsinHashmi-DataInnmohsin-wiserclaude
authored
fix: DevPod setup improvements and devcontainer optimizations (#377)
* fix: suppress act() warnings and unhandled rejections in tests Configure testing-library for React 18+ and suppress harmless act() warnings that occur due to async state updates completing after test cleanup. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: docker-compose env_file syntax for older compose versions - Remove unsupported path/required syntax for env_file - Add INACTIVITY_TIMEOUT=10m to devpod setup script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * perf: optimize devcontainer for faster startup - Add code-server installation to Docker image (was failing as feature) - Pre-create user directories (~/.m2, ~/.npm, ~/.cache) in image - Simplify post-create.sh by removing redundant directory creation - Reduces container startup time by ~40 seconds 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: add multi-user dev environment with traefik proxy Add reverse proxy setup to enable multiple developers to work on the same dev-server with isolated environments and shareable URLs. Features: - Traefik reverse proxy for dynamic routing - Per-user isolated containers (db, redis, devcontainer) - nip.io support for zero-config DNS resolution - Local domain support for /etc/hosts configuration - Automated setup script for new users 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: update devcontainer documentation for multi-user setup - Add quick start guide for both single-user and multi-user setups - Document architecture diagrams for both configurations - Add multi-user option to NEW-USER-ONBOARDING.md - Expand proxy/README.md with complete usage guide - Include troubleshooting sections for both setups 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Mohsin Hashmi <mhashmi@wiser.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 898eba0 commit 1994141

12 files changed

Lines changed: 1151 additions & 115 deletions

.devcontainer/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium
9090
# Install global npm packages and AI CLI tools
9191
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g npm@latest" 2>&1
9292

93+
# Install code-server for web-based IDE access
94+
RUN curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/usr/local \
95+
&& echo "Code-server installed successfully"
96+
9397
# Install AI CLI tools (Claude, Codex, OpenAI, Gemini)
9498
# These are pre-installed but will be updated on container start via install-cli-tools.sh
9599
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && \
@@ -147,7 +151,13 @@ RUN . /usr/local/share/nvm/nvm.sh && (npm ci --legacy-peer-deps --ignore-scripts
147151
USER root
148152
RUN rm -rf /tmp/backend /tmp/root /tmp/frontend
149153

154+
# Pre-create user directories to avoid permission issues in post-create
155+
USER vscode
156+
RUN mkdir -p ~/.m2/repository ~/.m2/wrapper/dists ~/.npm ~/.cache/ms-playwright \
157+
&& chmod -R 755 ~/.m2 ~/.npm ~/.cache
158+
150159
# Reset working directory
160+
USER root
151161
WORKDIR /workspaces
152162

153163
# Default command
Lines changed: 174 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,102 @@
1-
# New User Onboarding for DevPod
1+
# New User Onboarding
22

3-
## One-Click Setup (Recommended)
3+
Welcome to SimpleAccounts UAE development! Choose your setup based on your environment.
44

5-
### For Admin: Add New User
5+
## Choose Your Setup
6+
7+
| Setup | Best For | Command |
8+
|-------|----------|---------|
9+
| **Multi-User (Recommended)** | Shared dev server, team collaboration | `./setup-user.sh <username>` |
10+
| **Single User** | Local development, solo work | `devpod up simpleaccounts-uae` |
11+
12+
---
13+
14+
## Option 1: Multi-User Setup (Shared Dev Server)
15+
16+
Best for teams sharing a development server. Each developer gets isolated containers with shareable URLs.
17+
18+
### Quick Start
19+
20+
```bash
21+
# SSH into the dev server
22+
ssh <your-username>@<dev-server-ip>
23+
24+
# Navigate to the project
25+
cd /path/to/SimpleAccounts-UAE/.devcontainer/proxy
26+
27+
# Setup your environment (auto-starts proxy if needed)
28+
./setup-user.sh <your-username>
29+
```
30+
31+
### What You Get
32+
33+
After running the setup script, you'll see:
34+
35+
```
36+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
37+
Option 1: nip.io URLs (No DNS config needed!)
38+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
39+
Frontend: http://alice.192-168-1-100.nip.io
40+
Backend: http://alice-api.192-168-1-100.nip.io
41+
Dashboard: http://proxy.192-168-1-100.nip.io:8090
42+
```
43+
44+
### Connect VS Code
45+
46+
1. Open VS Code
47+
2. Install "Dev Containers" extension
48+
3. `Cmd+Shift+P` > "Dev Containers: Attach to Running Container"
49+
4. Select `dev-<your-username>`
50+
51+
### Share Your Environment
52+
53+
Share your URLs with teammates for code review or pair programming:
54+
55+
```
56+
http://alice.192-168-1-100.nip.io
57+
```
58+
59+
Anyone on the same network can access your running application!
60+
61+
### Architecture
62+
63+
```
64+
Dev Server
65+
┌──────────────────────────────────────────────────────────────┐
66+
│ ┌─────────────────┐ │
67+
│ │ Traefik Proxy │ ← Shared reverse proxy │
68+
│ └────────┬────────┘ │
69+
│ │ │
70+
│ ┌─────┴─────┬─────────────┐ │
71+
│ ▼ ▼ ▼ │
72+
│ ┌──────┐ ┌──────┐ ┌──────┐ │
73+
│ │alice │ │ bob │ │carol │ ← Isolated per user │
74+
│ │ + DB │ │ + DB │ │ + DB │ │
75+
│ └──────┘ └──────┘ └──────┘ │
76+
└──────────────────────────────────────────────────────────────┘
77+
```
78+
79+
---
80+
81+
## Option 2: Single User Setup (DevPod)
82+
83+
Best for local development or when you have your own machine.
84+
85+
### One-Click Setup (Recommended)
86+
87+
#### For Admin: Add New User
688

789
1. Get the user's **public SSH key** (ask them to run `cat ~/.ssh/id_ed25519.pub`)
890

991
2. On the server, run:
92+
1093
```bash
1194
sudo ./scripts/admin-add-user.sh <username> "<public-ssh-key>"
1295
```
1396

1497
3. Send the user the generated one-liner command
1598

16-
### For User: Start Coding
99+
#### For User: Start Coding
17100

18101
Run the one-liner provided by your admin:
19102

@@ -22,13 +105,12 @@ curl -sSL https://raw.githubusercontent.com/SimpleAccounts/SimpleAccounts-UAE/de
22105
```
23106

24107
That's it! Then open VS Code:
108+
25109
```bash
26110
devpod up simpleaccounts-uae --ide vscode
27111
```
28112

29-
---
30-
31-
## Alternative: Full Self-Service Setup
113+
### Alternative: Full Self-Service Setup
32114

33115
If you need to set up everything yourself:
34116

@@ -37,6 +119,7 @@ curl -sSL https://raw.githubusercontent.com/SimpleAccounts/SimpleAccounts-UAE/de
37119
```
38120

39121
This will:
122+
40123
1. Install DevPod (if needed)
41124
2. Generate SSH key
42125
3. Copy key to server (requires password)
@@ -48,15 +131,27 @@ This will:
48131

49132
## Quick Reference
50133

51-
| Task | Command |
52-
|------|---------|
53-
| Open in VS Code | `devpod up simpleaccounts-uae --ide vscode` |
54-
| SSH into workspace | `ssh simpleaccounts-uae.devpod` |
55-
| Web IDE (browser) | `http://localhost:8443` (after SSH) |
56-
| Stop workspace | `devpod stop simpleaccounts-uae` |
57-
| Start workspace | `devpod up simpleaccounts-uae` |
58-
| Delete workspace | `devpod delete simpleaccounts-uae` |
59-
| View logs | `devpod logs simpleaccounts-uae` |
134+
### Multi-User Commands
135+
136+
| Task | Command |
137+
| --------------------- | --------------------------------------------------- |
138+
| Setup environment | `./setup-user.sh <username>` |
139+
| List active users | `docker ps --filter "name=dev-"` |
140+
| Stop your environment | `docker compose -f docker-compose.<user>.yml down` |
141+
| View your logs | `docker logs dev-<username>` |
142+
| Attach VS Code | Dev Containers: Attach to Running Container |
143+
144+
### Single-User (DevPod) Commands
145+
146+
| Task | Command |
147+
| ----------------- | ----------------------------------------- |
148+
| Open in VS Code | `devpod up simpleaccounts-uae --ide vscode` |
149+
| SSH into workspace | `ssh simpleaccounts-uae.devpod` |
150+
| Web IDE (browser) | `http://localhost:8443` (after SSH) |
151+
| Stop workspace | `devpod stop simpleaccounts-uae` |
152+
| Start workspace | `devpod up simpleaccounts-uae` |
153+
| Delete workspace | `devpod delete simpleaccounts-uae` |
154+
| View logs | `devpod logs simpleaccounts-uae` |
60155

61156
---
62157

@@ -65,9 +160,6 @@ This will:
65160
After your workspace is running, authenticate these services:
66161

67162
```bash
68-
# SSH into workspace
69-
ssh simpleaccounts-uae.devpod
70-
71163
# Authenticate GitHub
72164
gh auth login
73165

@@ -79,7 +171,34 @@ claude
79171

80172
## Troubleshooting
81173

82-
### SSH Connection Failed
174+
### Multi-User Setup
175+
176+
#### URL not accessible
177+
178+
```bash
179+
# Check proxy is running
180+
docker ps | grep dev-proxy
181+
182+
# Check your container is running
183+
docker ps | grep dev-<username>
184+
185+
# View proxy logs
186+
docker logs dev-proxy
187+
```
188+
189+
#### Container won't start
190+
191+
```bash
192+
# Check logs
193+
docker logs dev-<username>
194+
195+
# Check compose file
196+
cat .devcontainer/proxy/docker-compose.<username>.yml
197+
```
198+
199+
### Single-User (DevPod) Setup
200+
201+
#### SSH Connection Failed
83202

84203
```bash
85204
# Test SSH directly
@@ -89,7 +208,7 @@ ssh <username>-devpod
89208
ssh <username>@<server> 'cat ~/.ssh/authorized_keys'
90209
```
91210

92-
### Workspace Won't Start
211+
#### Workspace Won't Start
93212

94213
```bash
95214
# Check status
@@ -103,7 +222,7 @@ devpod delete simpleaccounts-uae
103222
devpod up git@github.com:SimpleAccounts/SimpleAccounts-UAE.git --provider <username>-ssh --id simpleaccounts-uae
104223
```
105224

106-
### Permission Denied in Container
225+
#### Permission Denied in Container
107226

108227
```bash
109228
# On server, fix ownership
@@ -112,13 +231,37 @@ sudo chown -R 1000:1000 /home/<username>/.devpod-mount/
112231

113232
---
114233

115-
## Architecture
234+
## Architecture Comparison
235+
236+
### Multi-User (Shared Server)
237+
238+
```
239+
┌──────────────────────────────────────────────────────────────┐
240+
│ Dev Server │
241+
│ ┌─────────────────┐ │
242+
│ │ Traefik Proxy │ ← Routes by hostname │
243+
│ └────────┬────────┘ │
244+
│ │ │
245+
│ ┌────────┴────────┐ │
246+
│ │ User Containers │ ← Each user isolated │
247+
│ │ (alice, bob...) │ │
248+
│ └──────────────────┘ │
249+
└──────────────────────────────────────────────────────────────┘
250+
251+
│ HTTP (nip.io URLs)
252+
253+
┌────────┴────────┐
254+
│ Your Browser │
255+
└─────────────────┘
256+
```
257+
258+
### Single-User (DevPod)
116259

117260
```
118261
┌──────────────────────────────────────────────────────────────┐
119262
│ Your Machine │
120263
│ ┌────────────────┐ │
121-
│ │ DevPod Client │ ──SSH──► Dev Server (65.108.51.136)
264+
│ │ DevPod Client │ ──SSH──► Dev Server
122265
│ │ VS Code │ ┌──────────────────────────┐ │
123266
│ └────────────────┘ │ Docker Container │ │
124267
│ │ ├─ PostgreSQL :5432 │ │
@@ -134,8 +277,10 @@ sudo chown -R 1000:1000 /home/<username>/.devpod-mount/
134277

135278
## Scripts Reference
136279

137-
| Script | Location | Purpose |
138-
|--------|----------|---------|
139-
| `admin-add-user.sh` | `scripts/` | Admin adds new user with SSH key |
140-
| `user-quick-setup.sh` | `scripts/` | User one-click setup |
141-
| `devpod-setup.sh` | `scripts/` | Full self-service setup |
280+
| Script | Location | Purpose |
281+
| ----------------------------- | -------------------- | -------------------------------- |
282+
| `setup-user.sh` | `.devcontainer/proxy/` | Multi-user environment setup |
283+
| `generate-hosts.sh` | `.devcontainer/proxy/` | Generate /etc/hosts entries |
284+
| `admin-add-user.sh` | `scripts/` | Admin adds new DevPod user |
285+
| `user-quick-setup.sh` | `scripts/` | User one-click DevPod setup |
286+
| `devpod-setup.sh` | `scripts/` | Full self-service DevPod setup |

0 commit comments

Comments
 (0)