mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Copied a bunch of examples from Titan.
This commit is contained in:
2
examples/error/.gitignore
vendored
Normal file
2
examples/error/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
bundle/
|
||||
.bundle/
|
||||
9
examples/error/Dockerfile
Normal file
9
examples/error/Dockerfile
Normal 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
4
examples/error/Gemfile
Normal file
@@ -0,0 +1,4 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'json', '> 1.8.2'
|
||||
gem 'iron_worker', '>= 3.0.0'
|
||||
25
examples/error/Gemfile.lock
Normal file
25
examples/error/Gemfile.lock
Normal 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
9
examples/error/README.md
Normal 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
8
examples/error/error.rb
Normal 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!"
|
||||
Reference in New Issue
Block a user