I'm working with a legacy Rails app (Ruby 1.9.2 and Rails 3.2.8). The app only exists in production. There isn't a development environmnt or repo I can use to setup my dev environment. I'm on an OSX 10.13 machine and I've installed Ruby 2.1.0 and Rails 3.2.8 (farthest back I could go without installation errors). Now I'm having trouble getting the files into the proper place and starting the Rails server.
Does anyone have any tips or a step-by-step guide location for this type of situation?
In this situation, I'd connect to the server and pull down a copy of the code that's currently running as soon as possible. Create a new git repo and add all the code there so you've got it safely stored away on Github, etc.
You'll probably also want to make a copy of the production database and save it locally. If you import it to your local database, you'll have a copy of production data that you can use to get up and running probably a bit quicker. Just keep in mind that you'll want to make sure you don't email or charge customers from your local copy, so it would probably be good to sanitize emails and other information.
I would probably then try to setup an actual deployment process, either using something like Hatch, Heroku, or a tool like Capistrano to make sure you can deploy it safely to a separate server or something. That way you can verify that deployments work without affecting the production app.
At that point, you can try doing a deployment over the existing codebase or you may want to deploy to a new directory and point the webserver to the new directory on the same server.
So in general:
I might be forgetting some things, so anyone else with ideas, please jump in. 👍
This takes a few things I was thinking about and ties them all together nicely.
Would you recommend keeping the dev environment as similar as possble to the current production environment to avoid errors or would it be better to try and upgrade to newer versions of Rails, etc? I'm having trouble currently trying to keep everything locally in sync with the production versions (the production Ruby version doesn't work with my OSX version, etc).
First, keep it exactly the same. You want to make sure that every adjustment you make is going to be fine in production, so don't make any significant changes.
If it's minor versions of Ruby that are different, that's fine. They don't have to be perfectly the same. Gem versions matter a lot more.
Is this a scenario where a Vagrant or Docker development environment would be a good fit? So that I could run the same version of Linux and then keep the versions of everything exactly the same as they are in production initially?
I saw your Vagrant guide and thought that might be just what I need.
Yeah, Vagrant is probably what you'd want in this case. Docker is more for you to containerize your app so it could run anywhere, not necessarily for mimicking your existing production host.
You'd just want to install the same OS version as prodcution and the same packages in Vagrant.
Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.