Code Monkey home page Code Monkey logo

ruby-getting-started's Introduction

ruby-getting-started

A barebones Rails app, which can easily be deployed to Heroku.

This application supports the Getting Started on Heroku with Ruby article - check it out.

Running Locally

Make sure you have Ruby installed. Also, install the Heroku CLI (formerly known as the Heroku Toolbelt).

$ git clone [email protected]:heroku/ruby-getting-started.git
$ cd ruby-getting-started
$ bundle install
$ bundle exec rake db:create db:migrate
$ heroku local

Your app should now be running on localhost:5000.

Deploying to Heroku

Using resources for this example app counts towards your usage. Delete your app and database as soon as you are done experimenting to control costs.

By default, apps use Eco dynos if you are subscribed to Eco. Otherwise, it defaults to Basic dynos. The Eco dynos plan is shared across all Eco dynos in your account and is recommended if you plan on deploying many small apps to Heroku. Learn more about our low-cost plans here.

Eligible students can apply for platform credits through our new Heroku for GitHub Students program.

Ensure you're in the correct directory:

$ ls
Gemfile		Procfile	Rakefile	app.json	config		db		log		public		tmp
Gemfile.lock	README.md	app		bin		config.ru	lib		package.json	test		vendor

You should see a Gemfile file. Then run:

$ heroku create
$ git push heroku main
$ heroku run rake db:migrate
$ heroku open

or

Deploy to Heroku

Documentation

For more information about using Ruby on Heroku, see these Dev Center articles:

ruby-getting-started's People

Contributors

bricesanchez avatar calebhearth avatar dependabot[bot] avatar docmorg avatar edmorley avatar ericwhitlock avatar friism avatar hannesfostie avatar jonmountjoy avatar jonnymacs avatar kwlockwo avatar nicolasleger avatar ntassone avatar o-i avatar pmq20 avatar schneems avatar svc-ast-gh-snyk3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-getting-started's Issues

Update from Ruby 2.6.6 to 2.6.8 (or 2.7)

This project is using Ruby 2.6.6, however the latest 2.6 release is 2.6.8, as mentioned in the build output when using this repo:

remote:        There is a more recent Ruby version available for you to use:        
remote:                
remote:        2.6.8        
remote:        
remote:        The latest version will include security and bug fixes. We always recommend        
remote:        running the latest version of your minor release.        
remote:                
remote:        Please upgrade your Ruby version.        
remote:                
remote:        For all available Ruby versions see:        
remote:          https://devcenter.heroku.com/articles/ruby-support#supported-runtimes        

For bonus points, this repo could be updated to Ruby 2.7 :-)

cc @schneems

Bundle Install Error

Hello, I try to run 'bundle install' but I got this result:
11 error bundle install

Then I run 'gem install pg -v '0.17.1' '
The result is:

Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby -r ./siteconf20150628-12053-kbx4ef.rb extconf.rb

checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
/usr/local/lib/ruby/2.2.0/mkmf.rb:456:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/lib/ruby/2.2.0/mkmf.rb:587:intry_cpp'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:1113:in block in find_header' from /usr/local/lib/ruby/2.2.0/mkmf.rb:911:inblock in checking_for'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:351:in block (2 levels) in postpone' from /usr/local/lib/ruby/2.2.0/mkmf.rb:321:inopen'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:351:in block in postpone' from /usr/local/lib/ruby/2.2.0/mkmf.rb:321:inopen'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:347:in postpone' from /usr/local/lib/ruby/2.2.0/mkmf.rb:910:inchecking_for'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:1112:in find_header' from extconf.rb:48:in

'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/pg-0.17.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/pg-0.17.1/gem_make.out

Can someone help me please? Thanks.

Command `docker-compose up web` not run

Here is command output

Building web
[+] Building 3.3s (7/10)                                                                                                                                   
 => [internal] load build definition from Dockerfile                                                                                                  0.0s
 => => transferring dockerfile: 43B                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                       0.0s
 => [internal] load metadata for docker.io/heroku/ruby:latest                                                                                         2.4s
 => [internal] load build context                                                                                                                     0.0s
 => => transferring context: 7.66kB                                                                                                                   0.0s
 => [1/1] FROM docker.io/heroku/ruby@sha256:29ddba7cbe0385a4ad5c275e363b7b961d528434866a1ba69e4c7c365179e4c7                                          0.0s
 => CACHED [2/1] COPY [Gemfile, Gemfile.lock, /app/user/]                                                                                             0.0s
 => ERROR [3/1] RUN bundle install --path /app/heroku/ruby/bundle --jobs 4                                                                            0.7s
------                                                                                                                                                     
 > [3/1] RUN bundle install --path /app/heroku/ruby/bundle --jobs 4:                                                                                       
#7 0.561 Don't run Bundler as root. Bundler can ask for sudo if it is needed, and                                                                          
#7 0.561 installing your bundle as root will break this application for all non-root                                                                       
#7 0.561 users on this machine.                                                                                                                            
#7 0.685 --- ERROR REPORT TEMPLATE -------------------------------------------------------                                                                 
#7 0.685 - What did you do?
#7 0.685 
#7 0.685   I ran the command `/app/heroku/ruby/bundle/ruby/2.2.0/bin/bundle install --path /app/heroku/ruby/bundle --jobs 4`
#7 0.685 
#7 0.685 - What did you expect to happen?
#7 0.685 
#7 0.685   I expected Bundler to...
#7 0.685 
#7 0.685 - What happened instead?
#7 0.685 
#7 0.685   Instead, what actually happened was...
#7 0.685 
#7 0.685 
#7 0.685 Error details
#7 0.685 
#7 0.685     TypeError: no implicit conversion of Symbol into Integer
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/ruby_dsl.rb:4:in `[]'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/ruby_dsl.rb:4:in `ruby'
#7 0.685       /app/user/Gemfile:2:in `eval_gemfile'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/dsl.rb:32:in `instance_eval'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/dsl.rb:32:in `eval_gemfile'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/dsl.rb:10:in `evaluate'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/definition.rb:25:in `build'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler.rb:155:in `definition'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/cli/install.rb:78:in `run'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/cli.rb:155:in `install'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/cli.rb:10:in `start'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/bin/bundle:20:in `block in <top (required)>'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/gems/bundler-1.9.10/bin/bundle:18:in `<top (required)>'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/bin/bundle:23:in `load'
#7 0.685       /app/heroku/ruby/bundle/ruby/2.2.0/bin/bundle:23:in `<main>'
#7 0.685 
#7 0.685 Environment
#7 0.685 
#7 0.685     Bundler   1.9.10
#7 0.685     Rubygems  2.4.5.1
#7 0.685     Ruby      2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
#7 0.685     GEM_HOME  /app/heroku/ruby/bundle/ruby/2.2.0
#7 0.685     GEM_PATH  
#7 0.685     Git       1.9.1
#7 0.685 
#7 0.685 Bundler settings
#7 0.685 
#7 0.685     path
#7 0.685       Set for your local app (/app/heroku/ruby/.bundle/config/config): "/app/heroku/ruby/bundle"
#7 0.685     jobs
#7 0.685       Set for your local app (/app/heroku/ruby/.bundle/config/config): 4
#7 0.685     disable_shared_gems
#7 0.685       Set for your local app (/app/heroku/ruby/.bundle/config/config): "1"
#7 0.685     app_config
#7 0.685       Set via BUNDLE_APP_CONFIG: "/app/heroku/ruby/.bundle/config"
#7 0.685 --- TEMPLATE END ----------------------------------------------------------------
#7 0.685 
#7 0.685 Unfortunately, an unexpected error occurred, and Bundler cannot continue.
#7 0.685 
#7 0.685 First, try this link to see if there are any existing issue reports for this error:
#7 0.685 https://github.com/bundler/bundler/search?q=no+implicit+conversion+of+Symbol+into+Integer&type=Issues
#7 0.685 
#7 0.685 If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
#7 0.685 https://github.com/bundler/bundler/issues/new
------
executor failed running [/bin/sh -c bundle install --path /app/heroku/ruby/bundle --jobs 4]: exit code: 1
ERROR: Service 'web' failed to build : Build failed

Fails to boot after deploy due to `undefined method `new' for Statsd:Module`

Steps to reproduce:

  1. git clone https://github.com/heroku/ruby-getting-started.git
  2. heroku create
  3. git push heroku master
  4. heroku open # App crashes with H10 error

Stack trace of crash:

2017-07-25T09:12:18.415329+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2017-07-25T09:12:20.067968+00:00 app[web.1]: [4] Puma starting in cluster mode...
2017-07-25T09:12:20.067981+00:00 app[web.1]: [4] * Version 3.8.2 (ruby 2.4.1-p111), codename: Sassy Salamander
2017-07-25T09:12:20.067983+00:00 app[web.1]: [4] * Min threads: 5, max threads: 5
2017-07-25T09:12:20.068007+00:00 app[web.1]: [4] * Environment: production
2017-07-25T09:12:20.068009+00:00 app[web.1]: [4] * Process workers: 2
2017-07-25T09:12:20.068025+00:00 app[web.1]: [4] * Preloading application
2017-07-25T09:12:20.807896+00:00 app[web.1]: [4] ! Unable to load application: NoMethodError: undefined method `new' for Statsd:Module
2017-07-25T09:12:20.808084+00:00 app[web.1]: NoMethodError: undefined method `new' for Statsd:Module
2017-07-25T09:12:20.807963+00:00 app[web.1]: bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.4.0/bin/puma)
2017-07-25T09:12:20.808085+00:00 app[web.1]:   /app/config/application.rb:15:in `<class:Application>'
2017-07-25T09:12:20.808086+00:00 app[web.1]:   /app/config/application.rb:14:in `<module:RubyGettingStarted>'
2017-07-25T09:12:20.808086+00:00 app[web.1]:   /app/config/application.rb:13:in `<top (required)>'
2017-07-25T09:12:20.808087+00:00 app[web.1]:   /app/config/environment.rb:2:in `require'
2017-07-25T09:12:20.808087+00:00 app[web.1]:   /app/config/environment.rb:2:in `<top (required)>'
2017-07-25T09:12:20.808088+00:00 app[web.1]:   config.ru:3:in `require'
2017-07-25T09:12:20.808088+00:00 app[web.1]:   config.ru:3:in `block in <main>'
2017-07-25T09:12:20.808089+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/builder.rb:55:in `instance_eval'
2017-07-25T09:12:20.808090+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/builder.rb:55:in `initialize'
2017-07-25T09:12:20.808090+00:00 app[web.1]:   config.ru:in `new'
2017-07-25T09:12:20.808090+00:00 app[web.1]:   config.ru:in `<main>'
2017-07-25T09:12:20.808091+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/builder.rb:49:in `eval'
2017-07-25T09:12:20.808091+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/builder.rb:49:in `new_from_string'
2017-07-25T09:12:20.808092+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/builder.rb:40:in `parse_file'
2017-07-25T09:12:20.808092+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/configuration.rb:313:in `load_rackup'
2017-07-25T09:12:20.808093+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/configuration.rb:242:in `app'
2017-07-25T09:12:20.808093+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/runner.rb:138:in `load_and_bind'
2017-07-25T09:12:20.808093+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/cluster.rb:391:in `run'
2017-07-25T09:12:20.808094+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/cli.rb:77:in `run'
2017-07-25T09:12:20.808094+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/launcher.rb:172:in `run'
2017-07-25T09:12:20.808095+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/bin/puma:10:in `<top (required)>'
2017-07-25T09:12:20.808095+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/bin/puma:22:in `<top (required)>'
2017-07-25T09:12:20.808095+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/bin/puma:22:in `load'
2017-07-25T09:12:20.925543+00:00 heroku[web.1]: Process exited with status 1
2017-07-25T09:12:20.937365+00:00 heroku[web.1]: State changed from starting to crashed

Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) excluded from capture: DSN not set

Whenever deploying my Rails 5 app to Heroku I get the following error:

D, [2017-07-24T21:05:01.214198 #524] DEBUG -- : Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) excluded from capture: DSN not set

Procfile

web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -c 5 -v

config/initializers/redis.rb

require 'redis'

uri = URI.parse Settings.redis.host
redis = Redis.new host: uri.host, port: uri.port, password: uri.password

config/initializers/sidekiq.rb

Sidekiq.configure_server do |config|
    config.redis = { url: Settings.redis.host }
end

Sidekiq.configure_client do |config|
    config.redis = { url: Settings.redis.host }
end
    
# Perform Sidekiq jobs immediately in development,
# so you don't have to run a separate process.
# You'll also benefit from code reloading.
if Rails.env.development?
    require 'sidekiq/testing'
    Sidekiq::Testing.inline!
end

Settings.redis.host equals 'redis://localhost:6379/' in development and my RedisToGo URL in production.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.