Viewing RoR apps in production - ruby-on-rails

I'm very new at using RoR, and I'm reading some tutorials and everything but it's all basically centered in the development environment on a local machine (http://localhost:3000).
Because I like playing around with pre-made stuff, I was wondering how I would view the application if I uploaded a project from here? Do I edit the pointers, config? I'm really sorry about this noob question!

To start your app in production simply use:
rails server -e production
You might want to set up config/database.yml first and run:
rake db:migrate

Related

Rails app deploy on Heroku

I'm new in rails app development I am little bit confusing about rails deployment.
I following this guide below and done at all.
That mean my rails app on production mode?
Need to change Puma RACK_ENV to 'production' in Profile before pushing to heroku?
https://devcenter.heroku.com/articles/getting-started-with-rails4
I believe so. The entire tutorial is setting up your rails server to work in production mode. Using some inductive logic, it seems that the tutorial is assuming you're in production:
"Rails 4 no longer has a static index page in production. When you’re
using a new app, there will not be a root page in production, so we
need to create one. We will first create a controller called welcome
for our home page to live:"
Indicates to me that it's assuming your rails server will be running in production.
To make doubly sure, you can check the heroku logs and look for a line that says:
Rails [your version] application starting in production

Rails How To Upload Code To The Production Server

I managed to create my first ROR application, called myapp, locally and I also have created another ROR application on my webfaction server with the same name myapp. My question is every time I run commands "rails generate model" or "rails generate controller", how can I synchronise my local environment with my webfaction server. There seem to be lots of files generated when you run rails commands. Does it mean I have to upload the whole application directory every time I generate something? Kindly suggest with your experience, I'm very new to Rails.
If I were you I would go for Heroku first. It's free and easy and along the way you will learn some about hosting Rails apps.
Getting started with Heroku is a good place to go first https://devcenter.heroku.com/articles/quickstart
Heroku is indeed the easy way out, if you are looking into more "metal" deployment - use Capistrano

Want to develop rails site offline then move to server

Is there an issue with developing my site on my macbook and then moving to a server when done? Will there be issues I need to plan ahead for? DB or ruby related maybe? Dependencies or something a server could have different from my dev environment that could cause a nightmare later? I'd rather develop it offline since it'd be faster and wouldn't require an internet connection but in the past I've always done everything with live sites so this would be a first, and I am new to ruby on rails.
Developing locally and then deploying to your server(s) via something like capistrano is standard practise.
It's a good idea to keep your development environment as close as possible to your production environment (ruby versions, database versions etc). Bundler makes keeping your gems in sync easy
I used Heroku for some projects. The deployment was as easy as it could be. I just did a git push and it worked without problems... I really like bundler and rake :-)
Your Question embodies THE way to develop in Rails. Your development environment is an offline representation of what you're production site will be.
A quick workflow analysis for you could be:
rails new ~/my_app -d postgresql; cd ~/my_app; rm public/index.html
Next, create the database:
bundle exec rake db:create:all
Now you'll have the db and app all set up, let's set up your main pages:
bundle exec rails generate controller Site index about_us contact_us
Now you'll have something to see on the site, so run:
bundle exec rails server
This server acts as your offline connection and will handle the rendering of any text, images, html etc you want to serve in your rails app. Now you can join in the debates of TDD, to TATFT or JITT, rspec vs test::unit. Welcome.
Developing locally is definitely the way to go. However, I would look into getting it on production as soon as possible and pushing often. This way you can see changes happen as you make them and are aware of any possible breaking changes.
I use heroku a lot and when I start a new project I push it to heroku almost immediately. While developing, I can publish new changes simply by git push heroku master. Everyone has to find their own workflow, but this has always worked well for me.
If you are interested in Heroku here is a good link to get you started:
https://devcenter.heroku.com/articles/rails3

Some troubles with deploy rails application

I created rails application, it works great in development environment, but now I want to deploy it. I have a vps with passenger and nginx, I deployed rails application with static pages, but now application needs database.
Which best way to clone structure from development base and then deploy it?
Please give any guides to deploy application?
I use (ubuntu 10.04_64, rails 3.0.6)
It sounds like you want a copy of your development database (structure and data).
If you are using a sqlite3 database in development (which you probably are), then on the server (after you've deployed) make a copy of it and name it production.sqlite3
cp development.sqlite3 production.sqlite3
This will copy the structure and data of your development database. If its a static site however, you could do this on the development machine before you deploy.
Let me know if you need instructions to do this for mysql (or any other database) and I will edit this answer.
rake db:migrate RAILS_ENV=production
or I misunderstood the question?

Need help with my rails 3 environment

pulled down a repo from git. For some reason I need to do
./script/rails.rb s
where on the rails 3 ap I started on my box, I can just do the
rails server
can anyone help me set up my environment so I don't have to do this? I'm still trying to figure out what I need to type to do a migration...
I think I've figured this out. The repo you downloaded was from somebody developing on a Windows machine. They have to add the ".rb" extention to script/rails to get it to work right.
Calling rails server is really just an alias for script/rails. But you're getting an error because when you type rails server, script/rails isn't there.
The solution is easy: in your local copy of that project, rename script/rails.rb back to script/rails the way it should be.
Also, rails s and rails server are the same thing - one is just a shortcut.

Resources