Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions .devcontainer/.env.example
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# Devcontainer configuration
RUBY_VERSION="3.4.9"

RUBY_VERSION=3.4.9

# E2E testing
SENTRY_DSN="http://user:pass@sentry.localhost/project/42"
# SENTRY_DSN_JS="http://user:pass@sentry-js.localhost/project/43"
SENTRY_DSN_JS=""
SENTRY_DSN=http://user:pass@sentry.localhost/project/42
# SENTRY_DSN_JS=http://user:pass@sentry-js.localhost/project/43
SENTRY_DSN_JS=

SENTRY_E2E_RAILS_APP_PORT=4000
SENTRY_E2E_SVELTE_APP_PORT=4001

SENTRY_E2E_RAILS_APP_URL="http://localhost:4000"
SENTRY_E2E_SVELTE_APP_URL="http://localhost:4001"
SENTRY_E2E_RAILS_APP_URL=http://localhost:4000
SENTRY_E2E_SVELTE_APP_URL=http://localhost:4001

# ActiveJob queue adapter under test: async | inline | sidekiq | resque | delayed_job | solid_queue
SENTRY_E2E_ACTIVE_JOB_ADAPTER="async"

# Redis for the sidekiq/resque adapters (the Compose service is named "redis")
REDIS_URL="redis://redis:6379"
SENTRY_E2E_ACTIVE_JOB_ADAPTER=async

# Faster builds with compose
COMPOSE_BAKE=true
# Redis for the sidekiq/resque adapters
REDIS_URL=redis://localhost:6379
38 changes: 6 additions & 32 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ RUN userdel -r ubuntu 2>/dev/null || true \
&& groupadd --gid 1000 sentry \
&& useradd --uid 1000 --gid sentry --shell /bin/bash --create-home sentry

WORKDIR /workspace/sentry
WORKDIR /workspaces/sentry-ruby

RUN chown -R sentry:sentry /workspace/sentry
RUN chown -R sentry:sentry /workspaces/sentry-ruby

ENV LANG=C.UTF-8 \
BUNDLE_JOBS=4 \
BUNDLE_RETRY=3 \
REDIS_HOST=redis \
REDIS_HOST=localhost \
PATH=/home/sentry/.local/share/mise/shims:/home/sentry/.local/bin:$PATH

USER sentry
Expand All @@ -52,32 +52,6 @@ USER sentry
# directory content when a volume is first attached).
RUN mkdir -p /home/sentry/bundle

RUN curl https://mise.run | sh \
&& echo 'eval "$(/home/sentry/.local/bin/mise activate bash)"' >> /home/sentry/.bashrc \
&& echo 'eval "$(/home/sentry/.local/bin/mise activate zsh)"' >> /home/sentry/.zshenv

# Pre-install Ruby at build time so the container starts immediately without
# downloading it at runtime. Switching Ruby versions requires a rebuild.
ARG RUBY_VERSION=latest

# Java is always installed (required for JRuby). It is listed in .mise.toml so
# it is available for all users regardless of which Ruby flavour they use.
RUN echo "📦 Pre-installing java@temurin-21..." && \
/home/sentry/.local/bin/mise install "java@temurin-21" && \
/home/sentry/.local/bin/mise use --global "java@temurin-21"

RUN echo "📦 Pre-installing ruby@${RUBY_VERSION} (precompiled)..." && \
MISE_RUBY_COMPILE=0 /home/sentry/.local/bin/mise install "ruby@${RUBY_VERSION}" && \
/home/sentry/.local/bin/mise use --global "ruby@${RUBY_VERSION}"

# Node.js is always needed for the svelte-mini e2e app.
RUN echo "📦 Pre-installing node@lts..." && \
/home/sentry/.local/bin/mise install "node@lts" && \
/home/sentry/.local/bin/mise use --global "node@lts"

# Install headless Chromium via Playwright (includes all system dependencies).
# Symlink the binary into ~/.local/bin which is already on PATH.
RUN /home/sentry/.local/share/mise/shims/npx playwright install chromium --with-deps
# Playwright lays out the binary under chrome-linux/ on arm64 and chrome-linux64/
# on x86_64 (since Playwright 1.57), so the glob has to match both.
RUN bash -c 'ln -sf /home/sentry/.cache/ms-playwright/chromium-*/chrome-linux*/chrome /home/sentry/.local/bin/chromium'
# Chromium, ChromeDriver, mise, and the toolchain (Java, Ruby, Node) are
# installed by the local `./features/tools` dev container feature, which runs
# after this Dockerfile — see devcontainer.json.
2 changes: 1 addition & 1 deletion .devcontainer/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
2.3.1
12 changes: 12 additions & 0 deletions .devcontainer/ci-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -euo pipefail

readonly WORKSPACE=/workspaces/sentry-ruby

sudo chown -R sentry:sentry "$WORKSPACE"

cd "$WORKSPACE"
mise trust "$WORKSPACE" >/dev/null

exec "$@"
21 changes: 8 additions & 13 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
{
"features": {
"ghcr.io/devcontainers-extra/features/npm-packages:latest": {
"version": "1.0.1",
"resolved": "ghcr.io/devcontainers-extra/features/npm-packages@sha256:0851cc312204f4044f22230986134026409565f9e632d8ab2b8c639e81cedd7c",
"integrity": "sha256:0851cc312204f4044f22230986134026409565f9e632d8ab2b8c639e81cedd7c"
"ghcr.io/devcontainers-extra/features/mise:latest": {
"version": "1.0.0",
"resolved": "ghcr.io/devcontainers-extra/features/mise@sha256:5c389ab1e3c8e44e5e0ff119f6868d54dbb781bc860bd8587dc66209cb8c4a8c",
"integrity": "sha256:5c389ab1e3c8e44e5e0ff119f6868d54dbb781bc860bd8587dc66209cb8c4a8c"
},
"ghcr.io/devcontainers/features/git:latest": {
"version": "1.3.5",
"resolved": "ghcr.io/devcontainers/features/git@sha256:27905dc196c01f77d6ba8709cb82eeaf330b3b108772e2f02d1cd0d826de1251",
"integrity": "sha256:27905dc196c01f77d6ba8709cb82eeaf330b3b108772e2f02d1cd0d826de1251"
"version": "1.3.8",
"resolved": "ghcr.io/devcontainers/features/git@sha256:fd75977de13a9979000e0e78baf949adb0ca71d2398995fa22e0a36d7e7e7fe2",
"integrity": "sha256:fd75977de13a9979000e0e78baf949adb0ca71d2398995fa22e0a36d7e7e7fe2"
},
"ghcr.io/devcontainers/features/github-cli:latest": {
"version": "1.1.0",
"resolved": "ghcr.io/devcontainers/features/github-cli@sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671",
"integrity": "sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671"
},
"ghcr.io/devcontainers/features/node:latest": {
"version": "2.0.0",
"resolved": "ghcr.io/devcontainers/features/node@sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f",
"integrity": "sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f"
},
"ghcr.io/nils-geistmann/devcontainers-features/zsh:latest": {
"version": "0.0.8",
"resolved": "ghcr.io/nils-geistmann/devcontainers-features/zsh@sha256:fd57a61a5187480b5e73f8041be5b67005be48f06503736df6cfdd8d0f38f3c4",
Expand All @@ -31,4 +26,4 @@
"integrity": "sha256:87a4d7750a596a5db034ba8508782f31aebdc2ffe955c66aaecb33d9de2ecdae"
}
}
}
}
36 changes: 30 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
{
"name": "sentry-ruby",
"dockerComposeFile": "docker-compose.yml",
"service": "sentry-dev",
"workspaceFolder": "/workspace/sentry",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"BASE_IMAGE": "${localEnv:BASE_IMAGE:ubuntu:24.04}"
}
},
"runArgs": ["--init"],
"mounts": [
"source=sentry-ruby-bundle,target=/home/sentry/bundle,type=volume"
],
"forwardPorts": [4000, 4001, 6379],
"containerEnv": {
"BUNDLE_PATH": "/home/sentry/bundle",
"SENTRY_DSN": "http://user:pass@sentry.localhost/project/42",
"SENTRY_DSN_JS": "",
"SENTRY_E2E_RAILS_APP_PORT": "4000",
"SENTRY_E2E_SVELTE_APP_PORT": "4001",
"SENTRY_E2E_RAILS_APP_URL": "http://localhost:4000",
"SENTRY_E2E_SVELTE_APP_URL": "http://localhost:4001",
"SENTRY_E2E_ACTIVE_JOB_ADAPTER": "async",
"REDIS_URL": "redis://localhost:6379"
Comment thread
cursor[bot] marked this conversation as resolved.
},
"postCreateCommand": "mise trust /workspaces/sentry-ruby",
"postStartCommand": "mise run services:redis",
"features": {
"ghcr.io/devcontainers/features/git:latest": {
"ppa": false,
"version": "2.54.0"
},
"ghcr.io/devcontainers/features/github-cli:latest": {},
"ghcr.io/nils-geistmann/devcontainers-features/zsh:latest": {},
"ghcr.io/devcontainers/features/node:latest": {},
"ghcr.io/devcontainers-extra/features/npm-packages:latest": {},
"ghcr.io/devcontainers-extra/features/mise:latest": {},
"./features/tools": {
"rubyVersion": "${localEnv:RUBY_VERSION:4.0}"
},
"ghcr.io/rocker-org/devcontainer-features/apt-packages:latest": {
"packages": "inotify-tools,tzdata"
"packages": "inotify-tools,tzdata,redis-server"
}
},
"customizations": {
Expand Down
51 changes: 0 additions & 51 deletions .devcontainer/docker-compose.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .devcontainer/features/tools/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "sentry-ruby toolchain",
"id": "tools",
"version": "1.0.0",
"description": "Installs development dependencies required by the Ruby SDK to run all tests",
"installsAfter": [
"ghcr.io/devcontainers/features/git",
"ghcr.io/devcontainers/features/github-cli",
"ghcr.io/nils-geistmann/devcontainers-features/zsh",
"ghcr.io/rocker-org/devcontainer-features/apt-packages",
"ghcr.io/devcontainers-extra/features/mise"
],
"options": {
"rubyVersion": {
"type": "string",
"default": "latest",
"description": "Ruby version to pre-install. Switching versions requires an image rebuild."
}
}
}
43 changes: 43 additions & 0 deletions .devcontainer/features/tools/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
#
# Installs the sentry-ruby toolchain.
#
set -euo pipefail

RUBY_VERSION="${RUBYVERSION:-latest}"
USERNAME="${_REMOTE_USER:-sentry}"
USER_HOME="${_REMOTE_USER_HOME:-/home/${USERNAME}}"

echo "📦 Installing Chromium and ChromeDriver..."
echo "deb http://deb.debian.org/debian sid main" > /etc/apt/sources.list.d/debian.list
wget -qO- https://ftp-master.debian.org/keys/archive-key-12.asc \
| gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-keyring.gpg
wget -qO- https://ftp-master.debian.org/keys/archive-key-12-security.asc \
| gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-security-keyring.gpg
for directory in bin lib lib32 lib64 libo32 libx32 sbin; do
dpkg-divert --package base-files --no-rename --remove "/${directory}"
done
Comment thread
solnic marked this conversation as resolved.
apt-get update
apt-get install -y --no-install-recommends chromium chromium-driver
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /etc/apt/sources.list.d/debian.list

MISE_BIN="$(command -v mise || echo /usr/local/bin/mise)"
"$MISE_BIN" --version

# Activate mise for the remote user's interactive shells.
echo "eval \"\$(${MISE_BIN} activate bash)\"" >> "${USER_HOME}/.bashrc"
echo "eval \"\$(${MISE_BIN} activate zsh)\"" >> "${USER_HOME}/.zshenv"
chown "${USERNAME}:${USERNAME}" "${USER_HOME}/.bashrc" "${USER_HOME}/.zshenv"

# Feature installers run as root, but the toolchain belongs to the remote user.
as_user() {
sudo -u "${USERNAME}" -H env "PATH=${USER_HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin" "$@"
}

echo "📦 Pre-installing toolchain..."
as_user env MISE_RUBY_COMPILE=0 "$MISE_BIN" install \
"java@temurin-21" \
"ruby@${RUBY_VERSION}" \
"node@lts"

echo "✅ Toolchain pre-install completed!"
35 changes: 0 additions & 35 deletions .devcontainer/run

This file was deleted.

2 changes: 1 addition & 1 deletion .devcontainer/setup
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SetupScript
only_npm: false,
with_foreman: false
}
@workspace_root = '/workspace/sentry'
@workspace_root = '/workspaces/sentry-ruby'
end

def run(args)
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/build_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,19 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0

# Build with the dev container CLI (not a plain `docker build`) so the dev
# container features — including the local `tools` feature that bakes the
# Ruby/Node/Java toolchain and browser — are applied to the pushed image.
# BASE_IMAGE and RUBY_VERSION are consumed via ${localEnv:...} in
# devcontainer.json, so they are passed as env vars to the CLI here.
- name: Build and push devcontainer image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
uses: devcontainers/ci@513af61f4de4f75d37e4438f184ba4358f0fc1ca # v0.3.1900000450
env:
BASE_IMAGE: ${{ matrix.base_image }}
RUBY_VERSION: ${{ matrix.ruby_version }}
with:
context: .
file: .devcontainer/Dockerfile
push: true
tags: |
ghcr.io/getsentry/sentry-ruby-devcontainer-${{ matrix.flavor }}:${{ steps.version.outputs.version }}
${{ github.ref == 'refs/heads/master' && format('ghcr.io/getsentry/sentry-ruby-devcontainer-{0}:latest', matrix.flavor) || '' }}
build-args: |
BASE_IMAGE=${{ matrix.base_image }}
RUBY_VERSION=${{ matrix.ruby_version }}
subFolder: .
configFile: .devcontainer/devcontainer.json
imageName: ghcr.io/getsentry/sentry-ruby-devcontainer-${{ matrix.flavor }}
imageTag: ${{ github.ref == 'refs/heads/master' && format('{0},latest', steps.version.outputs.version) || steps.version.outputs.version }}
push: always
Comment thread
sentry-warden[bot] marked this conversation as resolved.
Loading
Loading