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
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.3.9
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION
39 changes: 39 additions & 0 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "boltspa"

services:
rails-app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile

volumes:
- ../..:/workspaces:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Uncomment the next line to use a non-root user for all processes.
# user: vscode

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
depends_on:
- selenium
- postgres

selenium:
image: selenium/standalone-chromium
restart: unless-stopped

postgres:
image: postgres:17
restart: unless-stopped
networks:
- default
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

volumes:
postgres-data:
39 changes: 39 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// For format details, see https://containers.dev/implementors/json_reference/.
// For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "boltspa",
"dockerComposeFile": "compose.yaml",
"service": "rails-app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
// "ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/rails/devcontainer/features/activestorage": {},
// "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
// "ghcr.io/rails/devcontainer/features/sqlite3": {}
"ghcr.io/rails/devcontainer/features/postgres-client": {
"version": "17"
}
},

"containerEnv": {
"CAPYBARA_SERVER_PORT": "45678",
"SELENIUM_HOST": "selenium",
"KAMAL_REGISTRY_PASSWORD": "$KAMAL_REGISTRY_PASSWORD",
"DB_HOST": "postgres"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000, 5432],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://containers.dev/implementors/json_reference/#remoteUser.
// "remoteUser": "root",


// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bin/setup --skip-server"
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ database.yml

data.json
.overmind.sock

# Ignore key files for decrypting credentials and more.
/config/credentials/*.key
/config/credentials/development.yml.enc
37 changes: 37 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "boltspa: start",
"type": "shell",
"command": "overmind start -f Procfile.dev",
"group": "none",
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "boltspa: console",
"type": "shell",
"command": "./bin/rails console",
"group": "none",
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "boltspa: credentials",
"type": "shell",
"command": "EDITOR=\"vi\" ./bin/rails credentials:edit --environment development",
"group": "none",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ group :test do
gem 'capybara'
gem 'selenium-webdriver'
end

gem "dockerfile-rails", ">= 1.7", group: :development
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ GEM
reline (>= 0.3.8)
debug_inspector (1.2.0)
diff-lcs (1.6.2)
dockerfile-rails (1.7.10)
rails (>= 3.0.0)
drb (2.2.3)
erb (6.0.3)
erubi (1.13.1)
Expand Down Expand Up @@ -462,6 +464,7 @@ DEPENDENCIES
bootsnap
capybara
debug
dockerfile-rails (>= 1.7)
faker
faraday
fx
Expand Down Expand Up @@ -519,6 +522,7 @@ CHECKSUMS
debug (1.11.1) sha256=2e0b0ac6119f2207a6f8ac7d4a73ca8eb4e440f64da0a3136c30343146e952b6
debug_inspector (1.2.0) sha256=9bdfa02eebc3da163833e6a89b154084232f5766087e59573b70521c77ea68a2
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
dockerfile-rails (1.7.10) sha256=04163273792ec6c6560244d32c0b44bbed705384a47b8063adcbf0d7bc8abd26
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
erb (6.0.3) sha256=e43685a8a0a0ea6a924871b2162e8953ef73147ce46b75b36d1f6774fd286e91
erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
Expand Down
8 changes: 7 additions & 1 deletion config/database.yml.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
<% if ENV["DB_HOST"] %>
host: <%= ENV["DB_HOST"] %>
username: postgres
password: postgres
<% else %>
host: localhost
username: someuser
password: somepass
pool: 5
<% end %>

development:
<<: *default
Expand Down