Compare commits

...

15 Commits

Author SHA1 Message Date
Ben Parees bbb670185b
Merge pull request #18 from durandom/master
added required change of Content type
2017-12-07 14:53:36 -05:00
Marcel Hild 517019c0e7
added required change of Content type
otherwise the delivery would fail with unsupported Content-Type application/x-www-form-urlencoded
2017-12-07 20:46:55 +01:00
Ben Parees c457001ca5 Merge pull request #15 from luciddreamz/master
Update README to reference Ruby 2.4
2017-10-12 13:24:42 -04:00
Jacob Lucky b086e72a1c Update README to reference Ruby 2.4
Ruby 2.0 is now deprecated: https://access.redhat.com/articles/2176281
2017-10-12 13:16:51 -04:00
Ben Parees cfee49121d Merge pull request #13 from kosciCZ/master
Update versions for gems
2017-09-21 11:14:59 -04:00
Jan Koscielniak 9bd37acff6 Update versions for gems 2017-09-21 09:11:12 +02:00
Aleksandar Kostadinov 5ce019b742 allow viewing request headers (#8)
* allow viewing request headers

* text/plain output for headers
2017-09-13 15:52:14 -04:00
Ben Parees 1f3d5b79af Merge pull request #12 from coreydaley/adding_toc
adding ToC
2017-08-16 11:27:50 -04:00
Corey Daley 04ffa507d9
adding ToC 2017-08-16 11:08:50 -04:00
Corey Daley 4b4681b0e1 Merge pull request #11 from evgeni/patch-1
fix markdown header formatting in README.md
2017-08-16 11:06:24 -04:00
Evgeni Golov 271e781b9d fix markdown header formatting in README.md 2017-05-05 10:26:14 +02:00
Ionut Palade 855ab2de53 Merge pull request #6 from aj07/typo
adding some punctuation where it left out
2016-12-12 14:37:32 +01:00
Ankit Raj 3fdc70cc16 adding some punctuation where it left out 2016-12-12 14:59:17 +05:30
Ionut Palade 0e2449ec7c Merge pull request #5 from guangxuli/fix_ruby_ex
fix some old action/info
2016-12-09 10:06:42 +01:00
guangxuli bcd619aa83 fix some old action/info 2016-12-09 10:22:08 +08:00
3 changed files with 39 additions and 13 deletions

View File

@ -1,8 +1,8 @@
GEM
remote: https://rubygems.org/
specs:
puma (3.4.0)
rack (1.6.4)
puma (3.10.0)
rack (2.0.3)
PLATFORMS
ruby

View File

@ -1,3 +1,15 @@
<!-- toc -->
- [Ruby Sample App on OpenShift](#ruby-sample-app-on-openshift)
+ [Installation](#installation)
+ [Debugging Unexpected Failures](#debugging-unexpected-failures)
+ [Adding Webhooks and Making Code Changes](#adding-webhooks-and-making-code-changes)
+ [License](#license)
<!-- tocstop -->
Ruby Sample App on OpenShift
============================
@ -7,21 +19,21 @@ If you'd like to install it, follow [these directions](https://github.com/opensh
The steps in this document assume that you have access to an OpenShift deployment that you can deploy applications on.
###Installation:
These steps assume your OpenShift deployment has the default set of ImageStreams defined. Instructions for installing the default ImageStreams are available [here](http://docs.openshift.org/latest/admin_guide/install/first_steps.html). Instructions for installing the default ImageStreams are available [here](http://docs.openshift.org/latest/admin_guide/install/first_steps.html). If you are defining the set of ImageStreams now, remember to pass in the proper cluster-admin credentials and to create the ImageStreams in the 'openshift' namespace.
### Installation
These steps assume your OpenShift deployment has the default set of ImageStreams defined. Instructions for installing the default ImageStreams are available [here](https://docs.openshift.org/latest/install_config/imagestreams_templates.html#creating-image-streams-for-openshift-images). If you are defining the set of ImageStreams now, remember to pass in the proper cluster-admin credentials and to create the ImageStreams in the 'openshift' namespace.
1. Fork a copy of [ruby-ex](https://github.com/openshift/ruby-ex)
2. Add a Ruby application from your new repository:
$ oc new-app openshift/ruby-20-centos7~https://github.com/< yourusername >/ruby-ex
$ oc new-app openshift/ruby-24-centos7~https://github.com/< yourusername >/ruby-ex
3. A build should start immediately. To run another build, run:
$ oc start-build ruby-ex
4. Once the build is running, watch your build progress
4. Once the build is running, watch your build progress:
$ oc build-logs ruby-ex-1
$ oc logs build/ruby-ex-1
5. Wait for ruby-ex pods to start up (this can take a few minutes):
@ -51,19 +63,20 @@ In this case, the IP for ruby-ex is 172.30.97.209 and it is on port 8080.
*Note*: you can also get this information from the web console.
###Debugging Unexpected Failures
### Debugging Unexpected Failures
Review some of the common tips and suggestions [here](https://github.com/openshift/origin/blob/master/docs/debugging-openshift.md).
###Adding Webhooks and Making Code Changes
### Adding Webhooks and Making Code Changes
Since OpenShift V3 does not provide a git repository out of the box, you can configure your github repository to make a webhook call whenever you push your code.
1. From the console navigate to your project
1. From the console navigate to your project.
2. Click on Browse > Builds
3. From the view for your Build click on the link to display your GitHub webhook and copy the url.
4. Navigate to your repository on GitHub and click on repository settings > webhooks
5. Paste your copied webhook url provided by OpenShift - Thats it!
6. After you save your webhook, if you refresh your settings page you can see the status of the ping that Github sent to OpenShift to verify it can reach the server.
5. Paste your copied webhook url provided by OpenShift
6. Change the Content type to `application/json` - Thats it!
7. After you save your webhook, if you refresh your settings page you can see the status of the ping that Github sent to OpenShift to verify it can reach the server.
###License
### License
This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to [CC0](http://creativecommons.org/publicdomain/zero/1.0/).

View File

@ -11,6 +11,19 @@ map '/lobster' do
run Rack::Lobster.new
end
map '/headers' do
headers = proc do |env|
[200, { "Content-Type" => "text/plain" }, [
env.select {|key,val| key.start_with? 'HTTP_'}
.collect {|key, val| [key.sub(/^HTTP_/, ''), val]}
.collect {|key, val| "#{key}: #{val}"}
.sort
.join("\n")
]]
end
run headers
end
map '/' do
welcome = proc do |env|
[200, { "Content-Type" => "text/html" }, [<<WELCOME_CONTENTS