Deploy Rails App - ruby-on-rails

I have been asked to make a few cosmetic changes to our production deployment. I have access to our linux box where I can see the files I need to change. I only need to change html.erb files, but when I add, for instance a simple <p> tag, it does not show up live.
I know I probably have to reset the server or redeploy the code, but I have no idea what to do.
Our production deployment is not fully live, so I am making changes on the fly (I know that this is not the best practice). Our app is running in a shared hosting environment for the moment.
I have seen threads where people use Capistrano to deploy but how? We do not currently use it.
Can anyone help?

Whenever you make changes in production files, you have to restart the server to see the changes.
In production environment cache_classes is set to true. One can disable it and changes will be reflected without restarting the server.
So to reflect the change restart the server.
thanks......

I found a good guide on the Capistrano github wiki and also used this guide # kris.me.uk about a complete rails setup, including the Capistrano deployment aspect. I used them when learning how to deploy rails apps effectively. They should tell you what you need to know to get a basic deployment setup up and running.

Just incase someone is looking for the answer:
When rails is in development mode it will automatically reload changed files. When in production I need to restart it.
I eventually found out that we use God (A proces monitoring framework for rails - link here).
I had to restart our app with the following command: 'god restart APP_NAME'
Hope that helps someone :)

I wrote a Capistrano // NGINX guide and posted it on my blog. It's 85% correct, and should help you understand the big picture of the server/Rails/SSH configurations.
http://westonplatter.com/blog/2012/08/19/rails-slash-nginx-rackspace-deployment/

Related

Teamwork Ruby on Rails

I've been working with RoR for a while but now I need to work with designers and other developers. Is there a tool like github or something like dropbox where you can share with your team the files but with a URL where you can check live any change. For example for my own I just run Rails s and I can see what happen on my localhost but for a designer it isn't that simple. And also we don't want everybody running his own rails project on his localhost.
So is there a tool or what do you do guys when you have to work with others collaborates?
You consider to use a staging environment?
A staging environment (stage) is a nearly exact replica of a production environment for software testing. Staging environments are made to test codes, builds, and updates to ensure quality under a production-like environment before application deployment. The staging environment requires a copy of the same configurations of hardware, servers, databases, and caches. Everything in a staging environment should be as close a copy to the production environment as possible to ensure the software works correctly.
See the Font
To use it, i recommend you a application like Heroku, after configure, you can 'deploy' your app commiting in a branch (its not real time, but works for your case).
If you have a VM, i recommends you this tutorial: https://emaxime.com/2014/adding-a-staging-environment-to-rails.html
Open questions like this are not really best placed on StackOverflow, which is geared more toward solving specific issues, with provided code examples and errors etc.
However, in answer to your question:
I see you mention Github in your question, but do you fully understand the underlying concept of Git Version Control, or is there a speficic reason as to why it doesn't meet your needs? As far as I believe, it's main purpose is to solve your exact scenario.
https://guides.github.com/introduction/git-handbook/

What is absolutely the easiest way to create and publish a Rails 3.0 application from Windows?

In an attempt to reach programming enlightenment, I'm trying to build my latest website within the Rails ecosystem. I'm finding this very hard going as a .Net developer and need a push in the right direction as I'm on the verge of giving up and going back to what I know.
I've got something approaching a prototype going in Rails, and have been trying to figure out how to get to the point where I have a sensible deployment set-up to publish a beta of this thing. I don't see any point in developing any further until I know I'll be able to publish in a sensible fashion.
So far, I have signed up for hosting at HostingRails, created an SVN repository at Google Code and installed Capistrano. The problem I'm now facing is that I have no idea how to alter my Capfile and Deploy.rb to get these talking to each other, and that's before I've even thought about database deployment. The problem is that the tutorials on the hosting provider aren't great and the documentation for Capistrano goes straight over my head. I'm at a point where Capistrano presents me with a password prompt, and no password relating to anything I know of seems to work. Capistrano doesn't give me a hint of what it's trying to do, and I have no idea how to verify any of the lines in my config file to find out what's wrong.
Can anyone suggest a complete toolchain that will allow me to publish an application with as little configuration as possible? Am I going in vaguely the right direction and will this also give me sensible DB deployment options? Can anyone suggest a simple step-by-step guide which doesn't require an understanding of 37 separate gems before deployment is possible?
I would suggest git and heroku for rails projects rather than svn and HostingRails. msysgit works well on Windows, and I just started using heroku and it's as easy as installing the heroku gem and doing "git push heroku master".

How do I deploy my Rails Application

I've been spending the last few months on developing a (my first) Rails application all by my self, just me and my Linux box, all in my development RAILS_ENV, no SCM ("for shame!") or anything. It has become quite the beast now and I am getting ready to release it onto the world. My question is: how am I ever going to make this work?
I installed gems, plugins, servers (MySQL, node.js, nginx, sphinx, juggernaut), photo compression apps that I call, video compression tools (FFMPEG) etc, I also obviously have a DB and a (lot of) seed data. I can't even remember all the things I did to my system to make it all work, but it does.
So now, when I deploy this on some stranger's server, how do I make sure that all those things get installed and configured correctly? How is e.g. FFMPEG ever going to get installed on this server when I deploy my application. How will the seed data get uploaded, how will the servers get started, with the right parameters etc.
I have read (a little bit) about Capistrano which seems to be the deployment tool of choice in the Rails community, but I am not sure if that will cover all my needs. For example, how do I figure out all the gems I used or the plugins (do I even need to know?). Is there any way I can test the deployment on my own linux box,the same I am developing on, i.e. pretend that I am hosting my own production server/rails_env and "deploy" it there?
Any help will be much appreciated.
Cheers.
There a lot of standards to follow that make life easier...
As far as figuring out which gems you need, you could try and use RVM and make a local config that you keep adding gems to until your app works. This will be kind of like starting from scratch so that you are sure to know precisely what configuration you need to run. (And it should make it easy to stand up a new, identical environment each time.)
The RVM route will allow you to test in a specific environment, which should help.
You can list the required gems in your environment.rb file so that the server demands them on start-up.
Good Luck, Cowboy .

How did this Ruby on Rails app get deployed?

I have a Ruby on Rails app running on my server, and I can't figure out how it was deployed (someone else set it up).
The app is located in /var/www/myapp. Before it was deployed, I had been able to go in there and make minor edits to the app. The person helping me out with RoR then "deployed" it. It was unclear what deploying actually did, since it points to the same database and is on the same server. However, I can no longer edit it (or at least, the files I am editing are not being pointed to by the server).
Any way to figure out how this thing was deployed so I can take it down to edit it? Or should I basically just start over?
Was it maybe running in development mode before, and now it's in production? When it's in development mode, all of the files are loaded on each request, so your changes show up immediately. In production mode, you have to restart the server to see your changes.

Why don't my views update?

I'm new to Ruby on Rails and am creating a test application. So far, it's working, but when I make some minor changes to my views, the page doesn't change.
My problem may be related to this question, but I'm not sure what is meant by setting the date and time in the VM. My code is on a remotely hosted server, so I assume it would use the system time of that machine.
Is there a caching issue here? What can I do about it?
If you don't have control over the server environment yourself (no shell access, etc.), you can set the following at the top of config/environment.rb:
ENV['RAILS_ENV'] = 'development'
Development doesn't cache much, so while it's slower it's much nicer to develop in.
You'll still need to restart your app after making changes to anything outside the app/ folder though (configs, plugins, etc.).
You need to restart your Rails app (or Apache if you are using Passenger) if you are in production mode!

Resources