Skip to content

Commit 5deed38

Browse files
committed
Install devcontainer updates
1 parent 54e692d commit 5deed38

4 files changed

Lines changed: 150 additions & 5 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
2+
ARG RUBY_VERSION=3.3.8
3+
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION

.devcontainer/compose.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "flextensions"
2+
3+
services:
4+
rails-app:
5+
build:
6+
context: ..
7+
dockerfile: .devcontainer/Dockerfile
8+
9+
volumes:
10+
- ../..:/workspaces:cached
11+
12+
# Overrides default command so things don't shut down after the process ends.
13+
command: sleep infinity
14+
15+
# Uncomment the next line to use a non-root user for all processes.
16+
# user: vscode
17+
18+
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
19+
# (Adding the "ports" property to this file will not forward from a Codespace.)
20+
depends_on:
21+
- redis
22+
- postgres
23+
24+
redis:
25+
image: redis:7.2
26+
restart: unless-stopped
27+
volumes:
28+
- redis-data:/data
29+
30+
postgres:
31+
image: postgres:16.1
32+
restart: unless-stopped
33+
networks:
34+
- default
35+
volumes:
36+
- postgres-data:/var/lib/postgresql/data
37+
environment:
38+
POSTGRES_USER: postgres
39+
POSTGRES_PASSWORD: postgres
40+
41+
volumes:
42+
redis-data:
43+
postgres-data:

.devcontainer/devcontainer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3+
{
4+
"name": "flextensions",
5+
"dockerComposeFile": "compose.yaml",
6+
"service": "rails-app",
7+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
8+
9+
// Features to add to the dev container. More info: https://containers.dev/features.
10+
"features": {
11+
"ghcr.io/devcontainers/features/github-cli:1": {},
12+
"ghcr.io/rails/devcontainer/features/activestorage": {},
13+
"ghcr.io/rails/devcontainer/features/postgres-client": {}
14+
},
15+
16+
"containerEnv": {
17+
"REDIS_URL": "redis://redis:6379/1",
18+
"DB_HOST": "postgres"
19+
},
20+
21+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
22+
"forwardPorts": [3000, 5432, 6379],
23+
24+
// Configure tool-specific properties.
25+
// "customizations": {},
26+
27+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
28+
// "remoteUser": "root",
29+
30+
31+
// Use 'postCreateCommand' to run commands after the container is created.
32+
"postCreateCommand": "bin/setup"
33+
}

config/database.yml

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,62 @@
1+
# PostgreSQL. Versions 9.3 and up are supported.
2+
#
3+
# Install the pg driver:
4+
# gem install pg
5+
# On macOS with Homebrew:
6+
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7+
# On Windows:
8+
# gem install pg
9+
# Choose the win32 build.
10+
# Install PostgreSQL and put its /bin directory on your path.
11+
#
12+
# Configure Using Gemfile
13+
# gem "pg"
14+
#
115
default: &default
216
adapter: postgresql
3-
pool: 5
17+
encoding: unicode
18+
# For details on connection pooling, see Rails configuration guide
19+
# https://guides.rubyonrails.org/configuring.html#database-pooling
20+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
421
timeout: 5000
22+
# <% if ENV["DB_HOST"] %>
523
host: <%= ENV['DB_HOST'] || 'localhost' %>
624
port: <%= ENV['DB_PORT'] || '5432' %>
725
username: <%= ENV['DB_USER'] || ENV['USER'] || 'postgres' %>
826
password: <%= ENV['DB_PASSWORD'] || 'password' %>
9-
database: <%= ENV['DB_NAME'] || 'postgres' %>
27+
# <% end %>
28+
# database: <%= ENV['DB_NAME'] || 'postgres' %>
1029

1130
development:
1231
<<: *default
13-
database: flextensions_dev
32+
database: flextensions_development
33+
34+
# The specified database role being used to connect to PostgreSQL.
35+
# To create additional roles in PostgreSQL see `$ createuser --help`.
36+
# When left blank, PostgreSQL will use the default role. This is
37+
# the same name as the operating system user running Rails.
38+
#username: flextensions
39+
40+
# The password associated with the PostgreSQL role (username).
41+
#password:
42+
43+
# Connect on a TCP socket. Omitted by default since the client uses a
44+
# domain socket that doesn't need configuration. Windows does not have
45+
# domain sockets, so uncomment these lines.
46+
#host: localhost
47+
48+
# The TCP port the server listens on. Defaults to 5432.
49+
# If your server runs on a different port number, change accordingly.
50+
#port: 5432
51+
52+
# Schema search path. The server defaults to $user,public
53+
#schema_search_path: myapp,sharedapp,public
54+
55+
# Minimum log levels, in increasing order:
56+
# debug5, debug4, debug3, debug2, debug1,
57+
# log, notice, warning, error, fatal, and panic
58+
# Defaults to warning.
59+
#min_messages: notice
1460

1561
# Warning: The database defined as "test" will be erased and
1662
# re-generated from your development database when you run "rake".
@@ -19,15 +65,35 @@ test:
1965
<<: *default
2066
database: flextensions_test
2167

68+
# As with config/credentials.yml, you never want to store sensitive information,
69+
# like your database password, in your source code. If your source code is
70+
# ever seen by anyone, they now have access to your database.
71+
#
72+
# Instead, provide the password or a full connection URL as an environment
73+
# variable when you boot the app. For example:
74+
#
75+
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
76+
#
77+
# If the connection URL is provided in the special DATABASE_URL environment
78+
# variable, Rails will automatically merge its configuration values on top of
79+
# the values provided in this file. Alternatively, you can specify a connection
80+
# URL environment variable explicitly:
81+
#
82+
# production:
83+
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
84+
#
85+
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
86+
# for a full overview on how database connection configuration can be specified.
87+
#
2288
staging:
2389
<<: *default
2490
pool: 5
2591
timeout: 5000
2692
database: flextensions_staging
2793

28-
# MAKE SURE THE ENVIRONMENT CONFIG IS SET UP FOR PROD
2994
production:
3095
<<: *default
31-
pool: 5
3296
timeout: 5000
3397
database: flextensions_production
98+
username: flextensions
99+
password: <%= ENV["FLEXTENSIONS_DATABASE_PASSWORD"] %>

0 commit comments

Comments
 (0)