Skip to content

Commit 7f82ed3

Browse files
v0.4.13: bugfixes for dev containers, posthog redirect, helm updates
2 parents 219a065 + 3dd36a8 commit 7f82ed3

31 files changed

+1442
-1109
lines changed

.devcontainer/.bashrc

Lines changed: 0 additions & 69 deletions
This file was deleted.

.devcontainer/Dockerfile

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,43 @@
1-
# Use the latest Bun canary image for development
2-
FROM oven/bun:canary
3-
4-
# Avoid warnings by switching to noninteractive
5-
ENV DEBIAN_FRONTEND=noninteractive
1+
FROM oven/bun:1.2.22-alpine
62

73
# Install necessary packages for development
8-
RUN apt-get update \
9-
&& apt-get -y install --no-install-recommends \
10-
git curl wget jq sudo postgresql-client vim nano \
11-
bash-completion ca-certificates lsb-release gnupg \
12-
&& apt-get clean -y \
13-
&& rm -rf /var/lib/apt/lists/*
14-
15-
# Create a non-root user
4+
RUN apk add --no-cache \
5+
git \
6+
curl \
7+
wget \
8+
jq \
9+
sudo \
10+
postgresql-client \
11+
vim \
12+
nano \
13+
bash \
14+
bash-completion \
15+
zsh \
16+
zsh-vcs \
17+
ca-certificates \
18+
shadow
19+
20+
# Create a non-root user with matching UID/GID
1621
ARG USERNAME=bun
1722
ARG USER_UID=1000
1823
ARG USER_GID=$USER_UID
1924

25+
# Create user group if it doesn't exist
26+
RUN if ! getent group $USER_GID >/dev/null; then \
27+
addgroup -g $USER_GID $USERNAME; \
28+
fi
29+
30+
# Create user if it doesn't exist
31+
RUN if ! getent passwd $USER_UID >/dev/null; then \
32+
adduser -D -u $USER_UID -G $(getent group $USER_GID | cut -d: -f1) $USERNAME; \
33+
fi
34+
2035
# Add sudo support
2136
RUN echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USERNAME \
2237
&& chmod 0440 /etc/sudoers.d/$USERNAME
2338

24-
# Install global packages for development
25-
RUN bun install -g turbo drizzle-kit typescript @types/node
26-
27-
# Install bun completions
28-
RUN bun completions > /etc/bash_completion.d/bun
29-
3039
# Set up shell environment
31-
RUN echo "export PATH=$PATH:/home/$USERNAME/.bun/bin" >> /etc/profile
32-
RUN echo "source /etc/profile" >> /etc/bash.bashrc
33-
34-
# Switch back to dialog for any ad-hoc use of apt-get
35-
ENV DEBIAN_FRONTEND=dialog
40+
RUN echo "export PATH=\$PATH:/home/$USERNAME/.bun/bin" >> /etc/profile
3641

3742
WORKDIR /workspace
3843

.devcontainer/README.md

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,75 @@
11
# Sim Development Container
22

3-
This directory contains configuration files for Visual Studio Code Dev Containers / GitHub Codespaces. Dev containers provide a consistent, isolated development environment for this project.
3+
Development container configuration for VS Code Dev Containers and GitHub Codespaces.
44

5-
## Contents
5+
## Prerequisites
66

7-
- `devcontainer.json` - The main configuration file that defines the development container settings
8-
- `Dockerfile` - Defines the container image and development environment
9-
- `docker-compose.yml` - Sets up the application and database containers
10-
- `post-create.sh` - Script that runs when the container is created
11-
- `.bashrc` - Custom shell configuration with helpful aliases
7+
- Visual Studio Code
8+
- Docker Desktop or Podman Desktop
9+
- VS Code Dev Containers extension
1210

13-
## Usage
11+
## Getting Started
1412

15-
### Prerequisites
13+
1. Open this project in VS Code
14+
2. Click "Reopen in Container" when prompted (or press `F1` → "Dev Containers: Reopen in Container")
15+
3. Wait for the container to build and initialize
16+
4. Start developing with `sim-start`
1617

17-
- Visual Studio Code
18-
- Docker installation:
19-
- Docker Desktop (Windows/macOS)
20-
- Docker Engine (Linux)
21-
- VS Code Remote - Containers extension
18+
The setup script will automatically install dependencies and run migrations.
2219

23-
### Getting Started
20+
## Development Commands
2421

25-
1. Open this project in Visual Studio Code
26-
2. When prompted, click "Reopen in Container"
27-
- Alternatively, press `F1` and select "Remote-Containers: Reopen in Container"
28-
3. Wait for the container to build and initialize
29-
4. The post-creation script will automatically:
22+
### Running Services
3023

31-
- Install dependencies
32-
- Set up environment variables
33-
- Run database migrations
34-
- Configure helpful aliases
24+
You have two options for running the development environment:
3525

36-
5. Start the application with `sim-start` (alias for `bun run dev`)
26+
**Option 1: Run everything together (recommended for most development)**
27+
```bash
28+
sim-start # Runs both app and socket server using concurrently
29+
```
3730

38-
### Development Commands
31+
**Option 2: Run services separately (useful for debugging individual services)**
32+
- In the **app** container terminal: `sim-app` (starts Next.js app on port 3000)
33+
- In the **realtime** container terminal: `sim-sockets` (starts socket server on port 3002)
3934

40-
The development environment includes these helpful aliases:
35+
### Other Commands
4136

42-
- `sim-start` - Start the development server
4337
- `sim-migrate` - Push schema changes to the database
4438
- `sim-generate` - Generate new migrations
45-
- `sim-rebuild` - Build and start the production version
46-
- `pgc` - Connect to the PostgreSQL database
47-
- `check-db` - List all databases
39+
- `build` - Build the application
40+
- `pgc` - Connect to PostgreSQL database
4841

49-
### Using GitHub Codespaces
42+
## Troubleshooting
5043

51-
This project is also configured for GitHub Codespaces. To use it:
44+
**Build errors**: Rebuild the container with `F1` → "Dev Containers: Rebuild Container"
5245

53-
1. Go to the GitHub repository
54-
2. Click the "Code" button
55-
3. Select the "Codespaces" tab
56-
4. Click "Create codespace on main"
46+
**Port conflicts**: Ensure ports 3000, 3002, and 5432 are available
5747

58-
This will start a new Codespace with the development environment already set up.
48+
**Container runtime issues**: Verify Docker Desktop or Podman Desktop is running
5949

60-
## Customization
50+
## Technical Details
6151

62-
You can customize the development environment by:
52+
Services:
53+
- **App container** (8GB memory limit) - Main Next.js application
54+
- **Realtime container** (4GB memory limit) - Socket.io server for real-time features
55+
- **Database** - PostgreSQL with pgvector extension
56+
- **Migrations** - Runs automatically on container creation
6357

64-
- Modifying `devcontainer.json` to add VS Code extensions or settings
65-
- Updating the `Dockerfile` to install additional packages
66-
- Editing `docker-compose.yml` to add services or change configuration
67-
- Modifying `.bashrc` to add custom aliases or configurations
58+
You can develop with services running together or independently.
6859

69-
## Troubleshooting
60+
### Personalization
7061

71-
If you encounter issues:
62+
**Project commands** (`sim-start`, `sim-app`, etc.) are automatically available via `/workspace/.devcontainer/sim-commands.sh`.
7263

73-
1. Rebuild the container: `F1` → "Remote-Containers: Rebuild Container"
74-
2. Check Docker logs for build errors
75-
3. Verify Docker Desktop is running
76-
4. Ensure all prerequisites are installed
64+
**Personal shell customization** (aliases, prompts, etc.) should use VS Code's dotfiles feature:
65+
1. Create a dotfiles repository (e.g., `github.com/youruser/dotfiles`)
66+
2. Add your `.bashrc`, `.zshrc`, or other configs
67+
3. Configure in VS Code Settings:
68+
```json
69+
{
70+
"dotfiles.repository": "youruser/dotfiles",
71+
"dotfiles.installCommand": "install.sh"
72+
}
73+
```
7774

78-
For more information, see the [VS Code Remote Development documentation](https://code.visualstudio.com/docs/remote/containers).
75+
This separates project-specific commands from personal preferences, following VS Code best practices.

.devcontainer/devcontainer.json

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
"source.fixAll.biome": "explicit",
1414
"source.organizeImports.biome": "explicit"
1515
},
16-
"terminal.integrated.defaultProfile.linux": "bash",
17-
"terminal.integrated.profiles.linux": {
18-
"bash": {
19-
"path": "/bin/bash",
20-
"args": ["--login"]
21-
}
22-
},
2316
"terminal.integrated.shellIntegration.enabled": true
2417
},
2518
"extensions": [
@@ -36,18 +29,9 @@
3629
}
3730
},
3831

39-
"forwardPorts": [3000, 5432],
32+
"forwardPorts": [3000, 3002, 5432],
4033

4134
"postCreateCommand": "bash -c 'bash .devcontainer/post-create.sh || true'",
4235

43-
"postStartCommand": "bash -c 'if [ ! -f ~/.bashrc ] || ! grep -q \"sim-start\" ~/.bashrc; then cp .devcontainer/.bashrc ~/.bashrc; fi'",
44-
45-
"remoteUser": "bun",
46-
47-
"features": {
48-
"ghcr.io/devcontainers/features/git:1": {},
49-
"ghcr.io/prulloac/devcontainer-features/bun:1": {
50-
"version": "latest"
51-
}
52-
}
36+
"remoteUser": "bun"
5337
}

.devcontainer/docker-compose.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,56 @@ services:
77
- ..:/workspace:cached
88
- bun-cache:/home/bun/.bun/cache:delegated
99
command: sleep infinity
10+
deploy:
11+
resources:
12+
limits:
13+
memory: 8G
1014
environment:
1115
- NODE_ENV=development
1216
- DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio
1317
- BETTER_AUTH_URL=http://localhost:3000
1418
- NEXT_PUBLIC_APP_URL=http://localhost:3000
19+
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-your_auth_secret_here}
20+
- ENCRYPTION_KEY=${ENCRYPTION_KEY:-your_encryption_key_here}
21+
- COPILOT_API_KEY=${COPILOT_API_KEY}
22+
- SIM_AGENT_API_URL=${SIM_AGENT_API_URL}
23+
- OLLAMA_URL=${OLLAMA_URL:-http://localhost:11434}
24+
- NEXT_PUBLIC_SOCKET_URL=${NEXT_PUBLIC_SOCKET_URL:-http://localhost:3002}
1525
- BUN_INSTALL_CACHE_DIR=/home/bun/.bun/cache
1626
depends_on:
1727
db:
1828
condition: service_healthy
19-
realtime:
20-
condition: service_healthy
2129
migrations:
2230
condition: service_completed_successfully
2331
ports:
2432
- "3000:3000"
2533
- "3001:3001"
2634
working_dir: /workspace
27-
healthcheck:
28-
test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3000']
29-
interval: 90s
30-
timeout: 5s
31-
retries: 3
32-
start_period: 10s
3335

3436
realtime:
3537
build:
3638
context: ..
3739
dockerfile: .devcontainer/Dockerfile
40+
volumes:
41+
- ..:/workspace:cached
42+
- bun-cache:/home/bun/.bun/cache:delegated
3843
command: sleep infinity
44+
deploy:
45+
resources:
46+
limits:
47+
memory: 4G
3948
environment:
4049
- NODE_ENV=development
4150
- DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio
4251
- BETTER_AUTH_URL=http://localhost:3000
4352
- NEXT_PUBLIC_APP_URL=http://localhost:3000
53+
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-your_auth_secret_here}
4454
depends_on:
4555
db:
4656
condition: service_healthy
4757
ports:
4858
- "3002:3002"
4959
working_dir: /workspace
50-
healthcheck:
51-
test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3002']
52-
interval: 90s
53-
timeout: 5s
54-
retries: 3
55-
start_period: 10s
5660

5761
migrations:
5862
build:

0 commit comments

Comments
 (0)