Permalink
Browse files

first commit of Sinatra

  • Loading branch information...
0 parents commit 45036ae450e78995f7c38eef7ba1717b56cd125e @dblado dblado committed Sep 26, 2011
Showing with 130 additions and 0 deletions.
  1. +4 −0 .openshift/action_hooks/build
  2. +8 −0 .openshift/markers/README
  3. +4 −0 Gemfile
  4. +15 −0 Gemfile.lock
  5. +55 −0 README
  6. +30 −0 README.md
  7. +8 −0 app.rb
  8. +6 −0 config.ru
  9. 0 public/.gitkeep
  10. 0 tmp/.gitkeep
@@ -0,0 +1,4 @@
+#!/bin/bash
+# This is a simple build script, place your post-deploy but pre-start commands
+# in this script. This script gets executed directly, so it could be python,
+# php, ruby, etc.
@@ -0,0 +1,8 @@
+Markers
+===========
+
+Adding marker files to this directory will have the following effects:
+
+force_clean_build - Previous output from bundle install --deployment will be
+ removed and all gems will be reinstalled according to the current
+ Gemfile/Gemfile.lock.
@@ -0,0 +1,4 @@
+source 'http://rubygems.org'
+gem 'rack', '1.1'
+gem 'sinatra'
+
@@ -0,0 +1,15 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ rack (1.1.0)
+ sinatra (1.2.6)
+ rack (~> 1.1)
+ tilt (< 2.0, >= 1.2.2)
+ tilt (1.3.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ rack (= 1.1)
+ sinatra
@@ -0,0 +1,55 @@
+Feel free to change or remove this file, it is informational only.
+
+Repo layout
+===========
+tmp/ - Temporary storage
+public/ - Content (images, css, etc. available to the public)
+config.ru - This file is used by Rack-based servers to start the application.
+../data - For persistent data
+.openshift/action_hooks/build - Script that gets run every push, just prior to
+ starting your app
+
+
+Environment Variables
+=====================
+
+OpenShift Express provides several environment variables to reference for ease
+of use. The following list are some common variables but far from exhaustive:
+
+ ENV['OPENSHIFT_APP_NAME'] - Application name
+ ENV['OPENSHIFT_APP_DIR'] - Application dir
+ ENV['OPENSHIFT_DATA_DIR'] - For persistent storage (between pushes)
+ ENV['OPENSHIFT_TMP_DIR'] - Temp storage (unmodified files deleted after 10 days)
+
+When embedding a database using rhc-ctl-app, you can reference environment
+variables for username, host and password:
+
+ ENV['OPENSHIFT_DB_HOST'] - DB host
+ ENV['OPENSHIFT_DB_PORT'] - DB Port
+ ENV['OPENSHIFT_DB_USERNAME'] - DB Username
+ ENV['OPENSHIFT_DB_PASSWORD'] - DB Password
+
+To get a full list of environment variables, simply add a line in your
+.openshift/action_hooks/build script that says "export" and push.
+
+
+Notes about layout
+==================
+Every time you push, everything in your remote application path gets recreated
+please store long term items (like an sqlite database) in ../data which will
+persist between pushes of your repo.
+
+
+Rails 3.0
+===========
+
+Option 1) (Recommended) Git push your application Gemfile/Gemfile.lock. This will
+cause the remote OpenShift node to run bundle install --deployment to download and
+install your dependencies. Each subsequent git push will use the previously
+downloaded dependencies as a starting point, so additional downloads will be a delta.
+
+Option 2) Git add your .bundle and vendor/bundle directories after running
+'bundle install --deployment' locally. Be sure to exclude any gems that have native
+code or ensure they can run on RHEL x86_64.
+
+
@@ -0,0 +1,30 @@
+Sinatra on OpenShift Express
+============================
+
+This git repository helps you get up and running quickly w/ a Sinatra installation
+on OpenShift Express.
+
+
+Running on OpenShift
+----------------------------
+
+Create an account at http://openshift.redhat.com/
+
+Create a rack-1.1 application
+
+ rhc-create-app -a sinatra -t rack-1.1
+
+Add this upstream seambooking repo
+
+ cd sinatra
+ git remote add upstream -m master git://github.com/openshift/sinatra-example.gitd
+ git pull -s recursive -X theirs upstream master
+
+Then push the repo upstream
+
+ git push
+
+That's it, you can now checkout your application at:
+
+ http://sinatra-$yourdomain.rhcloud.com
+
@@ -0,0 +1,8 @@
+get '/' do
+ "the time where this server lives is #{Time.now}
+ <br /><br />check out your <a href=\"/agent\">user_agent</a>"
+end
+
+get '/agent' do
+ "you're using #{request.user_agent}"
+end
@@ -0,0 +1,6 @@
+require 'rubygems'
+require 'bundler'
+Bundler.require
+
+require './app.rb'
+run Sinatra::Application
No changes.
No changes.

0 comments on commit 45036ae

Please sign in to comment.