Michael Aaronson MD
Phone: 402-343-8650
Step by Step: Setup Your Own Diaspora Pod Using
Wubi (the Ubuntu Installer for Windows): Directions for Dummies.
Experience Social Networking at its Best Using the Facebook/Twitter
Alternative.

January 28, 2012
Close
Related Posts
“And if you are so clever, then why are you on your own tonight?” — Morrissey. Please follow the instructions as written.
Follow these shiny, happy directions to set up your own Diaspora* Pod on Windows 7 using Wubi (the ubuntu linux on windows installer). As of January 2012, ubuntu 11.10 gets installed. Are you nervous about trying this? Don’t worry. Be happy. Feel good that with the help of your Friendly Neighborhood Kidney Doctor (Dr. Aaronson), you can GIT-R-DONE when before you could not.
In sum: you will create a Diaspora* pod. After you have created your pod you will create a user. Then you will connect to the other users on the Diaspora network. You are good to go.
Please note: www.michaelaaronsonmd.com or .net takes no responsibility with respect to your attempting this offering; however, although “everyone lies, nobody minds,” you, my friend, can trust me. At the end of the day, this approach is totally reversible by uninstalling wubi on windows, if you wish to go back to the dark side. May the force be with you….
Your total cost for this experiment? Around 10 bucks (U.S. dollars). Here we go (said in an Italian accent as a tribute to Morrissey):
Suggestions:
- I have highlighted text you should cut and paste instead of typing yourself. This will help you avoid typographical errors — it’s harder to skip a step. The highlights will facilitate your success.
- Please note: I encourage you to change
the passwords I’ve supplied below to anything you wish. Consider using a strong password. That said, you might want to keep as many of my “provided” options as possible, so you do not get confused. - the most current directions to setup (both installing and running) a Diaspora pod can be found here. Please note that there is much more to the story. My approach takes all the extra stuff (nginx, mysql) into account.
- There are other options to purchase a domain name beside godaddy.com. Decide which company you are going to go with before you begin.
on windows 7, in internet explorer, type the following web address to get to the ubuntu
wubi, windows installer:
wubi.exe by selecting the run option with the mouse.
to look like mine. Please note if you want to store lots of photos or maintain a community pod increase the installation size.
- user name: ubuntu
- password: morrissey
-select Reboot now and then
select finish.
-when rebooting, remember to boot into Ubuntu Linux.
"Darling it's all for you" --Morrissey-I don’t have a screenshot of this, so focus when performing this
next step. When signing into Ubuntu Linux, select “other” and enter
the
username and password you chose as above.
this is a primer for dummies.
screen is the dash.
-select dash home.
pressing the option at the top of the screen.
authenticate. Type the password you use to connect to the internet.
To connect to my wireless network i use the same password as the
password to logon to the user id ubuntu: morrissey
and type: sudo apt-get update
and then press enter
morrissey
apt-get upgrade
want to continue [Y/n]? type y
and press enter.-at this point I would restart the computer. Go to the upper right hand corner of the screen. Select the shut down button and then choose to restart….
"Love's young dream" -- Morrissey
-after you have logged on to your ubuntu account, open firefox by selecting the icon on the left hand side of the screen:
address. type: what
is my ip and write that number down on a piece of paper for later.
- next you need to find out the private ip address of the computer which is housing your diaspora pod. in ubuntu linux, this is easy. Right click on the communications icon at the top of the screen:
-and select Connection information. Just under IPv4 you will notice the IP Address of the computer. In this case my computer’s private IP Address is 192.168.2.9. You will need this information in a few steps to configure your virtual server.
-In firefox type: 192.168.2.1 to get access to your router. if that doesn’t work try typing 192.168.1.1. If that doesn’t work, please consult your router user manual for the number.
-in the firewall, virtual server section, configure the ports so that you can complete the circuit to allow your Diaspora* pod to connect to the world. please note: if required, consult the user manual to help you find what you are looking for.
-you will enable 2 ports that we will call diaspora and diaspora 2. inbound port 80 and 443 will be opened, of type TCP and UDP (therefore select BOTH), at private IP address 192.168.2.9 (from above), at private port 80 and 443. capiche?
-the next step is to acquire a domain name. did you read the prerequisites recommended above? go to http://www.godaddy.com/ and create an account where it says “Create Account.” Write down your user name and password so you don’t forget. at the end of the day you will have many usernames and passwords so accurate accounting of information will save you tons of time.
-Search for you desired domain name. for example, the first time i did this, i typed michaelaaronsonmd in the search box to see what was available. the .net domain was available so i chose that one for the diaspora pod because www.michaelaaronsonmd.com was already taken (by me) for the medical kidney blog i write.
-important but confusing naming conventions: even though the domain name I purchased was michaelaaronsonmd.net, please note that the name of the pod is diaspora.michaelaaronsonmd.net. This becomes important later when we configure the secure digital certificate from StartSSL to allow our pod to connect to the other Diaspora pods through https://.
-The “diaspora” part of the address is called the subdomain of the domain “michaelaaronsonmd.net.” Because the pod name is based on the use of “diaspora.michaelaaronsonmd.net” we will use diaspora.michaelaaronsonmd.net as the web address for the secure certificates as you will see.
-therefore, throughout this document, when you see michaelaaronsonmd.net, please replace with your domain name, that is the one you are about to purchase, and when you see diaspora.michaelaaronsonmd.net, please keep the diaspora part and just replace the michaelaaronsonmd.net part.
-an aside, your user name ubuntu that we used above to get into ubuntu linux will be used later as well. please make sure you mostly understand this nomeclature before moving on and actually spending the 10 bucks.
-for our purposes i will buy michaelaaronsonmd.net (already done) and show you how to set that one up, so that we can get to the next step.
-next we will manage our account. select “my account.”
-under my domains select “michaelaaronsonmd.net.” remember that the domain you purchased will be there instead of mine.
-select the “new dns manager.”
-select “edit zone.”
-point the A host to the public ip you wrote down from before (167.250.96.214) and add a cname called diaspora.
-use the force to make these changes. “Well it’s
here right under your nose and you just can’t see it can you?” —
Morrissey from Roy’s Keen (couldn’t resist
. “quick add” helps with adding the cname diaspora.
“To Me You Are a Work of Art” — Morrissey.
-next we are going to obtain secure “keys” from StartSSL (ones that have the suffix .crt and .key) that will be required during the Diaspora install process. Go to https://www.startssl.com/ and look for the free server certificate offer. You want to find the following page:
-click where it says: “…No Kidding 100% Free.” Using Mozilla Firefox as your internet browser. You will then be given some options. Choose the express lane and sign up as shown:
-Remember to use Firefox to register!!!!!!!! This process installs a special certificate in your browser that allows you to administer your account when you are on their site.
-follow the directions. tell the truth. verify your email address…. since i already did this before, i don’t remember step by step what happens. the key point is to be honest and allow them to place a certificate in your browser for administrative purposes.
-you may be given the opportunity to “validate” who you are. feel free. or consider going to the “authentication page” (find it; it is right under your nose) and continue with the tutorial.
-select authenticate to be presented with a “user identification request.” select ok.
-you see the administration panel of startssl. now is your opportunity to validate your email and your domain name prior to receiving your free certificate.
-select “Validations Wizard.”
-notice that you choose what type of validation you want to do. email address validation is one option. do it if you haven’t yet done so. click on the down arrow to validate your domain (see figures below).
-validate your domain name: type michaelaaronsonmd and remember to use the correct ending (you have to select the .net part). also remember to replace your domain name with the one you purchased. also note that there is no www here. no worries. it will work.
-you will be asked to select the verification email. if you told the truth as you should have (Dr. Aaronson believes in honesty and integrity), there will be an available option. Select that option and press continue.
-a verification code will be sent to your email address. validate by typing in the verification code and selecting continue.
-if you did everything right, you will be shown the validation success page.
-now let’s create some certificates. click on “certificates wizard.”
-select set up a “Web Server SSL/TLS Certificate” from the Certificate Target drop down menu.
-next you are going to generate a private key. Time to create another strong password. The password should be between 10 and 32 characters — only letters and numbers are allowed.
-Press “OK.”
-congratulations! you have generated a private key. select all of the text and copy it.
-you will paste the text into a file on the desktop called ssl.key by doing the following:
-open a terminal window: select the dash and type term and select “terminal.”
-in a terminal window: type cd /home/ubuntu/Desktop/ and press enter.
-next type gedit ssl.key and press enter.
-paste the text of the contents of certificate into the word processor. press save and then save the file as ssl.key. next close gedit (the word processor) by pressing the x button (upper left hand corner) to close the window.
-next we will create the ssl.crt file. add the domain you purchased from godaddy to the certificate as shown:
-add one subdomain to the certificate which we will call diaspora. you will recall from earlier in the tutorial that this was “gonna happen someday to you.”
-copy the contents of the text box into a new file using gedit called ssl.crt as you just did for ssl.key. We will call this one ssl.crt and save it to the desktop.
-type gedit ssl.crt and press enter.
-paste the text of the contents of certificate into the word processor. press save and then save the file as ssl.crt. next close gedit (the word processor) by pressing the x button (upper left hand corner) to close the window.
-close out of everything and move to the next step!
"Let me kiss you" -- Morrissey.
-now we move on to installing and running Diaspora (modified from here).
-open a terminal window and type the following:
-and then press enter. enter you password: morrissey
-when asked to continue type y and press enter.
-during the install, you will be asked if you want to create a password for MySQL (even though it is not mandatory). please create a new password for the MySQL "root user": *************
-add this password to your list of passwords on that sheet of paper.
-press the tab key and then press ok. re-enter the password: ************* then press tab and ok. let the install continue.
-next at the prompt type:
-when asked, enter your password and press enter.
-next install curl by typing:
-if asked give your password.
-next type: bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) and press enter.
-next type: echo "[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && source \"$HOME/.rvm/scripts/rvm\" # This loads RVM into a shell session." >> ~/.bashrc and press enter.
-next type: bash and press enter
-next type: rvm install ree and press enter.
-next type: rvm use ree@global and press enter.
-next type: sudo service mysql start and press enter.
-next type: sudo gem install bundler --no-ri --no-rdoc and press enter.
-next type: sudo ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle and press enter.
-next type: git clone git://github.com/diaspora/diaspora.git and press enter.
-next type: cd diaspora and press enter.
-say y if asked to trust the .rvmrc file.
-How do you know if you were successful? You will get a green success line that says: "Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed."
-Now it's time to copy my setup files to your system remembering to change my domain name to yours.
-open the home folder on the left side of the screen by clicking on it with the mouse.
-double click home, diaspora, public to get to that folder. next, drag the ssl.key and the ssl.crt from the desktop to the public folder.
-next we have to do the following in a terminal: type cd /home/ubuntu/diaspora/public and press enter
-then type:
-and press enter.
-Then type:
-and press enter.
-next, open a terminal and type: cd /home/ubuntu/diaspora/config and press enter.
-type gedit script_server.yml
-copy the following script to the word processor and save it as script_server.yml
script_server: # Choose database. Currently supported: mysql, postgres
db: "mysql"
# Enable thin as application server
enable_thin: true
# Port on which thin should listen
thin_port: 3000
# Customize thin's startup
default_thin_args: "-p $THIN_PORT -e $RAILS_ENV"
# Possibilities are development, production
rails_env: "production"
-next type gedit database.yml
-copy the following script to the word processor and save it as database.yml. Don't forget to insert the password that you gave to mysql earlier in this tutorial.
mysql: &mysql
adapter: mysql2
host: "localhost"
port: 3306
username: "root"
password: "***********************"
# socket: /tmp/mysql.sock
charset: utf8
collation: utf8_bin
postgres: &postgres
adapter: postgresql
host: localhost
port: 5432
username: postgres
password:
encoding: unicode
common: &common
# Choose one of the following
<<: *mysql
#<<: *postgres
development:
<<: *common
database: diaspora_development
production:
<<: *common
database: diaspora_production
test:
<<: *common
database: "diaspora_test<%= ENV['TEST_ENV_NUMBER'] %>"
-type gedit application.yml
-copy the following script to the word processor and save it as application.yml
-please don't forget: where it says pod_url:"https://diaspora.michaelaaronsonmd.net" you are going to replace the michaelaaronsonmd.net with your domain name. Keep the diaspora part in there.
-also please remember to give administrative privileges to only those worthy. On my system only the user "doctor" (which we will create later) has admin privileges.
#
Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed
under the Affero General Public License version 3 or
later. See
# the
COPYRIGHT file.
defaults: &defaults
#
# Environment
#
# Hostname of the
machine you're running Diaspora on, as seen from the internet.
# This should be
the URL you want to use to access the pod. So if you plan to
# reverse proxy
it, it should be the URL the proxy listens on.
# DO NOT CHNANGE
THIS AFTER INITIAL SETUP UNLESS YOU KNOW WHAT YOU'RE DOING!
# However changing
http to https is okay and has no consquences. If you do change
it
# you have to
start over as it's hardcoded into the database.
# For development
and testing, you can leave this as is.
pod_url:
"https://diaspora.michaelaaronsonmd.net"
# Websocket host -
leave as 0.0.0.0 unless you know what you are doing
socket_host:
0.0.0.0
# Websocket port -
should normally be 8080 or 8081.
socket_port: 8080
# Setting the root
certificate bundle (this is operating system specific).
Examples, uncomment one:
#ca_file:
'/etc/pki/tls/certs/ca-bundle.crt' # CentOS
ca_file:
'/etc/ssl/certs/ca-certificates.crt' # Debian
#ca_file:
'/etc/ssl/certs/ca-certificates.crt' # Gentoo
# Secure websocket
confguration (wss://).
# Requires SSL
cert and key
socket_secure:
false
socket_cert_chain_location:
'/home/ubuntu/diaspora/public/ssl.crt'
socket_private_key_location:
'/home/ubuntu/diaspora/public/ssl.key'
# URL for a remote
redis, on the default port. Don't forget to restrict IP access!
# leave it empty
for the default (localhost)
redis_url: ''
# Amazon S3 for
photos
# s3 config - if
set, carrierwave will store your photos on s3. Otherwise they're
on the filesystem.
#s3_key: 'key'
#s3_secret:
'secret'
#s3_bucket:
'my_photos'
s3_region:
'us-east-1'
#
# Settings
#
# Set this to true
to prevent people from signing up for your pod without an
invitation.
registrations_closed: true
# Set this to true
if you want users to invite as many people as they want
open_invitations:
true
# Set this to true
if you don't want your users to follow the
diasporahq@joindiaspora.com
# account on
account creation. The diasporahq account helps users start
with some
# activity in
their stream and get news about Diaspora, but if you don't want
your server
# to contact
joindiaspora.com, set this to true:
no_follow_diasporahq: false
# Community
Spotlight
# (expressed as an
array of Diaspora IDs)
community_spotlight:
-
'diasporahq@joindiaspora.com'
# Email to send
spotlight suggestions to
spotlight_suggest_email: ''
# List of users
who have admin privileges
# (expressed as an
array of local usernames)
admins:
-
'doctor'
# Mount resque-web
into routes
# This allows an
administrator to see info about the workers
mount_resque_web:
true
# Logging setup
# Enable extensive
logging to log/{development,test,production}.log
debug: false
# Enable extensive
logging to websocket server.
socket_debug :
false
# Hoptoad api key,
send failures to Hoptoad
hoptoad_api_key:
''
# Miscellaneous
# If set to true
Diaspora will work with just the appserver, thin by default,
# running, however
this makes it quite slow as all the time intensive jobs
# must be run
inside the request cycle. Also the live updates from the
Websocket
# will be
disabled.
single_process_mode: false
# File containing
pid of running script/websocket_server.rb
socket_pidfile:
"log/diaspora-wsd.pid"
# Do not touch
unless you know what you're doing
socket_collection_name: 'websocket'
# Diaspora is only
tested against this default pubsub server. You probably don't
want to change this.
pubsub_server:
'https://pubsubhubbub.appspot.com/'
# Email
# Setting this to
true enables Diaspora's "send email" functionality,
# requiring
meaningful smtp_* settings. These are options for RoR's
# ActionMailer
class.
mailer_on: false
# Address/port to
smtp server handling outgoing mail.
smtp_address:
'smtp.example.com'
smtp_port: '587'
# This chooses
which mailer should be used. 'smtp' for a smtp
# connection or
'sendmail' to use the sendmail binary, or messagebus, to use the
messagebus service
mailer_method:
'smtp'
#API key if you
are using message bus
message_bus_api_key: ''
# The path to the
sendmail binary. Ignored if mailer_method is not set to sendmail
sendmail_location:
'/usr/sbin/sendmail'
# Set this to true
if you want to use exim and sendmail
sendmail_exim_fix:
false
# Authentication
required to send mail. Use one of 'one', 'plain',
# 'login' or
'cram-md5'. Use 'none' if server does not support
# authentication
smtp_authentication: 'plain'
# Automatically
enable TLS? Ignored if smtp_authentication is set to none
smtp_starttls_auto: true
# OpenSSL verify
mode used when connecting to a SMTP server with TLS.
# Set this to none
if you have a self signed certificate, keep it empty (not '')
for the default
# Possible values:
none, peer, client_once, fail_if_no_peer_cert
smtp_openssl_verify_mode:
# Domain of smtp
server.
# This should
match the common name of the certificate
# the SMTP server
sends. If he sends one
smtp_domain:
'example.com'
# Credentials to
log in to the SMTP server - may be necessary if
#
smtp_authentication is not 'none'
smtp_username:
'smtp_username'
smtp_password:
'secret'
# Sender address
in Diaspora's outgoing mail.
smtp_sender_address: 'no-reply@joindiaspora.com'
# Redis cache
# Enable the cache
layer (Redis)
# If you expect to
have thousands of users on your pod,
# we *highly*
suggest you enable this.
# IMPORTANT: THE
CACHE REQUIRES REDIS 2.4 OR LATER.
#
# By default, the
cache layer will piggyback off of the Redis
# database used by
your Resque workers.
redis_cache: false
# The location of
your redis cache.
# IMPORTANT: DO
NOT CHANGE THIS IF YOU DO NOT KNOW WHAT YOU ARE DOING!
#
# Leave this blank
to use the same Redis database
# that your Resque
workers use (happy path).
#
# This takes an ip
(or DNS record). It assumes that your Redis database
# is running on
the default Redis port.
redis_location: ''
# Web tracking
# google analytics
key - if false, no javascript included
google_a_site:
false
# piwik
integration - if not set, no javascript included
piwik_id:
# the site url in
raw format (e.g. pikwik.examplehost.com)
piwik_url:
# Backups
backup_retention_days: 3
# cloudfiles
username and api-key - used for backups
cloudfiles_username: 'example'
cloudfiles_api_key: 'abc123'
cloudfiles_db_container: 'Database Backup'
cloudfiles_images_container: 'Image Backup'
# Donations
# Leave this blank
to not show the request for donations
# Use paypal for
recurring donations
paypal_hosted_button_id: ""
#
# Use this section to
override default settings in specific environments
#
development:
<<:
*defaults
production:
<<:
*defaults
#
# Do not touch unless you
know what you're doing
#
test:
<<:
*defaults
pod_url:
"http://localhost:9887"
socket_port: 8081
open_invitations:
true
integration_1:
<<:
*defaults
pod_url:
"http://localhost:45789"
integration_2:
<<:
*defaults
pod_url:
"http://localhost:34658"
-next at the terminal type: cd /home/ubuntu/diaspora/chef/cookbooks/diaspora/templates/default/
-then type gedit nginx.conf.erb
-delete what is there (or create a backup of the file) and then copy the following script to the word processor and save it as nginx.conf.erb
-please remember to replace michaelaaronsonmd.net with your domain name. keep the diaspora in there if it is there.
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
worker_processes 1;
daemon off;
events {
worker_connections 8192;
}
http {
include mime.types;
default_type application/octet-stream;
log_format splunky '$msec code=$status url=$uri bytes=$body_bytes_sent ms=$request_time';
access_log /usr/local/nginx/logs/access.log splunky;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable
"MSIE [1-6]\.(?!.*SV1)";
upstream thin_cluster
{
<% @ports.each do |port| %>
server <%="localhost:3000"%>;
<% end %>
}
server {
listen 843;
location / {
rewrite ^(.*)$ /crossdomain.xml;
}
error_page 400 /crossdomain.xml;
location = /crossdomain.xml {
root html;
}
}
server {
listen 80;
server_name diaspora.michaelaaronsonmd.net/ www.diaspora.michaelaaronsonmd.net/;
rewrite ^(.*) https://diaspora.michaelaaronsonmd.net$1 permanent;
}
server {
listen 443;
server_name diaspora.michaelaaronsonmd.net/ www.diaspora.michaelaaronsonmd.net/;
root /home/ubuntu/diaspora/public;
ssl on;
ssl_certificate <%= /home/ubuntu/diaspora/public/ssl.crt %>;
ssl_certificate_key <%= /home/ubuntu/diaspora/public/ssl.key %>;
location /assets {
expires 1d;
add_header Cache-Control public;
}
location /uploads/images {
expires 5d;
add_header Cache-Control public;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
client_max_body_size 4M;
client_body_buffer_size 128K;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://thin_cluster;
break;
}
<% unless @s3_bucket.blank? || @s3_path.blank? %>
<%= "rewrite ^/uploads/images/(.*)$ #{@s3_bucket}#{@s3_path}$1 permanent;" %>
<% end %>
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
-next we are going to install nginx: type sudo apt-get install nginx and press enter.
-when asked to continue type y.
-next at the terminal type: sudo su and press enter. give your password if required.
-type: cd /etc/nginx
-then type: gedit nginx.conf and press enter. replace the text that is there with the following:
-please note: the user is the user from above. the worker_processes is the number of processors your computer has. you can switch this if you wish.
user ubuntu;worker_processes 4;error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
upstream thin_server {
server 127.0.0.1:3000;
}
upstream resque_web {
server 127.0.0.1:5678;
}
include /etc/nginx/conf.d/*.conf;
}
-save the file and close.
-next type: cd /etc/nginx/sites-enabled/ and press enter.
-type: gedit default and replace the text that is there with the following. per usual, replace my web domain with yours.
# You may add here your
# server {
# ...
# }
server {
listen 80;
server_name www.domain1.com;
rewrite ^/(.*) http://domain1.com/$1 permanent;
}
server {
listen 80;
server_name diaspora.michaelaaronsonmd.net;
access_log /home/ubuntu/diaspora/public/log/access.log;
error_log /home/ubuntu/diaspora/public//log/error.log;
location / {
root /home/ubuntu/diaspora/public/;
index index.html;
}
}
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex off;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/www;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using
mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# root html;
# index index.html index.htm;
#
# location / {
# try_files $uri $uri/ /index.html;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
#
# root html;
# index index.html index.htm;
#
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
#
# ssl_session_timeout 5m;
#
# ssl_protocols SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
# ssl_prefer_server_ciphers on;
#
# location / {
# try_files $uri $uri/ /index.html;
# }
#}
-getting sick of typing? take a break and consider Dr. Aaronson's solution to the health care crisis in America -- you know, some light reading. or consider pressing on...
-type: cd /etc/nginx/sites-available/
-then type: gedit default and replace the text that is there with this text. don't forget to replace the domain names (won't mention this again).
-next type: cd /etc/nginx/conf.d
-type: gedit default.conf and copy and paste the following into the word processing document.
server {listen 80;server_name diaspora.michaelaaronsonmd.net www.diaspora.michaelaaronsonmd.net;
rewrite ^(.*) https://diaspora.michaelaaronsonmd.net$1 permanent;
location / {
root /home/ubuntu/diaspora/public;
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /home/ubuntu/diaspora/public;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/ubuntu/diaspora/public;
}
}
-next type: cd /etc/nginx/conf.d
-then type: gedit ssl.conf and copy and paste the following into the word processing document.
server {listen 443;
server_name diaspora.michaelaaronsonmd.net www.diaspora.michaelaaronsonmd.net; ssl on;
ssl_certificate /home/ubuntu/diaspora/public/ssl.crt;
ssl_certificate_key /home/ubuntu/diaspora/public/ssl.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
client_max_body_size 4M;
client_body_buffer_size 128K;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://thin_server;
break;
}
root /home/ubuntu/diaspora/public;
index index.html index.htm;
}
}
-save the file and close. close this terminal instance.
-now open up a terminal and type: cd /home/ubuntu/diaspora
-the next step is to create the database. type: RAILS_ENV=production bundle exec rake db:create
-next you type: RAILS_ENV=production bundle exec rake db:migrate
-next type: ./script/server
-you will be given the hint to run: bundle exec jammit every time you upgrade the code to enhance performance. feel free to do that. it is up to you.
-if you see the following, you were successful. nice job!
-now follow these steps:
I'll always stay true to you" -- Morrissey
-in the mozilla firefox browser window type: localhost:3000 to see the following: DO NOT CREATE A USER AT THIS TIME. WE WILL DO THAT LATER!
-take a breath. you did it. only a few steps remain before creating a user and connecting to the other Diaspora* pods.
-also, before you go further, you may want to check out the official installing and running diaspora page for any last minute pointers.
-stop Diaspora for now by pressing CTRL+C (please press the ctrl key and the "C" key at the same time).
-key management:
-open a new terminal. type: cd /home/ubuntu/diaspora/public and press enter. at the prompt type what you see next. remember to enter the pass phrase for the ssl.key that you entered when you created the key back in the day using startssl.
-ubuntu@ubuntu:~/diaspora/public$ openssl rsa -in ssl.key -out ssl.key
Enter pass phrase for ssl.key: *********
writing RSA key
-then type: openssl req -new -key ssl.key -out ssl.csr and answer the questions honestly, writing down what you wrote.
-then type: sudo service nginx restart and enter your password if required.
-type: cd /home/ubuntu/diaspora
-start diaspora by typing: ./script/server
-in mozilla firefox type: localhost:3000 once diaspora has started. You know that diaspora* is listening because it says: "Listening on 0.0.0.0:3000, CTRL+C to stop."
-DO NOT SET UP A NEW USER -- yet.
-open up another tab in firefox and type: https://localhost and note the following:
-do you trust you? i do. select "i understand the risks."
-then add a permanent exception. remember, if you are afraid you should not be. a simple uninstall back in the windows 7 environment brings you to back to darth.
-next type your web address into a mozilla firefox tab. remember to use the https:// whoa! Inconceivable! Please note: diapers not included!
-select login in the upper right hand corner. Finally, you get to sign in! Whoo hoo!
-where do i sign up? well you have to allow a user to sign up by modifying your application.yml.
-in the terminal where diaspora is running select control+c to stop diaspora.
-type: cd /home/ubuntu/diaspora/config
-type gedit application.yml and change registrations from true to false (you can change it back after you have set yourself up). also allow yourself to become an administrator (change doctor to your user name). save the file and close.
-type: sudo service nginx restart
-change back to the diaspora directory: cd /home/ubuntu/diaspora/
-restart diaspora: ./script/server
-in a new tab type: https://michaelaaronsonmd.net (or your web address). you can see there is an opportunity to sign up!
-select sign up to be presented with the welcome screen:
Follow these shiny, happy directions to set up your own Diaspora* Pod on Windows 7 using Wubi (the ubuntu linux on windows installer). As of January 2012, ubuntu 11.10 gets installed. Are you nervous about trying this? Don’t worry. Be happy. Feel good that with the help of your Friendly Neighborhood Kidney Doctor (Dr. Aaronson), you can GIT-R-DONE when before you could not.
In sum: you will create a Diaspora* pod. After you have created your pod you will create a user. Then you will connect to the other users on the Diaspora network. You are good to go.
Please note: www.michaelaaronsonmd.com or .net takes no responsibility with respect to your attempting this offering; however, although “everyone lies, nobody minds,” you, my friend, can trust me. At the end of the day, this approach is totally reversible by uninstalling wubi on windows, if you wish to go back to the dark side. May the force be with you….
Your total cost for this experiment? Around 10 bucks (U.S. dollars). Here we go (said in an Italian accent as a tribute to Morrissey):
Suggestions:
- I have highlighted text you should cut and paste instead of typing yourself. This will help you avoid typographical errors — it’s harder to skip a step. The highlights will facilitate your success.
- Please note: I encourage you to change
the passwords I’ve supplied below to anything you wish. Consider using a strong password. That said, you might want to keep as many of my “provided” options as possible, so you do not get confused. - the most current directions to setup (both installing and running) a Diaspora pod can be found here. Please note that there is much more to the story. My approach takes all the extra stuff (nginx, mysql) into account.
- There are other options to purchase a domain name beside godaddy.com. Decide which company you are going to go with before you begin.
on windows 7, in internet explorer, type the following web address to get to the ubuntu
wubi, windows installer:
wubi.exe by selecting the run option with the mouse.
to look like mine. Please note if you want to store lots of photos or maintain a community pod increase the installation size.
- user name: ubuntu
- password: morrissey
-select Reboot now and then
select finish.
-when rebooting, remember to boot into Ubuntu Linux.
"Darling it's all for you" --Morrissey-I don’t have a screenshot of this, so focus when performing this
next step. When signing into Ubuntu Linux, select “other” and enter
the
username and password you chose as above.
this is a primer for dummies.
screen is the dash.
-select dash home.
pressing the option at the top of the screen.
authenticate. Type the password you use to connect to the internet.
To connect to my wireless network i use the same password as the
password to logon to the user id ubuntu: morrissey
and type: sudo apt-get update
and then press enter
morrissey
apt-get upgrade
want to continue [Y/n]? type y
and press enter.-at this point I would restart the computer. Go to the upper right hand corner of the screen. Select the shut down button and then choose to restart….
"Love's young dream" -- Morrissey
-after you have logged on to your ubuntu account, open firefox by selecting the icon on the left hand side of the screen:
address. type: what
is my ip and write that number down on a piece of paper for later.
- next you need to find out the private ip address of the computer which is housing your diaspora pod. in ubuntu linux, this is easy. Right click on the communications icon at the top of the screen:
-and select Connection information. Just under IPv4 you will notice the IP Address of the computer. In this case my computer’s private IP Address is 192.168.2.9. You will need this information in a few steps to configure your virtual server.
-In firefox type: 192.168.2.1 to get access to your router. if that doesn’t work try typing 192.168.1.1. If that doesn’t work, please consult your router user manual for the number.
-in the firewall, virtual server section, configure the ports so that you can complete the circuit to allow your Diaspora* pod to connect to the world. please note: if required, consult the user manual to help you find what you are looking for.
-you will enable 2 ports that we will call diaspora and diaspora 2. inbound port 80 and 443 will be opened, of type TCP and UDP (therefore select BOTH), at private IP address 192.168.2.9 (from above), at private port 80 and 443. capiche?
-the next step is to acquire a domain name. did you read the prerequisites recommended above? go to http://www.godaddy.com/ and create an account where it says “Create Account.” Write down your user name and password so you don’t forget. at the end of the day you will have many usernames and passwords so accurate accounting of information will save you tons of time.
-Search for you desired domain name. for example, the first time i did this, i typed michaelaaronsonmd in the search box to see what was available. the .net domain was available so i chose that one for the diaspora pod because www.michaelaaronsonmd.com was already taken (by me) for the medical kidney blog i write.
-important but confusing naming conventions: even though the domain name I purchased was michaelaaronsonmd.net, please note that the name of the pod is diaspora.michaelaaronsonmd.net. This becomes important later when we configure the secure digital certificate from StartSSL to allow our pod to connect to the other Diaspora pods through https://.
-The “diaspora” part of the address is called the subdomain of the domain “michaelaaronsonmd.net.” Because the pod name is based on the use of “diaspora.michaelaaronsonmd.net” we will use diaspora.michaelaaronsonmd.net as the web address for the secure certificates as you will see.
-therefore, throughout this document, when you see michaelaaronsonmd.net, please replace with your domain name, that is the one you are about to purchase, and when you see diaspora.michaelaaronsonmd.net, please keep the diaspora part and just replace the michaelaaronsonmd.net part.
-an aside, your user name ubuntu that we used above to get into ubuntu linux will be used later as well. please make sure you mostly understand this nomeclature before moving on and actually spending the 10 bucks.
-for our purposes i will buy michaelaaronsonmd.net (already done) and show you how to set that one up, so that we can get to the next step.
-next we will manage our account. select “my account.”
-under my domains select “michaelaaronsonmd.net.” remember that the domain you purchased will be there instead of mine.
-select the “new dns manager.”
-select “edit zone.”
-point the A host to the public ip you wrote down from before (167.250.96.214) and add a cname called diaspora.
-use the force to make these changes. “Well it’s
here right under your nose and you just can’t see it can you?” —
Morrissey from Roy’s Keen (couldn’t resist
. “quick add” helps with adding the cname diaspora.
“To Me You Are a Work of Art” — Morrissey.
-next we are going to obtain secure “keys” from StartSSL (ones that have the suffix .crt and .key) that will be required during the Diaspora install process. Go to https://www.startssl.com/ and look for the free server certificate offer. You want to find the following page:
-click where it says: “…No Kidding 100% Free.” Using Mozilla Firefox as your internet browser. You will then be given some options. Choose the express lane and sign up as shown:
-Remember to use Firefox to register!!!!!!!! This process installs a special certificate in your browser that allows you to administer your account when you are on their site.
-follow the directions. tell the truth. verify your email address…. since i already did this before, i don’t remember step by step what happens. the key point is to be honest and allow them to place a certificate in your browser for administrative purposes.
-you may be given the opportunity to “validate” who you are. feel free. or consider going to the “authentication page” (find it; it is right under your nose) and continue with the tutorial.
-select authenticate to be presented with a “user identification request.” select ok.
-you see the administration panel of startssl. now is your opportunity to validate your email and your domain name prior to receiving your free certificate.
-select “Validations Wizard.”
-notice that you choose what type of validation you want to do. email address validation is one option. do it if you haven’t yet done so. click on the down arrow to validate your domain (see figures below).
-validate your domain name: type michaelaaronsonmd and remember to use the correct ending (you have to select the .net part). also remember to replace your domain name with the one you purchased. also note that there is no www here. no worries. it will work.
-you will be asked to select the verification email. if you told the truth as you should have (Dr. Aaronson believes in honesty and integrity), there will be an available option. Select that option and press continue.
-a verification code will be sent to your email address. validate by typing in the verification code and selecting continue.
-if you did everything right, you will be shown the validation success page.
-now let’s create some certificates. click on “certificates wizard.”
-select set up a “Web Server SSL/TLS Certificate” from the Certificate Target drop down menu.
-next you are going to generate a private key. Time to create another strong password. The password should be between 10 and 32 characters — only letters and numbers are allowed.
-Press “OK.”
-congratulations! you have generated a private key. select all of the text and copy it.
-you will paste the text into a file on the desktop called ssl.key by doing the following:
-open a terminal window: select the dash and type term and select “terminal.”
-in a terminal window: type cd /home/ubuntu/Desktop/ and press enter.
-next type gedit ssl.key and press enter.
-paste the text of the contents of certificate into the word processor. press save and then save the file as ssl.key. next close gedit (the word processor) by pressing the x button (upper left hand corner) to close the window.
-next we will create the ssl.crt file. add the domain you purchased from godaddy to the certificate as shown:
-add one subdomain to the certificate which we will call diaspora. you will recall from earlier in the tutorial that this was “gonna happen someday to you.”
-copy the contents of the text box into a new file using gedit called ssl.crt as you just did for ssl.key. We will call this one ssl.crt and save it to the desktop.
-type gedit ssl.crt and press enter.
-paste the text of the contents of certificate into the word processor. press save and then save the file as ssl.crt. next close gedit (the word processor) by pressing the x button (upper left hand corner) to close the window.
-close out of everything and move to the next step!
"Let me kiss you" -- Morrissey.
-now we move on to installing and running Diaspora (modified from here).
-open a terminal window and type the following:
-and then press enter. enter you password: morrissey
-when asked to continue type y and press enter.
-during the install, you will be asked if you want to create a password for MySQL (even though it is not mandatory). please create a new password for the MySQL "root user": *************
-add this password to your list of passwords on that sheet of paper.
-press the tab key and then press ok. re-enter the password: ************* then press tab and ok. let the install continue.
-next at the prompt type:
-when asked, enter your password and press enter.
-next install curl by typing:
-if asked give your password.
-next type: bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) and press enter.
-next type: echo "[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && source \"$HOME/.rvm/scripts/rvm\" # This loads RVM into a shell session." >> ~/.bashrc and press enter.
-next type: bash and press enter
-next type: rvm install ree and press enter.
-next type: rvm use ree@global and press enter.
-next type: sudo service mysql start and press enter.
-next type: sudo gem install bundler --no-ri --no-rdoc and press enter.
-next type: sudo ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle and press enter.
-next type: git clone git://github.com/diaspora/diaspora.git and press enter.
-next type: cd diaspora and press enter.
-say y if asked to trust the .rvmrc file.
-How do you know if you were successful? You will get a green success line that says: "Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed."
-Now it's time to copy my setup files to your system remembering to change my domain name to yours.
-open the home folder on the left side of the screen by clicking on it with the mouse.
-double click home, diaspora, public to get to that folder. next, drag the ssl.key and the ssl.crt from the desktop to the public folder.
-next we have to do the following in a terminal: type cd /home/ubuntu/diaspora/public and press enter
-then type:
-and press enter.
-Then type:
-and press enter.
-next, open a terminal and type: cd /home/ubuntu/diaspora/config and press enter.
-type gedit script_server.yml
-copy the following script to the word processor and save it as script_server.yml
script_server: # Choose database. Currently supported: mysql, postgres
db: "mysql"
# Enable thin as application server
enable_thin: true
# Port on which thin should listen
thin_port: 3000
# Customize thin's startup
default_thin_args: "-p $THIN_PORT -e $RAILS_ENV"
# Possibilities are development, production
rails_env: "production"
-next type gedit database.yml
-copy the following script to the word processor and save it as database.yml. Don't forget to insert the password that you gave to mysql earlier in this tutorial.
mysql: &mysql
adapter: mysql2
host: "localhost"
port: 3306
username: "root"
password: "***********************"
# socket: /tmp/mysql.sock
charset: utf8
collation: utf8_bin
postgres: &postgres
adapter: postgresql
host: localhost
port: 5432
username: postgres
password:
encoding: unicode
common: &common
# Choose one of the following
<<: *mysql
#<<: *postgres
development:
<<: *common
database: diaspora_development
production:
<<: *common
database: diaspora_production
test:
<<: *common
database: "diaspora_test<%= ENV['TEST_ENV_NUMBER'] %>"
-type gedit application.yml
-copy the following script to the word processor and save it as application.yml
-please don't forget: where it says pod_url:"https://diaspora.michaelaaronsonmd.net" you are going to replace the michaelaaronsonmd.net with your domain name. Keep the diaspora part in there.
-also please remember to give administrative privileges to only those worthy. On my system only the user "doctor" (which we will create later) has admin privileges.
#
Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed
under the Affero General Public License version 3 or
later. See
# the
COPYRIGHT file.
defaults: &defaults
#
# Environment
#
# Hostname of the
machine you're running Diaspora on, as seen from the internet.
# This should be
the URL you want to use to access the pod. So if you plan to
# reverse proxy
it, it should be the URL the proxy listens on.
# DO NOT CHNANGE
THIS AFTER INITIAL SETUP UNLESS YOU KNOW WHAT YOU'RE DOING!
# However changing
http to https is okay and has no consquences. If you do change
it
# you have to
start over as it's hardcoded into the database.
# For development
and testing, you can leave this as is.
pod_url:
"https://diaspora.michaelaaronsonmd.net"
# Websocket host -
leave as 0.0.0.0 unless you know what you are doing
socket_host:
0.0.0.0
# Websocket port -
should normally be 8080 or 8081.
socket_port: 8080
# Setting the root
certificate bundle (this is operating system specific).
Examples, uncomment one:
#ca_file:
'/etc/pki/tls/certs/ca-bundle.crt' # CentOS
ca_file:
'/etc/ssl/certs/ca-certificates.crt' # Debian
#ca_file:
'/etc/ssl/certs/ca-certificates.crt' # Gentoo
# Secure websocket
confguration (wss://).
# Requires SSL
cert and key
socket_secure:
false
socket_cert_chain_location:
'/home/ubuntu/diaspora/public/ssl.crt'
socket_private_key_location:
'/home/ubuntu/diaspora/public/ssl.key'
# URL for a remote
redis, on the default port. Don't forget to restrict IP access!
# leave it empty
for the default (localhost)
redis_url: ''
# Amazon S3 for
photos
# s3 config - if
set, carrierwave will store your photos on s3. Otherwise they're
on the filesystem.
#s3_key: 'key'
#s3_secret:
'secret'
#s3_bucket:
'my_photos'
s3_region:
'us-east-1'
#
# Settings
#
# Set this to true
to prevent people from signing up for your pod without an
invitation.
registrations_closed: true
# Set this to true
if you want users to invite as many people as they want
open_invitations:
true
# Set this to true
if you don't want your users to follow the
diasporahq@joindiaspora.com
# account on
account creation. The diasporahq account helps users start
with some
# activity in
their stream and get news about Diaspora, but if you don't want
your server
# to contact
joindiaspora.com, set this to true:
no_follow_diasporahq: false
# Community
Spotlight
# (expressed as an
array of Diaspora IDs)
community_spotlight:
-
'diasporahq@joindiaspora.com'
# Email to send
spotlight suggestions to
spotlight_suggest_email: ''
# List of users
who have admin privileges
# (expressed as an
array of local usernames)
admins:
-
'doctor'
# Mount resque-web
into routes
# This allows an
administrator to see info about the workers
mount_resque_web:
true
# Logging setup
# Enable extensive
logging to log/{development,test,production}.log
debug: false
# Enable extensive
logging to websocket server.
socket_debug :
false
# Hoptoad api key,
send failures to Hoptoad
hoptoad_api_key:
''
# Miscellaneous
# If set to true
Diaspora will work with just the appserver, thin by default,
# running, however
this makes it quite slow as all the time intensive jobs
# must be run
inside the request cycle. Also the live updates from the
Websocket
# will be
disabled.
single_process_mode: false
# File containing
pid of running script/websocket_server.rb
socket_pidfile:
"log/diaspora-wsd.pid"
# Do not touch
unless you know what you're doing
socket_collection_name: 'websocket'
# Diaspora is only
tested against this default pubsub server. You probably don't
want to change this.
pubsub_server:
'https://pubsubhubbub.appspot.com/'
# Email
# Setting this to
true enables Diaspora's "send email" functionality,
# requiring
meaningful smtp_* settings. These are options for RoR's
# ActionMailer
class.
mailer_on: false
# Address/port to
smtp server handling outgoing mail.
smtp_address:
'smtp.example.com'
smtp_port: '587'
# This chooses
which mailer should be used. 'smtp' for a smtp
# connection or
'sendmail' to use the sendmail binary, or messagebus, to use the
messagebus service
mailer_method:
'smtp'
#API key if you
are using message bus
message_bus_api_key: ''
# The path to the
sendmail binary. Ignored if mailer_method is not set to sendmail
sendmail_location:
'/usr/sbin/sendmail'
# Set this to true
if you want to use exim and sendmail
sendmail_exim_fix:
false
# Authentication
required to send mail. Use one of 'one', 'plain',
# 'login' or
'cram-md5'. Use 'none' if server does not support
# authentication
smtp_authentication: 'plain'
# Automatically
enable TLS? Ignored if smtp_authentication is set to none
smtp_starttls_auto: true
# OpenSSL verify
mode used when connecting to a SMTP server with TLS.
# Set this to none
if you have a self signed certificate, keep it empty (not '')
for the default
# Possible values:
none, peer, client_once, fail_if_no_peer_cert
smtp_openssl_verify_mode:
# Domain of smtp
server.
# This should
match the common name of the certificate
# the SMTP server
sends. If he sends one
smtp_domain:
'example.com'
# Credentials to
log in to the SMTP server - may be necessary if
#
smtp_authentication is not 'none'
smtp_username:
'smtp_username'
smtp_password:
'secret'
# Sender address
in Diaspora's outgoing mail.
smtp_sender_address: 'no-reply@joindiaspora.com'
# Redis cache
# Enable the cache
layer (Redis)
# If you expect to
have thousands of users on your pod,
# we *highly*
suggest you enable this.
# IMPORTANT: THE
CACHE REQUIRES REDIS 2.4 OR LATER.
#
# By default, the
cache layer will piggyback off of the Redis
# database used by
your Resque workers.
redis_cache: false
# The location of
your redis cache.
# IMPORTANT: DO
NOT CHANGE THIS IF YOU DO NOT KNOW WHAT YOU ARE DOING!
#
# Leave this blank
to use the same Redis database
# that your Resque
workers use (happy path).
#
# This takes an ip
(or DNS record). It assumes that your Redis database
# is running on
the default Redis port.
redis_location: ''
# Web tracking
# google analytics
key - if false, no javascript included
google_a_site:
false
# piwik
integration - if not set, no javascript included
piwik_id:
# the site url in
raw format (e.g. pikwik.examplehost.com)
piwik_url:
# Backups
backup_retention_days: 3
# cloudfiles
username and api-key - used for backups
cloudfiles_username: 'example'
cloudfiles_api_key: 'abc123'
cloudfiles_db_container: 'Database Backup'
cloudfiles_images_container: 'Image Backup'
# Donations
# Leave this blank
to not show the request for donations
# Use paypal for
recurring donations
paypal_hosted_button_id: ""
#
# Use this section to
override default settings in specific environments
#
development:
<<:
*defaults
production:
<<:
*defaults
#
# Do not touch unless you
know what you're doing
#
test:
<<:
*defaults
pod_url:
"http://localhost:9887"
socket_port: 8081
open_invitations:
true
integration_1:
<<:
*defaults
pod_url:
"http://localhost:45789"
integration_2:
<<:
*defaults
pod_url:
"http://localhost:34658"
-next at the terminal type: cd /home/ubuntu/diaspora/chef/cookbooks/diaspora/templates/default/
-then type gedit nginx.conf.erb
-delete what is there (or create a backup of the file) and then copy the following script to the word processor and save it as nginx.conf.erb
-please remember to replace michaelaaronsonmd.net with your domain name. keep the diaspora in there if it is there.
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
worker_processes 1;
daemon off;
events {
worker_connections 8192;
}
http {
include mime.types;
default_type application/octet-stream;
log_format splunky '$msec code=$status url=$uri bytes=$body_bytes_sent ms=$request_time';
access_log /usr/local/nginx/logs/access.log splunky;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable
"MSIE [1-6]\.(?!.*SV1)";
upstream thin_cluster
{
<% @ports.each do |port| %>
server <%="localhost:3000"%>;
<% end %>
}
server {
listen 843;
location / {
rewrite ^(.*)$ /crossdomain.xml;
}
error_page 400 /crossdomain.xml;
location = /crossdomain.xml {
root html;
}
}
server {
listen 80;
server_name diaspora.michaelaaronsonmd.net/ www.diaspora.michaelaaronsonmd.net/;
rewrite ^(.*) https://diaspora.michaelaaronsonmd.net$1 permanent;
}
server {
listen 443;
server_name diaspora.michaelaaronsonmd.net/ www.diaspora.michaelaaronsonmd.net/;
root /home/ubuntu/diaspora/public;
ssl on;
ssl_certificate <%= /home/ubuntu/diaspora/public/ssl.crt %>;
ssl_certificate_key <%= /home/ubuntu/diaspora/public/ssl.key %>;
location /assets {
expires 1d;
add_header Cache-Control public;
}
location /uploads/images {
expires 5d;
add_header Cache-Control public;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
client_max_body_size 4M;
client_body_buffer_size 128K;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://thin_cluster;
break;
}
<% unless @s3_bucket.blank? || @s3_path.blank? %>
<%= "rewrite ^/uploads/images/(.*)$ #{@s3_bucket}#{@s3_path}$1 permanent;" %>
<% end %>
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
-next we are going to install nginx: type sudo apt-get install nginx and press enter.
-when asked to continue type y.
-next at the terminal type: sudo su and press enter. give your password if required.
-type: cd /etc/nginx
-then type: gedit nginx.conf and press enter. replace the text that is there with the following:
-please note: the user is the user from above. the worker_processes is the number of processors your computer has. you can switch this if you wish.
user ubuntu;worker_processes 4;error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
upstream thin_server {
server 127.0.0.1:3000;
}
upstream resque_web {
server 127.0.0.1:5678;
}
include /etc/nginx/conf.d/*.conf;
}
-save the file and close.
-next type: cd /etc/nginx/sites-enabled/ and press enter.
-type: gedit default and replace the text that is there with the following. per usual, replace my web domain with yours.
# You may add here your
# server {
# ...
# }
server {
listen 80;
server_name www.domain1.com;
rewrite ^/(.*) http://domain1.com/$1 permanent;
}
server {
listen 80;
server_name diaspora.michaelaaronsonmd.net;
access_log /home/ubuntu/diaspora/public/log/access.log;
error_log /home/ubuntu/diaspora/public//log/error.log;
location / {
root /home/ubuntu/diaspora/public/;
index index.html;
}
}
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex off;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/www;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using
mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# root html;
# index index.html index.htm;
#
# location / {
# try_files $uri $uri/ /index.html;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
#
# root html;
# index index.html index.htm;
#
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
#
# ssl_session_timeout 5m;
#
# ssl_protocols SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
# ssl_prefer_server_ciphers on;
#
# location / {
# try_files $uri $uri/ /index.html;
# }
#}
-getting sick of typing? take a break and consider Dr. Aaronson's solution to the health care crisis in America -- you know, some light reading. or consider pressing on...
-type: cd /etc/nginx/sites-available/
-then type: gedit default and replace the text that is there with this text. don't forget to replace the domain names (won't mention this again).
-next type: cd /etc/nginx/conf.d
-type: gedit default.conf and copy and paste the following into the word processing document.
server {listen 80;server_name diaspora.michaelaaronsonmd.net www.diaspora.michaelaaronsonmd.net;
rewrite ^(.*) https://diaspora.michaelaaronsonmd.net$1 permanent;
location / {
root /home/ubuntu/diaspora/public;
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /home/ubuntu/diaspora/public;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/ubuntu/diaspora/public;
}
}
-next type: cd /etc/nginx/conf.d
-then type: gedit ssl.conf and copy and paste the following into the word processing document.
server {listen 443;
server_name diaspora.michaelaaronsonmd.net www.diaspora.michaelaaronsonmd.net; ssl on;
ssl_certificate /home/ubuntu/diaspora/public/ssl.crt;
ssl_certificate_key /home/ubuntu/diaspora/public/ssl.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
client_max_body_size 4M;
client_body_buffer_size 128K;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://thin_server;
break;
}
root /home/ubuntu/diaspora/public;
index index.html index.htm;
}
}
-save the file and close. close this terminal instance.
-now open up a terminal and type: cd /home/ubuntu/diaspora
-the next step is to create the database. type: RAILS_ENV=production bundle exec rake db:create
-next you type: RAILS_ENV=production bundle exec rake db:migrate
-next type: ./script/server
-you will be given the hint to run: bundle exec jammit every time you upgrade the code to enhance performance. feel free to do that. it is up to you.
-if you see the following, you were successful. nice job!
-now follow these steps:
I'll always stay true to you" -- Morrissey
-in the mozilla firefox browser window type: localhost:3000 to see the following: DO NOT CREATE A USER AT THIS TIME. WE WILL DO THAT LATER!
-take a breath. you did it. only a few steps remain before creating a user and connecting to the other Diaspora* pods.
-also, before you go further, you may want to check out the official installing and running diaspora page for any last minute pointers.
-stop Diaspora for now by pressing CTRL+C (please press the ctrl key and the "C" key at the same time).
-key management:
-open a new terminal. type: cd /home/ubuntu/diaspora/public and press enter. at the prompt type what you see next. remember to enter the pass phrase for the ssl.key that you entered when you created the key back in the day using startssl.
-ubuntu@ubuntu:~/diaspora/public$ openssl rsa -in ssl.key -out ssl.key
Enter pass phrase for ssl.key: *********
writing RSA key
-then type: openssl req -new -key ssl.key -out ssl.csr and answer the questions honestly, writing down what you wrote.
-then type: sudo service nginx restart and enter your password if required.
-type: cd /home/ubuntu/diaspora
-start diaspora by typing: ./script/server
-in mozilla firefox type: localhost:3000 once diaspora has started. You know that diaspora* is listening because it says: "Listening on 0.0.0.0:3000, CTRL+C to stop."
-DO NOT SET UP A NEW USER -- yet.
-open up another tab in firefox and type: https://localhost and note the following:
-do you trust you? i do. select "i understand the risks."
-then add a permanent exception. remember, if you are afraid you should not be. a simple uninstall back in the windows 7 environment brings you to back to darth.
-next type your web address into a mozilla firefox tab. remember to use the https:// whoa! Inconceivable! Please note: diapers not included!
-select login in the upper right hand corner. Finally, you get to sign in! Whoo hoo!
-where do i sign up? well you have to allow a user to sign up by modifying your application.yml.
-in the terminal where diaspora is running select control+c to stop diaspora.
-type: cd /home/ubuntu/diaspora/config
-type gedit application.yml and change registrations from true to false (you can change it back after you have set yourself up). also allow yourself to become an administrator (change doctor to your user name). save the file and close.
-type: sudo service nginx restart
-change back to the diaspora directory: cd /home/ubuntu/diaspora/
-restart diaspora: ./script/server
-in a new tab type: https://michaelaaronsonmd.net (or your web address). you can see there is an opportunity to sign up!
-select sign up to be presented with the welcome screen:
-success! you have achieved diaspora. enjoy freedom of speech, privacy, and the ownership of your data.
About the Author: Dr. Aaronson blogs about relevant topics to keep you and your family happy and healthy using the wisdom of MORRISSEY.
