I am creating a Rails app for work and until I can install the app on a "in house" server, I am deploying it to Heroku so that we can start using it now. However, I am going to want to be able to copy its database with all of its data over to the final production server when I ready. I am assuming this is somehow possible, but I don't know where to start. Is there a way you can copy a production database (Postgres) from Heroku and move it to a new server to be used there? How would one go about doing this with Rails?
Heroku provides all of this functionality via the PGBackups plugins. There you'll find everything you need to know about importing, exporting, etc...
Related
So, I am almost done with my website. I created it using ruby on rails on the Cloud9 IDE. Is there a way to publish it? To go on it, a user has to be signed on Cloud9 and then I need to run the code on the terminal...
rails server -b $IP -p $PORT
How would I be able to publish my website? I am very new to rails and I have no idea.
To publish your website you need to host it somewhere.
There are multiple ways to do this. For instance you can use Heroku. They provide PaaS (Platform as a service), which means they will handle the installation of the app for you and the maintenance of the virtual machine it resides (updates and whatnot).
Heroku also gives you a very nice admin view for the status of your app, online log display and some other goodies.
Another alternative would be Amazon Web Services, DigitalOcean or Linode (among many others!). They provide IaaS(Infrastructure as a Service). They only give you a virtual machine with your choice of operating system, you will have to manually publish your app and provide manual maintenance of the VM and pretty much anything including the database itself.
Using Heroku would be your best choice for the moment as they are very straightforward with the publishing part. Once you get the grip you can go to the other platforms for customization.
You will also need some deployment tools such as capistrano or mina.
If you're going to host your app in heroku, it's much easier to deploy. As simple as pushing your codes with git.
is it possible to deploy a rails project to a remote server using FileZilla ? the server is running nginx/1.4.6 (ubuntu)
if no what is the best way to deploy the project if there is already a running version !
To answer your question yes, the code needs to be up, so FTP should do the trick. You might need to restart nginx to pick up the changes, usually touching a restart.txt is enough, but that's particular to your setup.
Is this the best way? Possibly not!
Others suggested capistrano and that would be a good fit for a server you maintain, or go Heroku (or similar) service for a simpler setup.
Deploying a Rails app is a tough job. There is always the easy way (heroku) however shared servers don't deal well with rails. Theoretically you can but usually this shared servers have really outdated ruby and rails versions and are absolutely useless. And you can try to connect via ssh and try to update it but i doubt you will be able to do that. So... If you are a rails developer i can suggest.
1- For small apps run Heroku (easy and free) however cost grows like hell with the app's growth
2- If you're thinking about developing big apps get a dedicated server (you can get cheap ones for 5€/month) and configure it as u would for your computer except when you run rails you run it in production.
3- Trust me... i fought enough Rails and shared servers and i quit... I just gave up
I have Ruby (2) on Rails (4) app deployed on OpenShift Enterprise running a Postgres database. After initial deployment the app worked perfectly, information was persisted in the database, routing was working, all the tests were passing - everything was good.
Then I deployed some new changes with git push openshift master. When I went back to the app it was still running, but all the database content (including table structure) was gone.
The output from the push was clean. I didn't write any hooks, or have any funky cron jobs running. I could repeat the process, rebuilding the database, and watch it get blown away on every deployment. This problem was not occurring in my local instance.
tl;dr: Make sure you have a .openshift directory at your project's root, use this as an example: https://github.com/openshift/rails4-example
Here's what was going on.
When I created the Rails app I didn't know where I would end up deploying it. Consequently I didn't start with an OpenShift Rails skeleton app or by using rhc app create ruby-X.X.X -a railsX.
When I was told to deploy on open shift I just configured rhc and set up an openshift git remote.
This meant there was no .openshift directory in my project's root. Once I cloned https://github.com/openshift/rails4-example and moved that project's .openshift directory into my project root I was able to deploy without losing my database.
I am trying to change the html.erb files from my application, but when i upload the new version and i check with a browser it's still the old one, i tried different browsers/cleared cache.
Do I need to restart the app? if so, how do i do that?
You say you are "uploading the new version" which suggests that you're talking about a server run in production mode (e.g. not your local development environment). In that case, yes, you likely need to restart your application server. E.g. if you are running with Apache/Passenger, then restart Apache.
let's say that RoR development environment is set up and working
does the developer need shell access to develop the RoR application?
would ftp be good enough?
why? I don't want to give my future developers ssh access to my linux box. Or can I set up their file permission so they can read only their project directory?
UPDATE
the whole idea is to have below running on my VPS linux hosting
code repository
production environment
test environment
maybe development environment
for
few projects
that are looked after by different people
so I want the developers to be able to do their job and only be able to access their project files and maybe only I would be able do to deployment into production from test environment
As Tom mentioned, it makes life a lot easier on Rails developers if they have ssh access to the machine so they can migrate the database, run bundle install, check the logs, or just jump into console.
There are ways to segregate users though, through file/directory permissions, chroot, or but making your linux machine a bunch of virtual machines and giving them their own
You can take a look at how Heroku's client works for possible ideas, since Rails developers are able to deploy, migrate, check logs, and even get into the console without direct shell access. Deployment is all done via git hooks and then their client gives access to particular commands. This is not trivial to set up/get working, though.
Well it does not REQUIRE shell access, but it sure makes it easier.
Without it how can you migrate a db? You would have to manually create controllers, models, etc.
Short answer, you CAN develop without shell access, it is just awkward and more tedious.
This is a common situation - for instance, Network Solutions allows you to do the basic RoR install but only gives ssh access if you step up and pay extra for a VM hosting package. My suggestion is to create the app on a local machine, of course using shell commands, then FTP mirror the files up, then use mysqldump to export the local database. NSI allows you a database console whereby you can then import your database dump file. You will probably have to edit config/database.yml since the host database server is unlikely to be localhost. If the necessary gems aren't present, you will have to plead with your hosting customer service.