Can you convert a Rails app to Sinatra on Heroku - ruby-on-rails

Does anyone know if there is any issues with converting a Rails app to Sinatra with Heroku? I already have a Heroku app running and it is currently a simple Rails app that is basically a few views and a controller with no database interaction. Are there any potential issues if I just change everything from Rails to Sinatra?

There shouldn't be any issues, other than the manual work required by you. You'll want to make sure and update your Procfile to run your Sinatra app correctly. See here for Deploying Rack-based Apps on Heroku's Devcenter. I also recommend using Foreman for local development, it should helping to find any possible issues running on Heroku easier: https://devcenter.heroku.com/articles/procfile#developing-locally-with-foreman

Related

Ruby on Rails run at Blogspot?

I tried to build a ruby-based website. but I want to start on blogspot which is free for beginners. can the ruby system be placed on blogspot, I am very happy if this happens.
No Blogspot does not support ruby on rails. Even it is just a blogging platform where you already have CMS to serve you. But you should have a development environment. Please try Heroku.com if you want free.
check this tutorial https://devcenter.heroku.com/articles/getting-started-with-rails5 to launch your first application on Heroku.
You can add the following lines after
rails generate controller welcome
rails generate scaffold product name 'price:decimal{7,2}'
rails db:migrate
This will create a sample application where you can do all CRUD operation on product. you can try following
rails s
Now visit localhost:3000/products
After installation on Heroku you will get your url where you can run app and do all CRUD operation. Just try it is very easy to do.
If you are working with Ruby on Rails, consider to work with another platform like Wordpress instead. But I think it takes time.

Rails Carrierwave freezes app when uploading -- Will it do the same in Production

I'm not sure if this question suits SO but I've been testing out Carrierwave & tweaking it a little. I've noticed that when uploading a file to s3 using fog (this are small files, by the way..), my Rails app comes to a 'stand still' until the upload finishes processing.
I'm going to move all the processing to the background later on but this has me wondering:
Is it only like this in development?
Any overall suggestions?
Please see Best Ruby on Rails Architecture for Image Heavy App, et al. My answer there is specifically about Heroku, but Heroku's merely a worst-case-scenario due to their many-small-servers architecture.
I have similar issues when using the default webrick, but when uploading in production with apache and passenger, I do not have these issues. You might try switching to thin in your development environment to see if that yields better results.

Preferable way to distribute a Rails app

Although Rails and PHP have different deployment methods, what is the preferable way to distribute a FOSS Rails app? Suppose one of the major PHP apps - Magento, Drupal, Wordpress had been build upon RoR, what would have been the preferable way for them to have distributed their application?
Packaging up the code as a gem seems to be the wrong approach for a complete out-of-the-box application, but I could be wrong.
Coming from the world of PHP with its upload-and-go approach, and being a newcomer to Rails, it's rather opaque at the moment to see how code could be easily and effectively distributed.
Packaging a completed Rails app as a gem is probably the wrong approach. I think the best solution is to provide access to a git repository or a tarball of your git repo.
If you want to offer your users something more than rake db:schema:load to setup your app it's pretty easy to create custom setup commands.
Many applications are packaged with the source code just like typical PHP applications. While deploying Rails applications may seem difficult its expected that the user will know how to set up the server properly according to their environment and needs. The only issue you need to worry about is distributing the code, setting up the server is not a domain that you are going to want to help with.
For information on deployment in Rails you should see the deployment page here.
Well, usually Rails apps run in environment running Apache + Passenger (aka mod_rails).
Deployment is easily done with Capistrano gem.
When you're running Rails app in shared host environment, they usually use fcgi/cgi dispatchers to run Ruby.

I'm a bit lost: how to render rails/ruby on a website?

Ok, long time php guy doing my best to pick up ruby on rails by developing a small website for myself using only ror instead of php.
However i'm a bit stuck, and i think it is because i'm not exactly understanding how rails actually works.
I am running centos 5.5 / apache2. I have successfully installed ruby, rubygems, and subsequently rails and passenger. All these are 'working', i can run ruby commands, gem commands etc.
But how do I start using rails on my website? If I create an .erb or .rb file with some simple ruby commands, it just displays as plain text when I navigate to it.
Do I need to configure apache to 'execute' .rb or .erb files (similar to the way .php files execute?).
Any help would be GREATLY appreciated!!
You might check out the Rails Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
I suggest you read a huge tutorial on this topic: http://guides.rubyonrails.org/getting_started.html.
Ruby is the language, and Ruby on Rails is a framework. From the guide:
Rails is a web application development
framework written in the Ruby
language. It is designed to make
programming web applications easier by
making assumptions about what every
developer needs to get started. It
allows you to write less code while
accomplishing more than many other
languages and frameworks. Experienced
Rails developers also report that it
makes web application development more
fun.
I'd read Chapter 4, if you already know all this, as it talks about the actual webserver.
Rails comes with it's own webserver, so Apache isn't needed.
Sounds like you need to really get a handle on Rails and what it is first. This site has some great information for beginners, and should help you understand what you are working with and your next steps to get an application running:
http://guides.rubyonrails.org/getting_started.html
I've also heard some good things about the information here:
http://railsforzombies.org/
Check out Ruby on Rails Tutorial for getting started in Rails.
As #Blender mentioned, rails comes with an in build web server called webrick. (Think of it same as apache .. for now)
so all you have to do is go to the rails project directory, and run the command
if you are using rails < 3.x
ruby script/server
if you are using rails > 3.x
rails server
once u done this your rails project will start in webrick server and by default in port 3000
http://localhost:3000
you may consider apache/ some other rails server setup for production deployment, but to get started you dont need apache at all
and welcome to ruby world ! :D
HTH
sameera

upload rails app to live server

how do i go about uploading a rails app that works locally (on MAMP) to a live server?
thanks
There are numerous solutions. The most common one is using capistrano, but you could find some hosting solution with their own deployment process like Heroku.
Rails guides on the subject: http://rubyonrails.org/deploy

Resources