Skip to content
Draft
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
1 change: 0 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ RUN apt-get update -qq \
libyaml-dev \
libyaml-0-2 \
openssh-client \
postgresql-client \
vim \
procps \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
Expand Down
50 changes: 1 addition & 49 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
x-db-env: &db_env
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres

x-rails-env: &rails_env
DB_HOST: db
# Bind the dev server to all interfaces inside the container so Docker's
# published port reaches it from the host. Rails reads BINDING natively.
BINDING: "0.0.0.0"
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
HOST: "0.0.0.0"
BUNDLE_PATH: /bundle
REDIS_URL: redis://redis:6379/1
SELENIUM_REMOTE_URL: http://selenium:4444

services:
app:
Expand All @@ -28,40 +16,6 @@ services:
command: sleep infinity
environment:
<<: *rails_env
depends_on:
- db
- redis
- selenium

worker:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
volumes:
- ..:/workspace:cached
- bundle_cache:/bundle
command: bundle exec sidekiq
restart: unless-stopped
environment:
<<: *rails_env
depends_on:
- redis

redis:
image: redis:latest
volumes:
- redis-data:/data
restart: unless-stopped

db:
image: postgres:16
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
restart: unless-stopped
environment:
<<: *db_env

selenium:
image: selenium/standalone-chromium:latest
Expand All @@ -72,6 +26,4 @@ services:
restart: unless-stopped

volumes:
postgres-data:
redis-data:
bundle_cache:
16 changes: 0 additions & 16 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,6 @@ SMTP_TLS_SKIP_VERIFY=false
EMAIL_SENDER=

# Database Configuration
DB_HOST=localhost # May need to be changed to `DB_HOST=db` if using devcontainer
DB_PORT=5432
POSTGRES_PASSWORD=postgres # pipelock:ignore
POSTGRES_USER=postgres

# Redis configuration
# Standard Redis URL (for direct connection)
REDIS_URL=redis://localhost:6379/1

# Redis Sentinel configuration (for high availability)
# When REDIS_SENTINEL_HOSTS is set, it takes precedence over REDIS_URL
# REDIS_SENTINEL_HOSTS=sentinel1:26379,sentinel2:26379,sentinel3:26379
# REDIS_SENTINEL_MASTER=mymaster
# REDIS_SENTINEL_USERNAME=default
# REDIS_PASSWORD=your-redis-password # pipelock:ignore

# App Domain
# This is the domain that your Sure instance will be hosted at. It is used to generate links in emails and other places.
APP_DOMAIN=
Expand Down
55 changes: 29 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ name: CI

on:
workflow_call:
workflow_dispatch:

jobs:
scan_ruby:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -25,7 +26,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -41,7 +42,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -57,10 +58,10 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup Node.js environment
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: "20"
cache: "npm"
Expand All @@ -79,32 +80,14 @@ jobs:
env:
PLAID_CLIENT_ID: foo
PLAID_SECRET: bar
DATABASE_URL: postgres://postgres:postgres@localhost:5432
REDIS_URL: redis://localhost:6379
RAILS_ENV: test

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

redis:
image: redis
ports:
- 6379:6379
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libvips postgresql-client libpq-dev
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y curl libvips

- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -121,8 +104,28 @@ jobs:
- name: Unit and integration tests
run: bin/rails test

system-test:
runs-on: ubuntu-latest
timeout-minutes: 10

env:
RAILS_ENV: test

steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libvips

- name: Checkout code
uses: actions/checkout@v6

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true

- name: System tests
run: DISABLE_PARALLELIZATION=true bin/rails test:system
run: bin/rails test:system

- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:

steps:
- name: Check out the repo
uses: actions/checkout@v4.2.0
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.ref || github.ref }}

Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.7
3.4.6
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
# syntax = docker/dockerfile:1

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.4.7
ARG RUBY_VERSION=3.4.6
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base

# Rails app lives here
WORKDIR /rails

# Install base packages
# procps package is needed for litestream because it uses the ps command internally
RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y curl libvips postgresql-client libyaml-0-2 procps \
&& apt-get install --no-install-recommends -y curl libvips libyaml-0-2 procps \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Set production environment
ARG BUILD_COMMIT_SHA
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development" \
BUILD_COMMIT_SHA=${BUILD_COMMIT_SHA}

BUNDLE_WITHOUT="development"

# Throw-away build stage to reduce size of final image
FROM base AS build

# Install packages needed to build gems
RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y build-essential libpq-dev git pkg-config libyaml-dev \
&& apt-get install --no-install-recommends -y build-essential git pkg-config libyaml-dev \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Install application gems
Expand Down Expand Up @@ -55,6 +54,9 @@ USER 1000:1000
COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --chown=rails:rails --from=build /rails /rails

ARG BUILD_COMMIT_SHA
ENV BUILD_COMMIT_SHA=${BUILD_COMMIT_SHA}

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

Expand Down
41 changes: 26 additions & 15 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ source "https://rubygems.org"
ruby file: ".ruby-version"

# Rails
gem "rails", "~> 7.2.2"

# Drivers
gem "pg", "~> 1.5"
gem "redis", "~> 5.4"
gem "rails", "~> 8.1.1"

# Deployment
gem "puma", ">= 5.0"
Expand All @@ -27,18 +23,12 @@ gem "view_component"
gem "hotwire_combobox"

# Background Jobs
gem "connection_pool", "~> 2.5" # pin to 2.x; 3.0 breaks sidekiq 8.x
gem "sidekiq"
gem "sidekiq-cron"
gem "sidekiq-unique-jobs"

# Monitoring
gem "vernier"
gem "rack-mini-profiler"
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-sidekiq"
gem "posthog-ruby"
gem "logtail-rails"
gem "skylight", groups: [ :production ]

Expand All @@ -57,6 +47,7 @@ gem "countries"

# OAuth & API Security
gem "doorkeeper"
gem "rswag-ui"
gem "rack-attack", "~> 6.6"
gem "rack-cors"
gem "pundit"
Expand All @@ -65,10 +56,9 @@ gem "faraday-retry"
gem "faraday-multipart"
gem "inline_svg"
gem "octokit"
gem "pagy"
gem "rails-i18n"
gem "pagy", "~> 9.0"
gem "rails-settings-cached"
gem "tzinfo-data", platforms: %i[windows jruby]
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
gem "csv"
gem "rchardet" # Character encoding detection
gem "redcarpet"
Expand Down Expand Up @@ -100,12 +90,13 @@ gem "ruby-openai"
gem "langfuse-ruby", "~> 0.1.4", require: "langfuse"

group :development, :test do
gem "debug", platforms: %i[mri windows]
gem "debug", platforms: %i[mri mingw mswin x64_mingw]
gem "brakeman", require: false
gem "rubocop-rails-omakase", require: false
gem "i18n-tasks"
gem "erb_lint"
gem "dotenv-rails"
gem "rswag-specs"
end

if ENV["BENCHMARKING_ENABLED"]
Expand Down Expand Up @@ -143,3 +134,23 @@ group :test do
gem "climate_control"
gem "simplecov", require: false
end

gem "rails_db", "~> 2.5"

gem "seed_dump", github: "rroblak/seed_dump"

gem "solid_cache", "~> 1.0"

gem "sqlite3", "~> 2.7"

gem "solid_queue", "~> 1.2"

gem "solid_cable", "~> 3.0"

gem "mission_control-jobs", "~> 1.1"

gem "sqlean", "~> 0.3.0"

gem "litestream", "~> 0.14.0"

gem "honeybadger", "~> 6.1"
Loading
Loading