Skip to content

Commit

Permalink
Expose docker-compose for localstack (#813)
Browse files Browse the repository at this point in the history
* Expose docker-compose for localstack

* fix d dev

* better health

* improve check
  • Loading branch information
mensfeld authored Feb 21, 2025
1 parent eef8111 commit 985e363
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
name: Specs

on:
- push
- pull_request

jobs:
all_specs:
name: All Specs
strategy:
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']
gemfile: ['Gemfile']
runs-on: ubuntu-24.04
services:
localstack:
image: localstack/localstack:latest
env:
SERVICES: sqs
ports:
- 4566:4566
options: >-
--health-cmd "curl -f http://localhost:4566/_localstack/health"
--health-interval 5s
--health-timeout 10s
--health-retries 5
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Start LocalStack
run: docker compose up -d

- name: Wait for LocalStack
run: |
timeout 30s bash -c '
until curl -s http://localhost:4566/_localstack/health | grep -q "\"sqs\": \"available\""; do
echo "Waiting for LocalStack..."
sleep 2
done
'
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run specs
run: bundle exec rake spec
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

- name: Run integration specs
run: bundle exec rake spec:integration
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

rails_specs:
name: Rails Specs
strategy:
Expand All @@ -58,15 +62,17 @@ jobs:
- rails: '8.0'
ruby: '3.4'
gemfile: gemfiles/rails_8_0.gemfile
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run Rails specs
run: bundle exec rake spec:rails
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ shoryuken.yml
*.log
.env
rubocop.html
.byebug_history
.byebug_history
.localstack
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
localstack:
image: localstack/localstack:latest
container_name: localstack
ports:
- "4566:4566"
- "4510-4559:4510-4559"
environment:
- SERVICES=sqs
- DEBUG=${DEBUG:-0}
- DOCKER_HOST=unix:///var/run/docker.sock
- AWS_DEFAULT_REGION=us-east-1
- AWS_ACCESS_KEY_ID=test
- AWS_SECRET_ACCESS_KEY=test
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./.localstack}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
interval: 5s
timeout: 10s
retries: 5

0 comments on commit 985e363

Please sign in to comment.