I’m in serious need of some help. I have an application running on Heroku on Ruby 2.3.8 and Rails 3.2. The stack on Heroku is no longer supported and needs major updating (my own fault for putting it off for so long). I can no longer push updates to my app until it is upgraded. Upgrading would take a long long time. I’ve already started trying to get Rails 4.0 running after many hours am still struggling. My app has users and I’m afraid something is going to break and I wont be able to do anything about it. I’ve also looked at starting a fresh new app on the latest Rails version and trying to port my code but my Mac is old as well causing more issues. Any advice?
Is your source code on github? How’s the test coverage on the app? I can upgrade it for you, email me off-list – firstname.lastname@example.org. – H
I just read a discussion on a similar if not same situation, probably on Stackoverflow.
Standard advice is to do a major Rails upgrade at a time. Upgrading Ruby on Rails — Ruby on Rails Guides, but many said start over.
I’ve upgraded and it’s painful. You’ve probably got many approaches and gems that are totally different today and don’t work together in the same way. In other words your going to deal with an issue in one upgrade and have it figured out and then in the next upgrade it’s going to have changed.
In your case it’s probably worth starting over. Figure out what is new that you may or may not want.
My inexpert advice. Start over and copy in pieces at a time. But if you’re using an existing database which no doubt you will, you may have to generate those scaffolds at the beginning.
Rereading your question, dealing with an out of date Mac and out of date software may be too much. You don’t say how old your Mac is, but macOS no longer keeps Ruby up to date. chruby seems like the easiest way to deal with this. Get a new Mac or find a good used one that uses latest OS. From what you said this seems essential. Have you tried a new app on your existing Mac? If it works you may be fine.
Another significant change. As the article says this happened in Rails 5.2, so it’s well covered in discussions and blogs. Again a reason to start over, you won’t have any of the less secure stuff hanging around.
Does it mean you cannot run it anymore or just that it’s not recommended? You could still run it on your own server (I am just finishing a book to help you do that) and with Rails LTS service you could still run a little longer even when security updates are considered (I am not affiliated).
Of course those steps are only to give you a little bit more time and you need to upgrade eventually. As it was already mentioned the guide is the best starting point. We don’t know your application/gems so there can hardly be said any more than that. Go version by version, don’t try to upgrade to 6.2 at once.
Well, I’d say that this is sort of a Herculean task to update from Rails 3.2 to 6.x (7.x is coming). Doable, but a lot of effort.
I was in a similar situation (lucky that it was just Rails 5 → Rails 6). I’m an experienced developer (25+ years), but I had zero Rails experience a year ago, and I was afraid to do it by myself (who wants to introduce security holes). We’ve decided to pay an agency do to this for us. Code base was migrated, gems replaced, Rails 6, Ruby 3, Stimulus, etc. I took this as an opportunity to learn Rails from way more experienced people, and I’m maintaining it & keeping it up-to-date on my own now.
I’d a) pay someone to do it for you, b) start from scratch (re-use DB, models, copy & paste piece by piece).
Your question, problem, is too broad, and you should not expect a silver bullet answer. It’s better to ask specific questions like - what this new configuration option means, is there a replacement for gem XYZ because XYZ supports just Rails 4, etc.
I know I’m too late to help the questioner, but thought I would contribute my experience upgrading a Rails 2.3 app to Rails 6.1.
With no test coverage no Rails shop would take on the task, and it would have been more than my client could have afforded anyway. I had already done an upgrade from Rails 2 to Rails 3; that is by far the largest major version upgrade with the most code changes compared to 3 to 4, 4 to 5, or 5 to 6. I couldn’t see doing that again but still being three major versions behind.
So I did the “great leap” approach, starting with a clean 6.1 project and empty git and bringing over sections of code one at a time, models first, then routes, then controllers, and finally views. There were few gems and the code was fairly small, with 18 models. While I did not rewrite code when not necessary, I did some reorganizing, mainly reducing the size of controllers by moving code to models or services.
It took somewhere between 150 and 200 hours to bring the upgrade project to the point where only an occasional bug was found (I didn’t track my time well because I charged a fixed price and didn’t want to know if I greatly underbid!).
As a semi-retired Rails developer who last started a blue sky project in Rails 4 there were a few more recent features to learn, but my familiarity with Rails made doing the upgrade feasible; I can’t imagine learning Rails while doing such a project.
I hope that’s helpful to others who might tackle a similar project.
I agree with @sandiegoscott with the approach. Don’t go through each version, you would lose time and effort unnecessarily.
Did you manage to complete the upgrade?
If Heroku is becoming a blocker, you can build a Docker image with an old LTS of Ubuntu. and get everything bake in.
I deploy my docker on beanstalk using a script I made to make it fast and easy.