Diaspora*

Diaspora*

Diaspora* is an open-source user-owned distributed social network with more than 1 million accounts all over the world. It consists of separate nodes named podes. Each pode operates a copy of the Diaspora software and represents a personal web-server.

So, let’s find out how to create your own Diaspora* pode with the help of Jelastic Platform-as-Infrastructure.

Create an Environment

1. Log in to the Jelastic dashboard using your credentials.

2. Press Create environment button. In the opened environment topology wizard navigate to the Ruby programming language tab. Pick the following nodes:

  • Apache application server
  • MySQL database
  • Redis data structure server

Note: Redis is an optional node. If you can’t find this server in the NoSQL section of your wizard, send a request to your hosting provider for its adding. Then state the resources limits for the chosen nodes. Finally, enter name for your environment (e.g. diaspora-network), and click Create button.

diaspora environment wizard

3. After about a minute your new environment will appear at the dashboard.diaspora environment created

Diaspora* Deployment

1. Navigate to the Diaspora GitHub repository. There change the branch to master and click Download ZIP button. You will be offered to save .zip archive with the latest Diaspora* stable version.diaspora download zip

2. Then navigate back to the Jelastic dashboard and upload this archive with the help of Deployment manager.

diaspora upload archive

3. Then press Deploy to.. button next to the diaspora-master.zip package. In the opened window choose test deployment type and click Deploy.

diaspora deploy diaspora

Note: in order to run Diaspora* in *production* mode you need to have certificate authorities (CA) certificates installed at your server.

4. The process of deployment can take some time, so be patient, please. Finally, you’ll see a new test context listed for Apache.diaspora diaspora deployed (2)

Database Configurations

1. Press Open in browser button next to the MySQL node in your environment.diaspora open mysql (2)

2. In the opened browser tab log in using the MySQL credentials you’ve received while environment creation and navigate to the SQL section.diaspora sql tab

3. You’ll see an empty form for SQL request executing. Enter the following line there and click Go in order to create a new database named diaspora_test.
CREATE DATABASE diaspora_test CHARACTER SET utf8;

diaspora create diaspora db

4. After that open Jelastic dashboard again and press Config button for Apache application server.

diaspora config apachediaspora config apache

5. In the opened configuration manager navigate to the webroot > config folder, find database.yml.example file and copy its content.diaspora database yml

6. Then create new database.yml file in the same (config) folder and paste the copied strings to it.

diaspora new database yml

7. Now it’s necessary to set up the connection between your application and MySQL database.

Find the section for MySQL configurations. Specify your MySQL host (URL to your database without http://) and credentials you’ve received while environment creation  in username and password strings.

Don’t forget to Save the changes made.diaspora connection strings

Application Server and Redis Configurations

1. Press Config button for Apache application server again.diaspora config apachediaspora config apache

2. Navigate to the webroot > config folder and create a new diaspora.yml file there. Then find diaspora.yml.example configuration file in the same folder, copy its content, and paste it into the newly created file.diaspora diaspora yml

3. After that navigate to the configuration section in this file and change the following values:

  • find the #url: “https://example.org/” string and paste your environment’s URL instead of https://example.org/ value (you can find it by pressing Open in browser button for your environment and copying URL in the address bar).diaspora environment url
  • scroll a bit lower and find the settings for remote Redis connection in the same file:
    ## URL for a remote redis.
    ## Don’t forget to restrict the IP access!
    ## Leave it commented out for the default (localhost)
    #redis: ‘redis://exmaple_host’
    #redis: ‘redis://username:[email protected]:6379/0’
    #redis: ‘unix:///tmp/redis.sock’

Delete the # symbol from the #redis: ‘redis://username:[email protected]:6379/0’ line. Then substitute the values in this parameter with your own data, received via email after the environment creation.diaspora 46cafe9c86a105e5d1d1301d60f9c4c2redis credentials

Change username and password values to the credentials for admin access to your Redis node. The same story with the host word: substitute it with the DNS address you can find in this letter.diaspora 46cafe9c86a105e5d1d1301d60f9c4c2redis connection

  • finally, locate the #require_ssl: true line. Change the true value to false. It’s time to Save the changes

diaspora ssl false

4. Then navigate to the application.rb file, located in the same config folder. Find  #config.i18n.default_locale = :de string and change its value to :en. Don’t forget to press the Save button in the panel above.diaspora application rb

5. After that find the defaults.yml file (still in the config folder). At the #142-144 lines (or about it) you can see the following lines:  i_am_a_dummy: # Remove if you add an actual override
test:

  •  environment:
       url: ‘http://localhost:9887/’
    diaspora dia6Please, delete the line started with “i_am_a_dummy” string, and change an url parameter’s value to the host url of your environment (it can be seen in the e-mail you’ve got earlier or by pressing the Open in browser button next to your environment and copying URL in the address bar). You should get something like following:
  • Save the changes.
    diaspora dia7

6. Finally, create new rake_deploy file in the webroot folder. Enter the following strings there: db:create db:schema:load assets:precompilediaspora rake deploy

7. Press Save button one more time and Restart the Apache node in order to apply all the configurations you’ve made.

diaspora apache restart

Note: first restart of the server after new settings applying can take some amount of time, please, be patient.

8. Now you can press Open in browser button for your environment and start working with your own Diaspora* application hosted.

diaspora diaspora start page