My site is currently dead therefore I can't explain how urgent for me this is.
Situation: A few days ago I received an e-mail from Heroku "ACTION REQUIRED: Rails Security Vulnerability " advising me to update rails to version '3.2.11'. After I followed all the steps in the e-mail I tried to open my web site. I was extremely surprised when I saw that I can't open my site. My site is made with RefineryCMS.
Is it possible, using git, to restore my site to the previous point in time when everything was working great?
When I run the site locally I get the following error:
ActiveRecord::RecordNotFound in Refinery::PagesController#home
Couldn't find Refinery::Page with id=torte-za-rodendan
...
app/views/stranice/naslovnica/_favourite_products.html.erb:7:in `_app_views_stranice_naslovnica__favourite_products_html_erb__4156700835010289094_66485000'
app/views/refinery/pages/home.html.erb:16:in `_app_views_refinery_pages_home_html_erb___2482419061129865361_67
Yep, we all got that email from Heroku.
Since your site was versioned with git before, you can undo the last commit by following these steps.
However, I am not sure whether you really need to do the above. You just need to make sure that your heroku app runs on rails 3.2.11 - it is a pretty serious security issue, maybe heroku even blocks sites that aren't upgraded quickly enough.
Follow these steps:
Run your tests and make sure everything works
Open up a new branch through git (git checkout -b new_rails)
Change Rails 3.2.11 in your Gemfile
Change RAILS_GEM_VERSION to '3.2.11' in environment.rb
Run bundle update rails
Run the tests and see if everything still works
If not, reverse back to the old branch by doing git checkout master; optionally delete the new branch by doing git branch -D new_rails
Doing it only on the new branch ensures nothing breaks.
If you still get errors afterwards, please tell us what's in heroku's log.
Related
I'm following this tutorial to a tee and so far so good. I ran into a problem on step 2.6
On my terminal I input
heroku open
After which it opened a new webpage on Chrome.
The terminal then displayed
Opening aqueous-forest-3891... done
The webpage that opened was https://aqueous-forest-3891.herokuapp.com/ and unfortunately it says the webpage may have been moved or does not exist.
I've followed the tutorial exactly (as far as I can tell) and can't figure out what I've done wrong. I'm very new to Rails (and Ruby....and Heroku...).
I'm not exactly sure how to troubleshoot my problem or if there's a command I can use in my terminal for debugging - etc.
Good news: a Rails error means your app is running on the server
Bad news : your routes are likely causing a problem.
According to this blog (which has exactly the same issue), the problem is that Heroku won't host the "default" Rails page. You'll need to create a default page & redeploy:
#config/routes.rb
root "application#index"
#app/views/application/index.html.erb
Hello world
$ git add .
$ git commit -a -m "Default Page"
$ git push heroku master
Context
The error you're seeing is one from Rails:
This is good, as it means your Rails app is actually on the Heroku server & being picked up. This type of error is either suggestive that you have an error with your server (500 error), or a missing page (404 error).
-
If you had the following error, it would be a Heroku (platform) centric issue:
This is normally caused either by a lack of database connectivity, or some sort of environment issue (ENV vars missing etc).
The best way to debug Heroku is to use the Heroku logs.
These are written - as with most event-based software - on the server, allowing you to see what's going on. Heroku recently upgraded their software to include a new real-time logging system:
Checking in there will tell you what's going on, allowing you to take direct action to resolve it.
To debug your issue you will need to view the logs. A quick way is to add the Papertrail add on to your app (there's a free option). Add-ons can be added via the resources tab from Heroku.
Another option is to to view the heroku logs in the terminal with the command
heroku logs -t --app appName
By viewing the logs, you should get some error messages that will help you debug why your app isn't showing.
In my case I deployed custom branch to heroku master, which; heroku usually does not build itself.
If you want to deploy custom branch to heroku use this command.
git push -f heroku your_branch_name:master
I am developing an application for issue tracking in which I want to provide the ability to view revision information related to an issue. So, I need to search the git repository for commit with messages containing the issue key.
Currently, the only gem I found that could help me is rugged but it doesn't provide this functionality. You can search only by the sha1.
Any ideas?
my idea would be to just embrace the powers of your command line.
it's super easy to do this in ruby and the git executable plays nice with calling into it:
`git log --oneline --grep=fail`.split("\n")
=> ["a9c6cf1 allow dashes in github names and show errors on failed validations, closes #54", "e140ed6 update friendly_id and fix failing spec", "871b06a remove failing test", "eff0c4b simplify failing test", "f72889f add production env, otherwise asset task will fail, wtf...", "daee196 first step of migrating to rails 3.1"]
this example searches for fail in the commit messages
after a few months learning a bit about rails and making some stuff local, I wanted to try to upload a simple rails app to heroku. Which, by the way, was a pain in the ass because of installing issues of Postgresql. But ok, that's done.
Now I create an app on heroku, I did the login, key thing, git, and uploaded. Was fine, very easy after all. I just uploaded an empty rails app, to try heroku.
Well, then I add a controller. Upload again via git push heroku master and not so fine! I did scaffold, for my articulo controller. And I wasn't able to open the URL once pushed to heroke on someurl/articulos. I got an 404 heroku message here: http://enigmatic-scrubland-8865.herokuapp.com/articulos
Then I create a controller for the home site and get rid of the "welcome aboard" default site. Again push heroku... On terminal I got messages all updated, and lauching. All fine.
But then I access and again, the "welcome aboard" default page.
Locally it works fine. But now I'm not sure if I'm doing it well. It scares me that no failing messages are to see nowhere, but obviously it fails.
After editing my rails app, I always do this:
$ git init
$ git add .
$ git commit -m "init"
$ git push heroku master
Like the documentation says on heroku. But, no error and no updating.
Thanks in advice.
From what I see from heroku devcenter, the git init part is only to be done on the first initial creation of the git repo, not "After editing my rails app".
In other words, you shouldn't have to "always do" a git init after editing your rail apps.
For the first push, I would recommend a:
git push -u heroku master
That way, all the subsequent push will be a simple:
git push
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
I'm trying to deploy my rails application with heroku (as shown here). I've created a very simple rails application (using ruby 1.9.2 and rails 3.0.3; i'm sure heroku supports these - see heroku docs), created and pushed github repo, created heroku repo and pushed it (all commiting is done). And when i'm trying to access my application controller, it throws 404 rails page like it's saying 'there is no such controller'. I've done heroku rake db:migrate but first time i ran it i got 'host not found' error. Running this again fixed that. Well, i'm not sure if i should run heroku addons add:postgresql - i though postgres is on by default, but heroku says i should pay in order to get DB (running command i've mentioned asks me to confirm billing it).
May be it sounds stupid, but how can i deploy my rails application (it's a very simple one) without paying any fees and such troubles as 404 pages like i mentioned in the beginning of my post? (and this is my question). Maybe i should choose other hosting (if it exists in our world) or am i doing something wrong with heroku?
You forgot to push your quotes_controller.rb to git and heroku probably.
git add controllers/quotes_controller.rb
it seems you forgot models also, and probably lot of files.