├── .gitignore ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Procfile ├── README.md ├── config.ru ├── config └── puma.rb └── web.rb /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_* 2 | 3 | .env 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | ruby '2.4.1' 3 | gem 'sinatra' 4 | gem 'puma' 5 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | puma (3.6.0) 5 | rack (1.6.4) 6 | rack-protection (1.5.3) 7 | rack 8 | sinatra (1.4.7) 9 | rack (~> 1.5) 10 | rack-protection (~> 1.4) 11 | tilt (>= 1.3, < 3) 12 | tilt (2.0.5) 13 | 14 | PLATFORMS 15 | ruby 16 | 17 | DEPENDENCIES 18 | puma 19 | sinatra 20 | 21 | RUBY VERSION 22 | ruby 2.4.1p111 23 | 24 | BUNDLED WITH 25 | 1.15.0 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ruby Quick Start Guide 2 | 3 | This guide will walk you through deploying a Ruby application on [Deis Workflow][]. 4 | 5 | ## Usage 6 | 7 | ```console 8 | $ git clone https://github.com/deis/example-ruby-sinatra.git 9 | $ cd example-ruby-sinatra 10 | $ deis create 11 | Creating Application... done, created benign-quilting 12 | Git remote deis successfully created for app benign-quilting. 13 | $ git push deis master 14 | Delta compression using up to 4 threads. 15 | Compressing objects: 100% (4/4), done. 16 | Writing objects: 100% (4/4), 1.12 KiB | 0 bytes/s, done. 17 | Total 4 (delta 2), reused 0 (delta 0) 18 | Starting build... but first, coffee! 19 | -----> Ruby app detected 20 | -----> Compiling Ruby/Rack 21 | -----> Using Ruby version: ruby-2.3.1 22 | -----> Installing dependencies using bundler 1.11.2 23 | Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment 24 | Fetching gem metadata from http://rubygems.org/.......... 25 | Fetching version metadata from http://rubygems.org/.. 26 | Installing tilt 2.0.5 27 | Installing puma 3.6.0 with native extensions 28 | Installing rack 1.6.4 29 | Using bundler 1.11.2 30 | Installing rack-protection 1.5.3 31 | Installing sinatra 1.4.7 32 | Bundle complete! 2 Gemfile dependencies, 6 gems now installed. 33 | Gems in the groups development and test were not installed. 34 | Bundled gems are installed into ./vendor/bundle. 35 | Bundle completed (4.87s) 36 | Cleaning up the bundler cache. 37 | -----> Writing config/database.yml to read from DATABASE_URL 38 | 39 | -----> Discovering process types 40 | Procfile declares types -> web 41 | Default process types for Ruby -> rake, console, web 42 | -----> Compiled slug size is 19M 43 | Build complete. 44 | Launching App... 45 | Done, benign-quilting:v2 deployed to Workflow 46 | 47 | Use 'deis open' to view this application in your browser 48 | 49 | To learn more, use 'deis help' or visit https://deis.com/ 50 | 51 | To ssh://git@deis-builder.deis.rocks:2222/benign-quilting.git 52 | * [new branch] master -> master 53 | $ curl http://benign-quilting.deis.rocks 54 | Powered by Deis 55 | Release v2 on benign-quilting-web-2270916958-efwx3 56 | ``` 57 | 58 | ## Additional Resources 59 | 60 | * [GitHub Project](https://github.com/deis/workflow) 61 | * [Documentation](https://deis.com/docs/workflow/) 62 | * [Blog](https://deis.com/blog/) 63 | 64 | [Deis Workflow]: https://github.com/deis/workflow#readme 65 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | require './web' 2 | run Sinatra::Application 3 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | workers Integer(ENV['WEB_CONCURRENCY'] || 2) 2 | threads_count = Integer(ENV['MAX_THREADS'] || 5) 3 | threads threads_count, threads_count 4 | 5 | preload_app! 6 | 7 | rackup DefaultRackup 8 | port ENV['PORT'] || 5000 9 | environment ENV['RACK_ENV'] || 'development' 10 | -------------------------------------------------------------------------------- /web.rb: -------------------------------------------------------------------------------- 1 | require 'sinatra' 2 | 3 | set :port, ENV["PORT"] || 5000 4 | 5 | get '/healthz' do 6 | status 200 7 | end 8 | 9 | get '/' do 10 | whom = ENV["POWERED_BY"] || "Deis" 11 | revision = ENV['WORKFLOW_RELEASE'] || "unknown" 12 | container = `hostname`.strip || "unknown" 13 | "Powered by #{whom}\nRelease #{revision} on #{container}\n" 14 | end 15 | --------------------------------------------------------------------------------