uxrkfa
Last Updated: February 25, 2016
·
1.556K
· ritchiey
Ded273307f6364ccaad18a8ab273309e

Extra Info for setting up Rails Apps on Ninefold

From my experience so far, Ninefold's PaaS for Rails is excellent and well worth considering as an alternative to Heroku or configuring your own VPS.

There were some issues that I couldn't find easy answers to in the docs though so I'm putting them here:

SSH

The web interface really just uses Chef to configure VPS's for you. You can ssh into the public IP of your server which you'll find when you "Show Details" on the Infrastructure tab. The username is "user" the password should have been emailed to you.

ssh user@your-server's-public-ip-address

Finding your Rails App

Once you've logged in via SSH, you'll find you have nothing in your home folder. Your Rails app lives at /var/www/apps/your-apps-name/current. This is a symlink to the release of your app that is currently being run.

Running Rails console

Nothing special here but remember to specify that the RAILS_ENV is production.

cd /var/www/apps/your-apps-name/current
RAILS_ENV=production bundle exec rails c

Restoring a Postgres Backup from Another System

Ninefold use Postgres and you can restore files generated by pg_dump on another system (eg Heroku) straight to it. The only trick was knowing that your production database name might not be what it says in the Ninefold web interface.

  1. Use scp to copy your Postgres backup from your local machine into your Ninefold home directory:

    scp my_backup.dump user@your-server's-public-ip-address:backup.dump

  2. Take a snapshot of your current database via the web interface. This is important because the next step will destroy it.

  3. Find out what your database name is by looking at /var/www/apps/your-apps-name/current/config/database.yml. Mine was just the name of my app minus the _production.

  4. Assuming you're happy to destroy all your current data, proceed to replace your current database with the uploaded one:

    pg_restore --verbose --clean --no-acl --no-owner -h localhost -U app -d your-database-name backup.dump

Say Thanks
Respond