Copied a bunch of examples from Titan.

This commit is contained in:
Travis Reeder
2016-10-13 20:27:39 -07:00
parent c40ef433d8
commit 2cced6f2c3
32 changed files with 868 additions and 0 deletions

2
examples/error/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
bundle/
.bundle/

View File

@@ -0,0 +1,9 @@
FROM iron/ruby:dev
WORKDIR /worker
ADD Gemfile* /worker/
RUN bundle install
ADD . /worker/
ENTRYPOINT ["ruby", "error.rb"]

4
examples/error/Gemfile Normal file
View File

@@ -0,0 +1,4 @@
source 'https://rubygems.org'
gem 'json', '> 1.8.2'
gem 'iron_worker', '>= 3.0.0'

View File

@@ -0,0 +1,25 @@
GEM
remote: https://rubygems.org/
specs:
iron_core (1.0.9)
rest (>= 3.0.4)
iron_worker (3.2.2)
iron_core (>= 0.5.1)
json (> 1.8.1)
rest (>= 3.0.6)
json (1.8.3)
net-http-persistent (2.9.4)
netrc (0.11.0)
rest (3.0.6)
net-http-persistent (>= 2.9.1)
netrc
PLATFORMS
ruby
DEPENDENCIES
iron_worker (>= 3.0.0)
json (> 1.8.2)
BUNDLED WITH
1.10.5

9
examples/error/README.md Normal file
View File

@@ -0,0 +1,9 @@
This is a worker that errors out (ie: exits with non-zero exit code).
## Building Image
```
docker build -t iron/error .
docker run -e 'PAYLOAD={"input": "yoooo"}' iron/error
```

8
examples/error/error.rb Normal file
View File

@@ -0,0 +1,8 @@
require 'iron_worker'
if ENV['PAYLOAD'] && ENV['PAYLOAD'] != ""
payload = JSON.parse(ENV['PAYLOAD'])
puts payload['input']
end
raise "Something went terribly wrong!"