Installation/Ninefold

From diaspora* project wiki
Jump to: navigation, search

You can create an account for Ninefold, an easy-to-deploy Rails hosting service here.

First deploy

Step 1: Fork Diaspora and clone your fork to your local machine. It will take a few minutes.

Step 2: Navigate to your new folder and open it with the editor of your choice.

Step 3: Diaspora currently runs on ruby version 2.0.0-p451. You want to make sure .ruby-version file is set to 2.0.0-p451. Using a ruby version manager, like RVM, or RBENV you can be sure your local version is set to the right version of Ruby. Check the Github repo to be certain which Ruby version you should be running.

Step 4: You will need to switch the gemfile.lock to Postgres.

	$ DB=postgres bundle
	$ git add Gemfile.lock
	$ git commit -m "switch Gemfile.lock to pg exclusively"

Step 5: Make changes to diaspora.yml.example.

The creators of Diaspora have done a wonderful job documenting exactly what you need with their comments in the file. There are a lot of things that need your attention but here are the key ones for your initial deployment on Ninefold:

Server

 	server: ## Section
   	## The port on which the appserver should listen
   	port: 3000
   	## The environment in which the server should be started by default.
   	rails_environment: 'production'

Settings

 	## General settings
 	settings: ## Section
   	## The name of your pod displayed in various locations,
  	 	## including the header.
   	pod_name: "Ninefold"
   	## Set this to false to prevent people from signing up for your pod
   	## without an invitation. Note that this needs to be true even for
   	## the first registration (you).
       enable_registrations: true
       

SSL

Ninefold uses Ubuntu on the virtual machine your app is deployed to.

   	## Debian, Ubuntu, Archlinux, Gentoo (package ca-certificates)
   	certificate_authorities: '/etc/ssl/certs/ca-certificates.crt'

Redis

Ninefold sets the url of Redis in an environment variable `REDIS_URL`. Set the `redis` setting to this so that Diaspora processes background jobs.

       ## URL for a remote Redis (default=localhost)
       ## Don't forget to restrict IP access if you uncomment these!
      redis:ENV['REDIS_URL']

Note: Make sure you are putting in your sensitive variables, like s3, in this format ENV['S3_SECRET']. Open a separate text file and add your actual secret keys into it. These will come into play when you deploy on to Ninefold. Warning: don’t EVER keep this file in your git repo.

Foreman

Diaspora will give you a .foreman file that will conflict with Ninefold. Please find the .foreman file in your app (it will be one of the items in the root directory) and rename it to .foreman.example.

Step 6: Create a database.yml in the config directory.

Since Ninefold loves (and supports PostgreSQL), here is a recommended setup for your database.yml. You want to start by creating a copy of the Diaspora provided database.yml.example and uncommenting the Postgres line and commenting the MySQL line.

 #<<: *mysql
 <<: *postgres

Note: You technically don’t need a database.yml file to run in production with Ninefold but if you want to test locally (please do), you’ll need it.

Step 7: As we always suggest at Ninefold, give your Diaspora Pod a go by running

         $ RAILS_ENV=production rails s

If you see your pod on localhost, you are ready to deploy.

Step 8: Commit your changes back up to your forked repo. Let’s deploy to Ninefold!

Step 9: Follow the instructions on how to deploy an app on Ninefold. We recommend that you separate your DB on to a separate server so you can easily scale your pod. Remember that text file of your secret keys? Make sure to add those into your environmental variables in Step 4 (remember: keep those safe vs. ever adding to your repo).

Step 10: Also in Step 4, you will need to add a line in your “After Migrations’ window during deployment so Ninefold can read all of the wonderful configuration you made in your diaspora.yml.example.

	mv config/diaspora.yml.example config/diaspora.yml

Step 11: One tricky thing: your first deploy is going to fail. This is because you need to enable self signed SSL for your Diaspora pod. You do this by going into Ninefold app, click on the app, choosing Configuration, enable SSL and choose Use a self-signed certificate. Trigger a redeploy.

Wrap-up

Now you’re all set to customize your pod with whatever you’d like. Ninefold's Rails Support Engineers will be available via ticketing and chat should you need assistance.