Skip to content

Commit 785e524

Browse files
committed
Add e2e mini apps with devcontainer setup
1 parent 25c716a commit 785e524

20 files changed

Lines changed: 2019 additions & 32 deletions

.devcontainer/.env.example

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
IMAGE=bitnami/ruby
1+
# Official Ruby images
2+
IMAGE=ruby
23

34
# Adjust as needed
4-
TAG=3.4
5+
VERSION=3.4.5
56

67
# IMAGE=jruby
78
# TAG=latest
9+
10+
# E2E testing
11+
SENTRY_DSN="http://user:pass@sentry.localhost/project/42"
12+
SENTRY_DSN_JS="http://user:pass@sentry-js.localhost/project/43"
13+
14+
SENTRY_E2E_RAILS_APP_PORT=4000
15+
SENTRY_E2E_SVELTE_APP_PORT=4001
16+
17+
SENTRY_E2E_RAILS_APP_URL="http://sentry-rails-mini:4000"
18+
SENTRY_E2E_SVELTE_APP_URL="http://sentry-svelte-mini:4001"

.devcontainer/Dockerfile

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
ARG IMAGE="bitnami/ruby"
2-
ARG TAG="latest"
1+
ARG IMAGE="ruby"
2+
ARG VERSION="3.4.5"
3+
ARG DISTRO="slim-bookworm"
34

4-
FROM ${IMAGE}:${TAG}
5+
FROM ${IMAGE}:${VERSION}-${DISTRO} AS build
56

6-
USER root
7-
RUN apt-get update && apt-get install -y \
7+
RUN apt-get update && apt-get install -y --no-install-recommends \
8+
sudo \
89
gnupg \
910
git \
1011
curl \
1112
wget \
12-
zsh \
13-
vim \
1413
build-essential \
15-
sudo \
14+
pkg-config \
1615
libssl-dev \
1716
libreadline-dev \
1817
zlib1g-dev \
@@ -22,31 +21,74 @@ RUN apt-get update && apt-get install -y \
2221
libncurses5-dev \
2322
libffi-dev \
2423
libgdbm-dev \
24+
sqlite3 \
25+
nodejs \
26+
npm \
2527
&& apt-get clean \
2628
&& rm -rf /var/lib/apt/lists/*
2729

28-
RUN groupadd --gid 1000 sentry \
29-
&& useradd --uid 1000 --gid sentry --shell /bin/zsh --create-home sentry
30-
31-
# Add sentry to sudoers with NOPASSWD option
3230
RUN echo "sentry ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/sentry \
3331
&& chmod 0440 /etc/sudoers.d/sentry
3432

33+
RUN groupadd --gid 1000 sentry \
34+
&& useradd --uid 1000 --gid sentry --shell /bin/bash --create-home sentry
35+
3536
WORKDIR /workspace/sentry
3637

3738
RUN chown -R sentry:sentry /workspace/sentry
38-
RUN mkdir /workspace/gems && chown -R sentry:sentry /workspace/gems
3939

40-
ARG TAG=latest
41-
ARG GEM_HOME="/workspace/gems/${TAG}"
40+
ARG VERSION
41+
ARG GEM_HOME="/workspace/gems/${VERSION}"
42+
43+
RUN mkdir /workspace/gems && chown -R sentry:sentry /workspace/gems
4244

4345
ENV LANG=C.UTF-8 \
4446
BUNDLE_JOBS=4 \
4547
BUNDLE_RETRY=3 \
46-
GEM_HOME=/workspace/gems/${TAG} \
48+
GEM_HOME=/workspace/gems/${VERSION} \
4749
PATH=$PATH:${GEM_HOME}/bin \
4850
REDIS_HOST=redis
4951

52+
FROM build AS dev
53+
54+
RUN apt-get update && apt-get install -y --no-install-recommends \
55+
chromium \
56+
chromium-driver \
57+
&& apt-get clean \
58+
&& rm -rf /var/lib/apt/lists/*
59+
60+
USER sentry
61+
62+
COPY entrypoint-sentry-dev.sh /workspace/entrypoint.sh
63+
64+
ENTRYPOINT ["/workspace/entrypoint.sh"]
65+
66+
FROM build AS test
67+
68+
RUN apt-get update && apt-get install -y --no-install-recommends \
69+
chromium \
70+
chromium-driver \
71+
&& apt-get clean \
72+
&& rm -rf /var/lib/apt/lists/*
73+
74+
USER sentry
75+
76+
COPY entrypoint-sentry-test.sh /workspace/entrypoint.sh
77+
78+
ENTRYPOINT ["/workspace/entrypoint.sh"]
79+
80+
FROM build AS rails-mini
81+
82+
USER sentry
83+
84+
COPY entrypoint-rails-mini.sh /workspace/entrypoint.sh
85+
86+
ENTRYPOINT ["/workspace/entrypoint.sh"]
87+
88+
FROM build AS svelte-mini
89+
5090
USER sentry
5191

52-
CMD ["ruby", "--version"]
92+
COPY entrypoint-svelte-mini.sh /workspace/entrypoint.sh
93+
94+
ENTRYPOINT ["/workspace/entrypoint.sh"]

.devcontainer/devcontainer.json

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
{
22
"name": "sentry-ruby",
33
"dockerComposeFile": "docker-compose.yml",
4-
"service": "app",
4+
"service": "sentry-dev",
55
"workspaceFolder": "/workspace/sentry",
6+
"features": {
7+
"ghcr.io/devcontainers/features/github-cli": {},
8+
"ghcr.io/nils-geistmann/devcontainers-features/zsh": {},
9+
"ghcr.io/devcontainers-extra/features/npm-packages": {},
10+
"ghcr.io/rocker-org/devcontainer-features/apt-packages": {
11+
"packages": "inotify-tools"
12+
}
13+
},
614
"customizations": {
715
"vscode": {
816
"extensions": [
917
"sleistner.vscode-fileutils",
1018
"Shopify.ruby-lsp"
1119
],
12-
"settings": {}
13-
},
14-
"rubyLsp.rubyVersionManager": {
15-
"identifier": "none"
20+
"editor.formatOnSaveMode": "modifications",
21+
"editor.formatOnSave": true,
22+
"rubyLsp.rubyVersionManager": {
23+
"identifier": "auto"
24+
},
25+
"rubyLsp.formatter": "auto"
1626
}
1727
},
18-
"remoteUser": "sentry",
19-
"postCreateCommand": "ruby --version"
28+
"remoteUser": "sentry"
2029
}

.devcontainer/docker-compose.yml

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,94 @@
11
services:
2-
app:
2+
sentry-dev:
33
build:
44
context: .
55
dockerfile: Dockerfile
6+
target: dev
67
args:
7-
IMAGE: ${IMAGE}
8-
TAG: ${TAG}
8+
IMAGE: ${IMAGE:-ruby}
9+
VERSION: ${VERSION:-3.4.5}
910
volumes:
1011
- ..:/workspace/sentry:cached
12+
- sentry_e2e_logs:/workspace/sentry/log
13+
- sentry_ruby_gems:/workspace/gems
14+
working_dir: /workspace/sentry
1115
command: sleep infinity
16+
env_file: [".env"]
17+
depends_on:
18+
- redis
19+
20+
sentry-test:
21+
build:
22+
context: .
23+
dockerfile: Dockerfile
24+
target: test
25+
args:
26+
IMAGE: ${IMAGE}
27+
VERSION: ${VERSION}
28+
volumes:
29+
- ..:/workspace/sentry:cached
30+
- sentry_e2e_logs:/workspace/sentry/log
31+
- sentry_ruby_gems:/workspace/gems
32+
working_dir: /workspace/sentry
1233
environment:
1334
- REDIS_URL=${REDIS_URL:-redis://redis:6379/0}
35+
env_file: [".env"]
1436
depends_on:
1537
- redis
38+
- sentry-rails-mini
39+
- sentry-svelte-mini
40+
profiles:
41+
- e2e
42+
43+
sentry-rails-mini:
44+
build:
45+
context: .
46+
dockerfile: Dockerfile
47+
target: rails-mini
48+
args:
49+
IMAGE: ${IMAGE}
50+
VERSION: ${VERSION}
51+
working_dir: /workspace/sentry/spec/apps/rails-mini
52+
volumes:
53+
- ..:/workspace/sentry:cached
54+
- sentry_e2e_logs:/workspace/sentry/log
55+
- sentry_ruby_gems:/workspace/gems
56+
ports:
57+
- "${SENTRY_E2E_RAILS_APP_PORT:-4000}:4000"
58+
command: ruby app.rb
59+
profiles:
60+
- e2e
61+
env_file: [".env"]
62+
63+
sentry-svelte-mini:
64+
build:
65+
context: .
66+
dockerfile: Dockerfile
67+
target: svelte-mini
68+
args:
69+
IMAGE: ${IMAGE}
70+
VERSION: ${VERSION}
71+
working_dir: /workspace/sentry/spec/apps/svelte-mini
72+
volumes:
73+
- ..:/workspace/sentry:cached
74+
- sentry_node_modules:/workspace/sentry/spec/apps/svelte-mini/node_modules
75+
ports:
76+
- "${SENTRY_E2E_SVELTE_APP_PORT:-4001}:4001"
77+
command: sh -c "cd /workspace/sentry/spec/apps/svelte-mini && npm run dev -- --host 0.0.0.0"
78+
environment:
79+
SENTRY_E2E_RAILS_APP_URL: "http://sentry-rails-mini:${SENTRY_E2E_RAILS_APP_PORT:-4000}"
80+
profiles:
81+
- e2e
82+
env_file: [".env"]
1683

1784
redis:
1885
image: redis:latest
1986
environment:
2087
- ALLOW_EMPTY_PASSWORD=yes
2188
ports:
2289
- "6379:6379"
90+
91+
volumes:
92+
sentry_e2e_logs:
93+
sentry_ruby_gems:
94+
sentry_node_modules:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
sudo chown -R sentry:sentry /workspace/sentry/log
6+
7+
cd /workspace/sentry/spec/apps/rails-mini
8+
9+
echo "Installing Ruby dependencies for Rails mini..."
10+
bundle install
11+
12+
exec "$@"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
sudo chown -R sentry:sentry /workspace/sentry/log
6+
7+
echo "Setting up sentry-test environment..."
8+
cd /workspace/sentry
9+
10+
.devcontainer/setup --with-foreman
11+
12+
exec "$@"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
sudo chown -R sentry:sentry /workspace/sentry
6+
7+
echo "Setting up sentry-test environment..."
8+
cd /workspace/sentry
9+
10+
git config --global --add safe.directory /workspace/sentry
11+
12+
echo "Installing bundle dependencies in /workspace/sentry..."
13+
bundle install
14+
15+
echo "✅ sentry-test setup completed!"
16+
17+
exec "$@"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Installing npm dependencies for Svelte mini..."
5+
6+
# Ensure proper ownership of node_modules directory
7+
sudo chown -R sentry:sentry /workspace/sentry/spec/apps/svelte-mini/node_modules
8+
9+
# Install npm dependencies
10+
cd /workspace/sentry/spec/apps/svelte-mini
11+
npm install
12+
13+
exec "$@"

0 commit comments

Comments
 (0)