Asset hosting on S3

From diaspora* project wiki
Revision as of 23:07, 30 August 2014 by Sournetwork (talk | contribs) (Minor fixes.)

Diaspora Comes With Support For Amazon S3 Built In.

You can use Amazon S3 (Simple Storage Service) To Host Many Parts Of Your Pod. This includes the static assets that are created using the assets:precompile rake task built into Diaspora, to do this Diaspora uses the asset-sync gem. You can also store user profile pictures on Amazon S3.

Storing Static Assets On Amazon S3.

Firstly, cd Into Your Diaspora Code Folder Using The Command Line. Then Run The Following Commands (For A NON Heroku Setup) Replacing 'xxxx' For The Piece Of Info From Your S3 Account:

export AWS_ACCESS_KEY_ID=xxxx   
export AWS_SECRET_ACCESS_KEY=xxxx
export FOG_DIRECTORY=xxxx 

Manually copying assets to Amazon S3.

First you need to copy your Assets folder to your S3 bucket. This can be done by copying the Assets folder from the source code to your Amazon S3 bucket. Then cd into your Diaspora folder and edit the config/diaspora.yml file to the preferences below:

   assets: ## Section
      ## Serve static assets via the appserver.
      ## This is highly discouraged for production use,
      ## let your reverse proxy/webserver do it by serving the files
      ## under public/ directly.
      serve: true

      ## Upload your assets to S3
      upload: false

      ## Specify an asset host. Ensure it does not have a trailing slash (/).
      host: https://[bucket].s3.amazonaws.com/

(Replace '[bucket]' with your Amazon S3 bucket)