Skip to content

Fix local devcontainers #3956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions .devcontainer/configs/vscode/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"ruby-spec-runner.rspecEnv": {
"DB": "postgres",
"DB": "mysql",
"POSTGRES_CONNECTION_PREFIX": "postgres://postgres:supersecret@localhost:5432",
"MYSQL_CONNECTION_PREFIX": "mysql2://root:supersecret@localhost:3306"
"MYSQL_CONNECTION_PREFIX": "mysql2://root:supersecret@127.0.0.1:3306"
},
"ruby.rubocop.autocorrectOnSave": true,
"ruby.rubocop.configFilePath": ".rubocop.yml",
Expand Down
1 change: 0 additions & 1 deletion .devcontainer/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.3"
services:

# Dev Container
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/images/devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ setupYqCli
# Setup User Permissions
sudo groupadd docker
sudo usermod -aG docker "vscode"
sudo chmod 777 /tmp
sudo chmod +t /tmp

trap "" EXIT
trap "" EXIT
2 changes: 1 addition & 1 deletion .devcontainer/scripts/codespaces_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ trap "pkill -P $$" EXIT
mkdir -p tmp

# Speed up docker builds by prebuilding with buildx
docker-compose pull || tee tmp/fail &
docker compose pull || tee tmp/fail &
docker buildx bake -f docker-compose.yml -f .devcontainer/docker-compose.override.yml || tee tmp/fail &

wait $(jobs -p)
Expand Down
14 changes: 7 additions & 7 deletions devenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ help_command() {

# Create a clean development environment
create_command(){
docker-compose -p "" down
docker compose -p "" down
docker buildx bake -f docker-compose.yml &
docker-compose -p "" pull &
docker compose -p "" pull &
wait $(jobs -p)
docker-compose -p "" up -d --build
docker compose -p "" up -d --build
./.devcontainer/scripts/setupDevelopmentEnvironment.sh
}

# Start containers
start_command(){
docker-compose -p "" start
docker compose -p "" start
}

# Stop containers
stop_command(){
docker-compose -p "" stop
docker compose -p "" stop
}

# Remove containers
destroy_command(){
docker-compose -p "" down
docker compose -p "" down
}

# Call Setup IDEs Script
Expand Down Expand Up @@ -72,7 +72,7 @@ fi
# Check Prerequisites
export should_exit=0
# Check Path Exists
for p in docker docker-compose ruby bundle mysql psql yq; do
for p in docker ruby bundle mysql psql yq; do
if ! command -v "${p}" >/dev/null 2>&1; then
echo "Error: Dependency \"$p\" is not installed" && export should_exit=1
fi
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.3"
services:

# Postgres
Expand Down
2 changes: 1 addition & 1 deletion spec/support/bootstrap/db_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def default_connection_string(db_type)

def default_connection_prefix(db_type)
default_connection_prefixes = {
'mysql' => ENV['MYSQL_CONNECTION_PREFIX'] || 'mysql2://root:password@localhost:3306',
'mysql' => ENV['MYSQL_CONNECTION_PREFIX'] || 'mysql2://root:password@127.0.0.1:3306',
'postgres' => ENV['POSTGRES_CONNECTION_PREFIX'] || 'postgres://postgres@localhost:5432'
}

Expand Down