Skip to content

Add new mutex strategies #1

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 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ruby:latest

RUN apt-get update && apt-get install -y bash git vim && rm -rf /var/lib/apt/lists/*

RUN gem install bundler
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile.2.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Need to build using rbenv because these are very old ruby verions and their images need rebuilding to work anyways
FROM debian:bullseye

SHELL ["/bin/bash","-l","-c"]

# Install dependencies
RUN apt-get update
RUN apt-get install ghostscript shared-mime-info openssl curl gnupg2 dirmngr git-core libcurl4-openssl-dev software-properties-common zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libffi-dev libpq-dev libmagickcore-6.q16-dev -y

# Install rbenv & ruby-build
RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv
RUN echo 'export PATH="~/.rbenv/bin:$PATH"' >> ~/.bashrc
RUN echo 'eval "$(rbenv init -)"' >> ~/.bashrc

RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
RUN echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc

# Install ruby
RUN rbenv rehash
RUN rbenv install 2.1.10
RUN rbenv global 2.1.10

RUN gem install bundler -v '< 2'
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile.2.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Need to build using rbenv because these are very old ruby verions and their images need rebuilding to work anyways
FROM debian:bullseye

SHELL ["/bin/bash","-l","-c"]

# Install dependencies
RUN apt-get update
RUN apt-get install ghostscript shared-mime-info openssl curl gnupg2 dirmngr git-core libcurl4-openssl-dev software-properties-common zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libffi-dev libpq-dev libmagickcore-6.q16-dev -y

# Install rbenv & ruby-build
RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv
RUN echo 'export PATH="~/.rbenv/bin:$PATH"' >> ~/.bashrc
RUN echo 'eval "$(rbenv init -)"' >> ~/.bashrc

RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
RUN echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc

# Install ruby
RUN rbenv rehash
RUN rbenv install 2.2.10
RUN rbenv global 2.2.10

RUN gem install bundler -v '< 2'
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile.2.3.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Need to build using rbenv because these are very old ruby verions and their images need rebuilding to work anyways
FROM debian:bullseye

SHELL ["/bin/bash","-l","-c"]

# Install dependencies
RUN apt-get update
RUN apt-get install ghostscript shared-mime-info openssl curl gnupg2 dirmngr git-core libcurl4-openssl-dev software-properties-common zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libffi-dev libpq-dev libmagickcore-6.q16-dev -y

# Install rbenv & ruby-build
RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv
RUN echo 'export PATH="~/.rbenv/bin:$PATH"' >> ~/.bashrc
RUN echo 'eval "$(rbenv init -)"' >> ~/.bashrc

RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
RUN echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc

# Install ruby
RUN rbenv rehash
RUN rbenv install 2.3.0
RUN rbenv global 2.3.0

RUN gem install bundler -v '< 2'
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile.2.7.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ruby:2.7.0

RUN apt-get update && apt-get install -y bash git vim && rm -rf /var/lib/apt/lists/*

RUN gem install bundler
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile.3.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ruby:3.0

RUN apt-get update && apt-get install -y bash git vim && rm -rf /var/lib/apt/lists/*

RUN gem install bundler
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile.3.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ruby:3.1

RUN apt-get update && apt-get install -y bash git vim && rm -rf /var/lib/apt/lists/*

RUN gem install bundler
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile.3.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ruby:3.2

RUN apt-get update && apt-get install -y bash git vim && rm -rf /var/lib/apt/lists/*

RUN gem install bundler
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile.3.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ruby:3.3

RUN apt-get update && apt-get install -y bash git vim && rm -rf /var/lib/apt/lists/*

RUN gem install bundler
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile.3.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ruby:3.4

RUN apt-get update && apt-get install -y bash git vim && rm -rf /var/lib/apt/lists/*

RUN gem install bundler
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
{
"name": "Redis Mutex",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": "./docker-compose.yml",

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "app",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/app",
"shutdownAction": "stopCompose",

"mounts": [
"source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind,consistency=cached"
],

"postAttachCommand": "git config --global --add safe.directory /app",
}
52 changes: 52 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: '3'
name: redis-mutex
networks:
redis-mutex:
name: redis-mutex
external: false
volumes:
redis_data:
name: 'redis-mutex-redis-data'
redis_shared_data:
name: 'redis-mutex-redis-data'
services:
redis:
image: redis:7-alpine
command: redis-server
container_name: redis-mutex-redis
volumes:
- 'redis_shared_data:/var/shared/redis:delegated'
- 'redis_data:/data:delegated'
networks:
- redis-mutex
expose:
- 6379
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 10s
timeout: 5s
retries: 2
start_period: 10s
restart: unless-stopped
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile.2.1
image: redis-mutex
container_name: redis-mutex
pull_policy: build
volumes:
- '..:/app:cached'
networks:
- redis-mutex
stdin_open: true
tty: true
environment:
BUNDLE_PATH: /app/vendor/bundle
REDIS_URL: redis://redis:6379/1
CI: true
entrypoint: ['/bin/bash', '-l', '-c']
command: '"tail -f /dev/null"'
depends_on:
redis:
condition: service_healthy
45 changes: 45 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: RSpec

on:
pull_request:

env:
CI: true
REDIS_URL: redis://localhost:6379/1

concurrency:
group: ${{ github.event.repository.name }}-${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
rspec:
name: RSpec
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby-version: [2.1, 2.2, 2.3.0, 2.7.0, 3.0, 3.1, 3.2, 3.3, 3.4]

services:
redis:
image: public.ecr.aws/docker/library/redis:7-alpine
ports:
- "6379:6379"
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Run rspec
run: bundle exec rspec
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pkg
Gemfile.lock
vendor
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

12 changes: 0 additions & 12 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"

# RSpec
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec')
task :default => :spec

# Custom Tasks
desc 'Flush the test database'
task :flushdb do
require 'redis'
Redis.new(:db => 15).flushdb
end
Loading
Loading