Skip to content

Commit

Permalink
Merge pull request #5 from m8051/issues/3
Browse files Browse the repository at this point in the history
Dockerize project to make development easier
  • Loading branch information
VictorSNA authored Oct 19, 2021
2 parents e05e747 + a77cf58 commit e06eba0
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 18 deletions.
23 changes: 14 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/).

## [1.0.0] - 2020-03-11
## Changed
- Add support for ruby 2.7
- Remove support for ruby < 2.3
- Change required version for gem heartcheck to fit for newer supported ruby versions

## [0.1.0] - 2015-07-08
## Changed
- A plugin to check CAS accessibility connection with heartcheck
## 1.0.1
### Added
- Add docker to facilitate development

## 1.0.0
### Changed
- Add support for ruby 2.7
- Remove support for ruby < 2.3
- Change required version for gem heartcheck to fit for newer supported ruby versions

## 0.1.0
### Changed
- A plugin to check CAS accessibility connection with heartcheck

35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/locaweb/heartcheck-cas.svg?branch=master)](https://travis-ci.org/locaweb/heartcheck-cas)
[![Code Climate](https://codeclimate.com/github/locaweb/heartcheck-cas/badges/gpa.svg)](https://codeclimate.com/github/locaweb/heartcheck-cas)

##A plugin to check CAS accessibility connection with [heartcheck](https://github.com/locaweb/heartcheck).
A plugin to check CAS accessibility connection with [heartcheck](https://github.com/locaweb/heartcheck).

## Installation

Expand Down Expand Up @@ -38,15 +38,32 @@ 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-cas/blob/master/LICENSE.txt)
## Development setup using Docker

The Docker Hearthcheck-Cas provides a container with the current stable version of Ruby released and 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-cas setup
```

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

## Contributing

1. Fork it ( https://github.com/locaweb/heartcheck-cas )
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-cas/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-cas/blob/master/LICENSE.txt)
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.7'

services:
app:
image: ruby:3.0.2
volumes:
- .:/app
working_dir: /app
command: bash
environment:
BUNDLE_PATH: /app/.gems
1 change: 1 addition & 0 deletions lib/heartcheck/cas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

module Heartcheck
module Cas
# Check for a cas service
end
end
1 change: 1 addition & 0 deletions lib/heartcheck/cas/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module Heartcheck
module Cas
# Handles HTTP connectivity
class HttpClient
def self.post(url, params)
self.new.post(url, params)
Expand Down
2 changes: 2 additions & 0 deletions lib/heartcheck/checks/cas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module Heartcheck
module Checks
# Check for a cas service
# Base is set in heartcheck gem
class Cas < Base
def validate
services.each do |service|
Expand Down
49 changes: 49 additions & 0 deletions scripts/heartcheck-cas
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-cas"

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

case $command_name in
setup)
docker-compose build
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-cas bash - access docker sh console"
echo -e "heartcheck-cas bundle - runs bundle install"
echo -e "heartcheck-cas rspec - runs rspec"
echo -e "heartcheck-cas setup - setups docker image"
echo -e "heartcheck-cas stop - stops and removes containers, networks and volumes."
;;
*)
echo -e "\n# Bootstrap Script to dockerize the hearthcheck-cas environment\n"
$0 usage
;;
esac

0 comments on commit e06eba0

Please sign in to comment.