Skip to content
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

Dockerize project to make development easier #8

Closed
wants to merge 5 commits into from
Closed
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
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## Unreleased

## [0.0.2 - 2017-10-18]
## 0.0.3
### Added
Allow usage with newer versions of heartcheck
- Adds script and docker to facilitate development environment setup
- Adds support for ruby 3.

## 0.0.1 - 2015-11-27
## 0.0.2
### Added
Create gem
- Allow usage with newer versions of heartcheck
- [v 0.0.2](https://github.com/locaweb/heartcheck-resque/releases/tag/v0.0.2)

[Unreleased]: https://github.com/locaweb/heartcheck-resque/compare/master....HEAD
[0.0.2 - 2017-10-18]: https://github.com/locaweb/heartcheck-resque/releases/tag/v0.0.2
## 0.0.1
### Added
- Create gem
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,31 @@ Heartcheck.setup do |config|
end
```

### Check Heartcheck example [here](https://github.com/locaweb/heartcheck/blob/master/lib/heartcheck/generators/templates/config.rb)
**Check Heartcheck example** [here](https://github.com/locaweb/heartcheck/blob/master/lib/heartcheck/generators/templates/config.rb)

## License
* [MIT License](https://github.com/locaweb/heartcheck-resque/blob/master/LICENSE.txt)
## Development setup using Docker

The Hearthcheck-Resque provides a container with the current stable version of Ruby released and a second Docker container running Redis. The development setup requires you to have these tools available in your local environment:

- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- [Bash](https://www.gnu.org/software/bash/)

#### BootStrap Script to run the dockerized environment

```bash
./scripts/heartcheck-resque setup
```

Run the command `./scripts/heartcheck-cache -h` to see available options.

## Contributing

1. Fork it ( https://github.com/locaweb/heartcheck-resque/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
1. [Fork it](https://github.com/locaweb/heartcheck-resque/fork)
2. Create your feature branch ( **git checkout -b my-new-feature** )
3. Commit your changes ( **git commit -am 'Add some feature'** )
4. Push to the branch ( **git push origin my-new-feature** )
5. Create a new Pull Request

## License
* [MIT License](https://github.com/locaweb/heartcheck-resque/blob/master/LICENSE.txt)
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.7'

services:
app:
image: ruby:3.0.2
volumes:
- .:/app
working_dir: /app
command: bash
depends_on:
- 'redis'
environment:
REDIS_HOST: redis
REDIS_PORT: 6379
BUNDLE_PATH: /app/.gems
redis:
image: redis:5.0.6
command: --port 6379

49 changes: 49 additions & 0 deletions scripts/heartcheck-resque
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash -e

command_name=$1
command_args=${@:2}

# we are relying on docker, adding a descriptive name here
# will help when identifiying containers with docker ps
image_name="heartcheck-resque"

# helper to bring container alive
run() {
args=${@:1}
docker-compose run --rm -v $PWD:/heartcheck-resque app $args
}

case $command_name in
setup)
docker-compose up --build -d
run bundle install
;;
stop)
docker-compose down -v --rmi all
;;
bash)
run bash
;;
bundle)
run bundle install
;;
console)
run bin/console
;;
rspec)
run bundle exec rspec
;;
usage)
echo -e "Usage:\n"
echo -e "heartcheck-resque bash - access docker sh console"
echo -e "heartcheck-resque bundle - runs bundle install"
echo -e "heartcheck-resque rspec - runs rspec"
echo -e "heartcheck-resque setup - setups docker image"
echo -e "heartcheck-resque stop - stops and removes containers, networks and volumes."
;;
*)
echo -e "\n# Bootstrap Script to dockerize the hearthcheck-resque environment\n"
$0 usage
;;
esac