From ebf9d170ed2c8e68811011a1cdfb3ebfb1a1e4c7 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Thu, 12 Feb 2026 07:10:32 +0000 Subject: [PATCH 01/16] Update Ruby version to 4.0 and adjust related documentation --- src/ruby-rails-postgres/.devcontainer/Dockerfile | 2 +- src/ruby-rails-postgres/README.md | 2 +- src/ruby-rails-postgres/devcontainer-template.json | 10 +++++----- src/ruby/.devcontainer/devcontainer.json | 2 +- src/ruby/README.md | 2 +- src/ruby/devcontainer-template.json | 10 +++++----- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ruby-rails-postgres/.devcontainer/Dockerfile b/src/ruby-rails-postgres/.devcontainer/Dockerfile index 47767878..dd84a119 100644 --- a/src/ruby-rails-postgres/.devcontainer/Dockerfile +++ b/src/ruby-rails-postgres/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/ruby:2-${templateOption:imageVariant} +FROM mcr.microsoft.com/devcontainers/ruby:3-${templateOption:imageVariant} # Install Rails RUN su vscode -c "gem install rails webdrivers" diff --git a/src/ruby-rails-postgres/README.md b/src/ruby-rails-postgres/README.md index deb86ec2..c37b7784 100644 --- a/src/ruby-rails-postgres/README.md +++ b/src/ruby-rails-postgres/README.md @@ -7,7 +7,7 @@ Develop Ruby on Rails applications with Postgres. Includes a Rails application c | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| -| imageVariant | Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon) : | string | 3.4-trixie | +| imageVariant | Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon) : | string |4-trixie | This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata. diff --git a/src/ruby-rails-postgres/devcontainer-template.json b/src/ruby-rails-postgres/devcontainer-template.json index e277e7ef..20b64f65 100644 --- a/src/ruby-rails-postgres/devcontainer-template.json +++ b/src/ruby-rails-postgres/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "ruby-rails-postgres", - "version": "5.0.0", + "version": "6.0.0", "name": "Ruby on Rails & Postgres", "description": "Develop Ruby on Rails applications with Postgres. Includes a Rails application container and PostgreSQL server.", "documentationURL": "https://github.com/devcontainers/templates/tree/main/src/ruby-rails-postgres", @@ -11,20 +11,20 @@ "type": "string", "description": "Ruby version (use -bookworm, -bullseye variants on local arm64/Apple Silicon):", "proposals": [ - "3-trixie", + "4-trixie", "3.4-trixie", "3.3-trixie", "3.2-trixie", - "3-bookworm", + "4-bookworm", "3.4-bookworm", "3.3-bookworm", "3.2-bookworm", - "3-bullseye", + "4-bullseye", "3.4-bullseye", "3.3-bullseye", "3.2-bullseye" ], - "default": "3.4-trixie" + "default": "4-trixie" } }, "platforms": ["Ruby"], diff --git a/src/ruby/.devcontainer/devcontainer.json b/src/ruby/.devcontainer/devcontainer.json index eead7386..3f642645 100644 --- a/src/ruby/.devcontainer/devcontainer.json +++ b/src/ruby/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ { "name": "Ruby", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/ruby:2-${templateOption:imageVariant}" + "image": "mcr.microsoft.com/devcontainers/ruby:3-${templateOption:imageVariant}" // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, diff --git a/src/ruby/README.md b/src/ruby/README.md index 9857029f..de614eac 100644 --- a/src/ruby/README.md +++ b/src/ruby/README.md @@ -7,7 +7,7 @@ Develop Ruby based applications. includes everything you need to get up and runn | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| -| imageVariant | Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon) : | string | 3.4-trixie | +| imageVariant | Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon) : | string |4-trixie | This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata. diff --git a/src/ruby/devcontainer-template.json b/src/ruby/devcontainer-template.json index d3ae4051..caaebd0f 100644 --- a/src/ruby/devcontainer-template.json +++ b/src/ruby/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "ruby", - "version": "5.0.0", + "version": "6.0.0", "name": "Ruby", "description": "Develop Ruby based applications. includes everything you need to get up and running.", "documentationURL": "https://github.com/devcontainers/templates/tree/main/src/ruby", @@ -11,20 +11,20 @@ "type": "string", "description": "Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon):", "proposals": [ - "3-trixie", + "4-trixie", "3.4-trixie", "3.3-trixie", "3.2-trixie", - "3-bookworm", + "4-bookworm", "3.4-bookworm", "3.3-bookworm", "3.2-bookworm", - "3-bullseye", + "4-bullseye", "3.4-bullseye", "3.3-bullseye", "3.2-bullseye" ], - "default": "3.4-trixie" + "default": "4-trixie" } }, "platforms": ["Ruby"], From 511611c6792a095286c4f718a82b4a266f691ba4 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Fri, 13 Feb 2026 05:06:23 +0000 Subject: [PATCH 02/16] Add network check for rubygems.org accessibility in test script --- test/ruby-rails-postgres/test.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/ruby-rails-postgres/test.sh b/test/ruby-rails-postgres/test.sh index 7ef1d08b..6c4cfd33 100755 --- a/test/ruby-rails-postgres/test.sh +++ b/test/ruby-rails-postgres/test.sh @@ -10,11 +10,19 @@ fixTestProjectFolderPrivs # Run common tests checkCommon + # Run devcontainer specific tests check "rails" rails --version check "rails installation path" gem which rails check "user has write permission to rvm gems" [ -w /usr/local/rvm/gems ] check "user has write permission to rvm gems default" [ -w /usr/local/rvm/gems/default ] +# Check if we can reach rubygems.org before proceeding. +# This uses curl to silently (-s) make a request to https://rubygems.org +# Redirects output to /dev/null because we only care if the request succeeds, not the result itself. +if ! curl -s https://rubygems.org > /dev/null; then + echo "Network access to rubygems.org is unavailable. Please check network or proxy settings." + exit 1 +fi check "user can install gems" gem install github-markup # Report result From 542e4fd368685563df54e91379acdf4a18058512 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Fri, 13 Feb 2026 05:17:44 +0000 Subject: [PATCH 03/16] Improve network check for rubygems.org accessibility with retries and conditional gem installation --- test/ruby-rails-postgres/test.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/test/ruby-rails-postgres/test.sh b/test/ruby-rails-postgres/test.sh index 6c4cfd33..1530f0cf 100755 --- a/test/ruby-rails-postgres/test.sh +++ b/test/ruby-rails-postgres/test.sh @@ -16,14 +16,22 @@ check "rails" rails --version check "rails installation path" gem which rails check "user has write permission to rvm gems" [ -w /usr/local/rvm/gems ] check "user has write permission to rvm gems default" [ -w /usr/local/rvm/gems/default ] -# Check if we can reach rubygems.org before proceeding. -# This uses curl to silently (-s) make a request to https://rubygems.org -# Redirects output to /dev/null because we only care if the request succeeds, not the result itself. -if ! curl -s https://rubygems.org > /dev/null; then - echo "Network access to rubygems.org is unavailable. Please check network or proxy settings." - exit 1 + +# This section verifies connectivity to rubygems.org and attempts to install a gem if reachable. +can_reach_rubygems=false +for i in 1 2 3 4 5; do + if curl -fsSL --connect-timeout 10 --max-time 20 https://rubygems.org/ >/dev/null; then + can_reach_rubygems=true + break + fi + sleep $((i * 2)) +done + +if [ "${can_reach_rubygems}" = "true" ]; then + check "user can install gems" gem install --no-document github-markup +else + echo "WARN: Could not reach rubygems.org after retries; skipping gem install check." fi -check "user can install gems" gem install github-markup # Report result reportResults From 592dc51778bdc44728bd01e89c3edfa8d79fedc2 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 18 Feb 2026 05:10:59 +0000 Subject: [PATCH 04/16] Refactor gem installation check to use built-in bundler instead of external gem --- test/ruby-rails-postgres/test.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/test/ruby-rails-postgres/test.sh b/test/ruby-rails-postgres/test.sh index 1530f0cf..66502b6d 100755 --- a/test/ruby-rails-postgres/test.sh +++ b/test/ruby-rails-postgres/test.sh @@ -17,21 +17,8 @@ check "rails installation path" gem which rails check "user has write permission to rvm gems" [ -w /usr/local/rvm/gems ] check "user has write permission to rvm gems default" [ -w /usr/local/rvm/gems/default ] -# This section verifies connectivity to rubygems.org and attempts to install a gem if reachable. -can_reach_rubygems=false -for i in 1 2 3 4 5; do - if curl -fsSL --connect-timeout 10 --max-time 20 https://rubygems.org/ >/dev/null; then - can_reach_rubygems=true - break - fi - sleep $((i * 2)) -done - -if [ "${can_reach_rubygems}" = "true" ]; then - check "user can install gems" gem install --no-document github-markup -else - echo "WARN: Could not reach rubygems.org after retries; skipping gem install check." -fi +# This section verifies that gem installation works by using a built-in gem +check "user can install gems" gem install --no-document bundler # Report result reportResults From 968d8cda5f11fc73d74755298de144c547782f4d Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 18 Feb 2026 06:39:27 +0000 Subject: [PATCH 05/16] Add support for ruby 4.0 --- test/ruby-rails-postgres/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ruby-rails-postgres/test.sh b/test/ruby-rails-postgres/test.sh index 66502b6d..b9e6299e 100755 --- a/test/ruby-rails-postgres/test.sh +++ b/test/ruby-rails-postgres/test.sh @@ -16,9 +16,9 @@ check "rails" rails --version check "rails installation path" gem which rails check "user has write permission to rvm gems" [ -w /usr/local/rvm/gems ] check "user has write permission to rvm gems default" [ -w /usr/local/rvm/gems/default ] +check "gem command works" gem --version +check "user can install gems" gem list | grep -q "bundler" -# This section verifies that gem installation works by using a built-in gem -check "user can install gems" gem install --no-document bundler # Report result reportResults From 2f15806fb7abbf067b17364641363643d689f547 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 18 Feb 2026 06:59:43 +0000 Subject: [PATCH 06/16] Fix ruby-rails-postgres template option default --- src/ruby-rails-postgres/devcontainer-template.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ruby-rails-postgres/devcontainer-template.json b/src/ruby-rails-postgres/devcontainer-template.json index 20b64f65..60057f9b 100644 --- a/src/ruby-rails-postgres/devcontainer-template.json +++ b/src/ruby-rails-postgres/devcontainer-template.json @@ -9,23 +9,23 @@ "options": { "imageVariant": { "type": "string", - "description": "Ruby version (use -bookworm, -bullseye variants on local arm64/Apple Silicon):", + "description": "Ruby version (use - trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon):", "proposals": [ - "4-trixie", + "4.0-trixie", "3.4-trixie", "3.3-trixie", "3.2-trixie", - "4-bookworm", + "4.0-bookworm", "3.4-bookworm", "3.3-bookworm", "3.2-bookworm", - "4-bullseye", + "4.0-bullseye", "3.4-bullseye", "3.3-bullseye", "3.2-bullseye" ], - "default": "4-trixie" - } + "default": "4.0-trixie" + } }, "platforms": ["Ruby"], "optionalPaths": [ From 0313fd6b49938fa3c840fae9721c164a1eefbc74 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 18 Feb 2026 07:01:09 +0000 Subject: [PATCH 07/16] Fix ruby template option default --- src/ruby/devcontainer-template.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ruby/devcontainer-template.json b/src/ruby/devcontainer-template.json index caaebd0f..fc3c64a9 100644 --- a/src/ruby/devcontainer-template.json +++ b/src/ruby/devcontainer-template.json @@ -11,20 +11,20 @@ "type": "string", "description": "Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon):", "proposals": [ - "4-trixie", + "4.0-trixie", "3.4-trixie", "3.3-trixie", "3.2-trixie", - "4-bookworm", + "4.0-bookworm", "3.4-bookworm", "3.3-bookworm", "3.2-bookworm", - "4-bullseye", + "4.0-bullseye", "3.4-bullseye", "3.3-bullseye", "3.2-bullseye" ], - "default": "4-trixie" + "default": "4.0-trixie" } }, "platforms": ["Ruby"], From 85a5f504aedde2a2e2a0eb632e16aa251c748acc Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Thu, 19 Feb 2026 06:32:22 +0000 Subject: [PATCH 08/16] Update Ruby version in README and devcontainer configuration to 4.0-trixie --- .devcontainer/devcontainer.json | 4 +++- src/ruby-rails-postgres/README.md | 2 +- src/ruby/README.md | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 11e35319..25b5b7c1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,9 @@ { "image": "mcr.microsoft.com/devcontainers/javascript-node:4-24-trixie", "features": { - "ghcr.io/devcontainers/features/docker-in-docker:2": {} + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "moby": "false" + } }, "postCreateCommand": "npm install -g @devcontainers/cli", "customizations": { diff --git a/src/ruby-rails-postgres/README.md b/src/ruby-rails-postgres/README.md index c37b7784..4fde3a01 100644 --- a/src/ruby-rails-postgres/README.md +++ b/src/ruby-rails-postgres/README.md @@ -7,7 +7,7 @@ Develop Ruby on Rails applications with Postgres. Includes a Rails application c | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| -| imageVariant | Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon) : | string |4-trixie | +| imageVariant | Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon) : | string |4.0-trixie | This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata. diff --git a/src/ruby/README.md b/src/ruby/README.md index de614eac..28936c71 100644 --- a/src/ruby/README.md +++ b/src/ruby/README.md @@ -7,7 +7,7 @@ Develop Ruby based applications. includes everything you need to get up and runn | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| -| imageVariant | Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon) : | string |4-trixie | +| imageVariant | Ruby version (use -trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon) : | string |4.0-trixie | This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata. From 8d4e7c3bbf478cab9a4acc70be3ecc543a385770 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Fri, 20 Feb 2026 09:20:54 +0000 Subject: [PATCH 09/16] Enhance Docker networking --- .../.devcontainer/docker-compose.yml | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/ruby-rails-postgres/.devcontainer/docker-compose.yml b/src/ruby-rails-postgres/.devcontainer/docker-compose.yml index a963103b..741077e0 100644 --- a/src/ruby-rails-postgres/.devcontainer/docker-compose.yml +++ b/src/ruby-rails-postgres/.devcontainer/docker-compose.yml @@ -1,4 +1,5 @@ -version: '3' +# Dev Container Docker Compose Configuration for Ruby on Rails with PostgreSQL +# This configuration has been optimized for reliability in automated and remote environments services: app: @@ -12,15 +13,39 @@ services: # Overrides default command so things don't shut down after the process ends. command: sleep infinity - # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. - network_mode: service:db + # Database connection string for Rails applications + # Provides a standard way to connect to the PostgreSQL database + environment: + DATABASE_URL: "postgresql://postgres:postgres@db:5432/postgres" + + # IMPORTANT: Use proper Docker networking instead of network_mode to avoid namespace issues + # The previous network_mode: service:db caused container startup failures in automated environments + # This approach is more reliable and works consistently across different deployment scenarios + depends_on: + db: + condition: service_healthy # Wait for PostgreSQL to be ready before starting the app + networks: + - app-network # Connect to custom bridge network for service communication # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. # (Adding the "ports" property to this file will not forward from a Codespace.) db: - image: postgres:latest + # Use PostgreSQL 16 Alpine for stability and smaller image size + # Pinned version avoids PostgreSQL 18+ compatibility issues with data directory format + image: postgres:16-alpine restart: unless-stopped + networks: + - app-network # Connect to the same network as the app container + + # Health check ensures PostgreSQL is ready before dependent services start + # This is critical for depends_on with condition: service_healthy to work properly + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres" ] + interval: 10s # Check every 10 seconds + timeout: 5s # Wait up to 5 seconds for response + retries: 5 # Retry 5 times before marking as unhealthy + start_period: 30s # Give PostgreSQL 30 seconds to start before health checks begin volumes: - postgres-data:/var/lib/postgresql/data - ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql @@ -53,5 +78,15 @@ services: # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. # (Adding the "ports" property to this file will not forward from a Codespace.) +# Persistent storage for PostgreSQL data volumes: postgres-data: + # Named volume ensures data persists across container restarts + # Located at /var/lib/postgresql/data inside the container + +# Custom bridge network for service communication +# Replaces the problematic network_mode: service:db approach +networks: + app-network: + driver: bridge # Standard bridge driver for container-to-container communication + # Services on this network can communicate using service names (app -> db) From 81b83cf1a618c0347bba3596b0235fe15392aa38 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Fri, 20 Feb 2026 09:22:49 +0000 Subject: [PATCH 10/16] Refactor Docker Compose configuration for improved readability --- .../.devcontainer/docker-compose.yml | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/ruby-rails-postgres/.devcontainer/docker-compose.yml b/src/ruby-rails-postgres/.devcontainer/docker-compose.yml index 741077e0..bfa4baad 100644 --- a/src/ruby-rails-postgres/.devcontainer/docker-compose.yml +++ b/src/ruby-rails-postgres/.devcontainer/docker-compose.yml @@ -23,10 +23,9 @@ services: # This approach is more reliable and works consistently across different deployment scenarios depends_on: db: - condition: service_healthy # Wait for PostgreSQL to be ready before starting the app + condition: service_healthy # Wait for PostgreSQL to be ready before starting the app networks: - - app-network # Connect to custom bridge network for service communication - + - app-network # Connect to custom bridge network for service communication # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. # (Adding the "ports" property to this file will not forward from a Codespace.) @@ -36,15 +35,15 @@ services: image: postgres:16-alpine restart: unless-stopped networks: - - app-network # Connect to the same network as the app container - + - app-network # Connect to the same network as the app container + # Health check ensures PostgreSQL is ready before dependent services start # This is critical for depends_on with condition: service_healthy to work properly healthcheck: test: [ "CMD-SHELL", "pg_isready -U postgres" ] - interval: 10s # Check every 10 seconds - timeout: 5s # Wait up to 5 seconds for response - retries: 5 # Retry 5 times before marking as unhealthy + interval: 10s # Check every 10 seconds + timeout: 5s # Wait up to 5 seconds for response + retries: 5 # Retry 5 times before marking as unhealthy start_period: 30s # Give PostgreSQL 30 seconds to start before health checks begin volumes: - postgres-data:/var/lib/postgresql/data @@ -75,18 +74,18 @@ services: # password: postgres # database: myapp_test - # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. - # (Adding the "ports" property to this file will not forward from a Codespace.) + # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) -# Persistent storage for PostgreSQL data + # Persistent storage for PostgreSQL data volumes: postgres-data: # Named volume ensures data persists across container restarts # Located at /var/lib/postgresql/data inside the container -# Custom bridge network for service communication -# Replaces the problematic network_mode: service:db approach + # Custom bridge network for service communication + # Replaces the problematic network_mode: service:db approach networks: app-network: - driver: bridge # Standard bridge driver for container-to-container communication + driver: bridge # Standard bridge driver for container-to-container communication # Services on this network can communicate using service names (app -> db) From d7bb10039ac3b7f8994a9219f8555075884bb143 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Fri, 20 Feb 2026 09:43:06 +0000 Subject: [PATCH 11/16] Update PostgreSQL image to latest and adjust volume path for data persistence --- .../.devcontainer/docker-compose.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ruby-rails-postgres/.devcontainer/docker-compose.yml b/src/ruby-rails-postgres/.devcontainer/docker-compose.yml index bfa4baad..6f2cc8d5 100644 --- a/src/ruby-rails-postgres/.devcontainer/docker-compose.yml +++ b/src/ruby-rails-postgres/.devcontainer/docker-compose.yml @@ -32,7 +32,7 @@ services: db: # Use PostgreSQL 16 Alpine for stability and smaller image size # Pinned version avoids PostgreSQL 18+ compatibility issues with data directory format - image: postgres:16-alpine + image: postgres:latest restart: unless-stopped networks: - app-network # Connect to the same network as the app container @@ -46,7 +46,7 @@ services: retries: 5 # Retry 5 times before marking as unhealthy start_period: 30s # Give PostgreSQL 30 seconds to start before health checks begin volumes: - - postgres-data:/var/lib/postgresql/data + - postgres-data:/var/lib/postgresql - ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql environment: POSTGRES_USER: postgres @@ -74,17 +74,17 @@ services: # password: postgres # database: myapp_test - # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. - # (Adding the "ports" property to this file will not forward from a Codespace.) + # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) - # Persistent storage for PostgreSQL data +# Persistent storage for PostgreSQL data volumes: postgres-data: # Named volume ensures data persists across container restarts # Located at /var/lib/postgresql/data inside the container - # Custom bridge network for service communication - # Replaces the problematic network_mode: service:db approach +# Custom bridge network for service communication +# Replaces the problematic network_mode: service:db approach networks: app-network: driver: bridge # Standard bridge driver for container-to-container communication From 52634c649d9aead65471eefab9767d4761c0dd66 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Fri, 20 Feb 2026 09:43:06 +0000 Subject: [PATCH 12/16] Update PostgreSQL image to latest and adjust volume path for data persistence --- src/ruby-rails-postgres/.devcontainer/docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ruby-rails-postgres/.devcontainer/docker-compose.yml b/src/ruby-rails-postgres/.devcontainer/docker-compose.yml index 6f2cc8d5..2f9927ed 100644 --- a/src/ruby-rails-postgres/.devcontainer/docker-compose.yml +++ b/src/ruby-rails-postgres/.devcontainer/docker-compose.yml @@ -30,8 +30,6 @@ services: # (Adding the "ports" property to this file will not forward from a Codespace.) db: - # Use PostgreSQL 16 Alpine for stability and smaller image size - # Pinned version avoids PostgreSQL 18+ compatibility issues with data directory format image: postgres:latest restart: unless-stopped networks: From 0ef56b9bd2b9a5ef09b87e47a696e171e3caa7c0 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Mon, 23 Feb 2026 04:45:38 +0000 Subject: [PATCH 13/16] addressing review comments --- test/ruby-rails-postgres/test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/ruby-rails-postgres/test.sh b/test/ruby-rails-postgres/test.sh index b9e6299e..c908a3d2 100755 --- a/test/ruby-rails-postgres/test.sh +++ b/test/ruby-rails-postgres/test.sh @@ -16,6 +16,7 @@ check "rails" rails --version check "rails installation path" gem which rails check "user has write permission to rvm gems" [ -w /usr/local/rvm/gems ] check "user has write permission to rvm gems default" [ -w /usr/local/rvm/gems/default ] +check "user can install gems" gem install github-markup check "gem command works" gem --version check "user can install gems" gem list | grep -q "bundler" From c68767e1182bf60dfed6dfd5b3e55969f9e32ffd Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Mon, 23 Feb 2026 04:45:38 +0000 Subject: [PATCH 14/16] addressing review comments --- test/ruby-rails-postgres/test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/ruby-rails-postgres/test.sh b/test/ruby-rails-postgres/test.sh index c908a3d2..b897d1aa 100755 --- a/test/ruby-rails-postgres/test.sh +++ b/test/ruby-rails-postgres/test.sh @@ -18,6 +18,7 @@ check "user has write permission to rvm gems" [ -w /usr/local/rvm/gems ] check "user has write permission to rvm gems default" [ -w /usr/local/rvm/gems/default ] check "user can install gems" gem install github-markup check "gem command works" gem --version +check "user can install gems" gem install github-markup check "user can install gems" gem list | grep -q "bundler" From 13aebcc736f442afb648c6e780476022fe829f67 Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Tue, 24 Feb 2026 15:21:53 +0530 Subject: [PATCH 15/16] Update gem presence check for Bundler --- test/ruby-rails-postgres/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ruby-rails-postgres/test.sh b/test/ruby-rails-postgres/test.sh index b897d1aa..99e4d900 100755 --- a/test/ruby-rails-postgres/test.sh +++ b/test/ruby-rails-postgres/test.sh @@ -19,7 +19,7 @@ check "user has write permission to rvm gems default" [ -w /usr/local/rvm/gems/d check "user can install gems" gem install github-markup check "gem command works" gem --version check "user can install gems" gem install github-markup -check "user can install gems" gem list | grep -q "bundler" +check "Bundler gem presence " gem list | grep -q "bundler" # Report result From b3a08eb0ec1a7829daa241e9a41ec9f98147d22b Mon Sep 17 00:00:00 2001 From: sireeshajonnalagadda Date: Wed, 25 Feb 2026 10:53:19 +0530 Subject: [PATCH 16/16] Update Ruby version format in devcontainer template --- src/ruby-rails-postgres/devcontainer-template.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ruby-rails-postgres/devcontainer-template.json b/src/ruby-rails-postgres/devcontainer-template.json index 60057f9b..0368efef 100644 --- a/src/ruby-rails-postgres/devcontainer-template.json +++ b/src/ruby-rails-postgres/devcontainer-template.json @@ -11,20 +11,20 @@ "type": "string", "description": "Ruby version (use - trixie, -bookworm, -bullseye variants on local arm64/Apple Silicon):", "proposals": [ - "4.0-trixie", + "4-trixie", "3.4-trixie", "3.3-trixie", "3.2-trixie", - "4.0-bookworm", + "4-bookworm", "3.4-bookworm", "3.3-bookworm", "3.2-bookworm", - "4.0-bullseye", + "4-bullseye", "3.4-bullseye", "3.3-bullseye", "3.2-bullseye" ], - "default": "4.0-trixie" + "default": "4-trixie" } }, "platforms": ["Ruby"],