2017 © Pedro Peláez
 

project anahita

Anahita Social Networking Platform

image

anahita/anahita

Anahita Social Networking Platform

  • Tuesday, July 17, 2018
  • by anahita
  • Repository
  • 62 Watchers
  • 302 Stars
  • 6,850 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 152 Forks
  • 2 Open issues
  • 41 Versions
  • 1 % Grown

The README.md

Anahita social networking platform and framework, (*1)

Anahita

Version: 4.8.3 Embryo Release, (*2)

Anahita is a platform and framework for developing open science and knowledge-sharing applications on a social networking foundation. Use Anahita to build:, (*3)

  1. online learning and knowledge-sharing networks
  2. information access networks about people, places, and things
  3. open science and open data networks
  4. online collaboration environments
  5. cloud back-end for your mobile apps

Anahita provides nodes and graphs architecture for developing social networking apps., (*4)

Table of Contents

Concepts

Nodes

  1. actors: people, groups, or build your custom actor
  2. media: notes, topics, todos, photos, articles, or build your custom media
  3. hashtags: all actors, media, and comments are hashtaggable
  4. locations: all actors and media are geolocatable
  5. stories: updates created by actors for their followers

Graphs

  1. social graph: people and groups can be followed by others.
  2. hashtags: for actors, media, and comments
  3. mentions: tag people in media and comments
  4. locations: tag locations in media and actors and search nearby nodes
  5. notifications: a person receives email notification whenever a comment is posted on an item to which they are subscribed.
  6. votes: people can Like/Unlike media and comments

Stories

  • story feeds on dashboard and actor profiles
  • notifications

RAD Framework

  1. MVC rapid app development framework specialized for building social apps
  2. fully customizable theme and user interfaces
  3. extendable by social apps and components
  4. RESTful and JSON APIs (ideal to use Anahita as a back-end for mobile apps)
  5. Built using your favourite technologies such as PHP5, MySql, Bootstrap, JQuery, Grunt, Composer, LessCSS

Embryo and Birth releases

The code in the master branch is called the Embryo. It is what we use to power our website Anahita.io and is constantly changing and evolving. It may contain bugs that we are fixing, or we may add or remove experimental features. Whenever we reach a specific milestone, and the codebase is stable, we package it as a Birth release., (*5)

System Requirements

Before you start, please make sure that your server meets the following requirements:, (*6)

  1. Linux or Unix server
  2. Nginx or Apache 2.0+
  3. MySql 5.7
  4. Redis (optional) any hosted and managed Redis service will do. For example AWS ElastiCache Redis.
  5. Use PHP version 7.4 to 8.0 for best results.
  6. Composer package management. You can download it following the instructions on http://getcomposer.org/ or just run the following command:

curl -s http://getcomposer.org/installer | php, (*7)

Important Notes

If you have the Suhosin patch installed on your server, you might get an error. Add this line to your php.ini file to fix it: suhosin.executor.include.whitelist = tmpl://, file://, (*8)

Anahita is installed and managed via shell CLI because this is the most reliable approach, especially after you accumulate large amounts of data in your database., (*9)

Installation on a development machine

Installing a stable package

We call the stable packages Birth releases. Use the following command to create an Anahita project called myproject. This command automatically downloads all the required files from the Anahita GitHub repository:, (*10)

composer create-project anahita/project myproject, (*11)

Now go to the myproject directory:, (*12)

cd myproject, (*13)

Continue with [Initiating Installation] (#initiating-installation) from this point., (*14)

Installing from the master branch

The master branch always contains the Embryo release. Using the following command, clone the Anahita repository from the master branch:, (*15)

git clone git@github.com:anahitasocial/anahita.git myproject, (*16)

change directory to myproject, (*17)

cd myproject, (*18)

Now run the composer command to obtain all the 3rd party libraries that Anahita requires:, (*19)

composer update, (*20)

Continue with Initiating Installation from this point., (*21)

Initiating Installation

If you type php anahita, you get a list of all commands available to manage your Anahita installation. If the command didn't work, perhaps the symlink to the Anahita command line tool isn't created. In this case, run the following command to create a symlink. Otherwise, move to the next step, initiating the installation process., (*22)

ln -s bin/anahita anahita, (*23)

To initiate the installation process, run the following command and provide your database information when it asks you:, (*24)

php anahita site:init, (*25)

The installer creates an Anahita installation in the PATH-TO-YOUR-DIRECTORY/myproject/www directory. You need to configure your server to use this directory as the public directory., (*26)

Congratulations! You have installed Anahita successfully. Now you need to signup as a Super Administrator., (*27)

Signing Up The Super Administrator

The first person that is signing up with Anahita becomes the Super Administrator. Use the following command to create the first account:, (*28)

php anahita site:signup, (*29)

Provide a valid email and username. You can provide a password, or Anahita automatically creates a strong password for you., (*30)

Congratulations! You have created the first person and Super Admin account. Point your browser to your Anahita installation and login., (*31)

Next, you will configure your installation and install some apps., (*32)

Building an AWS EC2 server and installing Anahita

Prerequisites: you need to be familiar with AWS services such as Route53, Load Balancers (ELB), EC2 Servers, Identity & Access Management (IAM), and Relational Database Service (RDS)., (*33)

Installing PHP

Amazon Linux comes with PHP pre-installed. All you need to do is to enable it using the following commands., (*34)

sudo amazon-linux-extras enable php8.0, (*35)

sudo yum clean metadata, (*36)

sudo yum install php-{pear,cgi,pdo,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip}, (*37)

Now check to see if the PHP 8.0 is installed and working:, (*38)

php -v, (*39)

Installing NGINX

sudo amazon-linux-extras enable nginx1, (*40)

sudo yum clean metadata, (*41)

sudo yum -y install nginx, (*42)

sudo systemctl enable --now nginx, (*43)

systemctl status nginx, (*44)

Configuring NGINX

The following is an example of a configuration file you can use for your EC2 server:, (*45)

server {
  listen 80;
  server_name <your-anahita-project-server-name>;
  root /var/www/<your-anahita-project-name>/www;
  access_log /var/log/nginx/<your-anahita-project-name>_access.log;
  error_log /var/log/nginx/<your-anahita-project-name>_error.log; 

  location / {
     default_type application/json;
       client_max_body_size 50M;
       index index.php index.html;
     try_files $uri $uri/ /index.php?$args;
  }

  charset utf-8;
  gzip on;
  gzip_comp_level 3;
  gzip_disable "msie6";
  gzip_min_length 1000;
  gzip_proxied any;
  gzip_types text/xml text/plain application/xml application/json;

  location ~ /\. {
      access_log       off;
      log_not_found    off;
      deny             all;
  }

  location = /robots.txt {
       allow all;
       log_not_found off;
       access_log off;
  }

 location ~* /(?:uploads|files)/.*\.php$ {
        deny all;
 }

  location ~ \.php$ {     
          try_files                 $uri =404;
        include                   /etc/nginx/fastcgi_params;
        fastcgi_read_timeout      3600s;
        fastcgi_buffer_size       128k;
        fastcgi_buffers           4 128k;
        fastcgi_param             SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass              unix:/run/php-fpm/www.sock;
        fastcgi_index             index.php;

           client_max_body_size 50M;

         add_header "Access-Control-Allow-Origin" "https://<your-anahita-project-url>" always;
         add_header "Access-Control-Allow-Methods" "GET, POST, PUT, DELETE, HEAD" always;
         add_header "Access-Control-Allow-Headers" "Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With" always;
         add_header "Access-Control-Allow-Credentials" "true" always;
  }
}

You can run the command sudo nginx -s reload every time you edit the config file for the changes to be applied., (*46)

Installing a firewall

sudo yum install firewalld, (*47)

sudo systemctl start firewalld, (*48)

sudo systemctl enable firewalld, (*49)

sudo systemctl status firewalld, (*50)

sudo firewall-cmd --add-service={http,https} --permanent, (*51)

sudo firewall-cmd --reload, (*52)

sudo firewall-cmd --list-all, (*53)

Configuring PHP FPM Service

Edit the www.confi file using vim:, (*54)

sudo vim /etc/php-fpm.d/www.conf, (*55)

user = nginx
group = nginx
listen = /run/php-fpm/www.sock
listen.acl_users = apache,nginx
pm = ondemand

Write and quite vim, and the run the following commands:, (*56)

sudo systemctl enable php-fpm, (*57)

sudo systemctl restart php-fpm, (*58)

systemctl status php-fpm, (*59)

Installing PHP Composer

Composer is a dependancy manager for PHP. This is how you install composer globally on your server:, (*60)

cd ~, (*61)

sudo curl -sS https://getcomposer.org/installer | sudo php, (*62)

sudo mv composer.phar /usr/local/bin/composer, (*63)

sudo ln -s /usr/local/bin/composer /usr/bin/composer, (*64)

sudo composer install, (*65)

Installing and configuring Git

We need git to be able to clone and pull Anahita code from the Github repository., (*66)

sudo yum install git -y, (*67)

git version, (*68)

Setup SSH key for Gihub

ssh-keygen -t ed25519 -C "yourgithubaccountemail@example.com", (*69)

~ssh-add ~/.ssh/id_ed25519, (*70)

sudo cat /root/.ssh/id_ed25519.pub, (*71)

Setting up a mail server

Anahita sends out a lot of email notifications. The best way is to use a reliable and heavy-duty mail service such as Mailgun or Amazon Simple Email Service (SES). Once you setup your SMTP, you need to have the following values for configuring Anahita in the next step:, (*72)

  • username
  • password
  • host
  • port

Initiating and configuring Anahita

You need to create a MySQL or MariaDB Amazon RDS instance. We don't cover the RDS creation and configuration in this document. Instead, you can read the AWS documentation: Configuring an Amazon RDS DB instance. Once you have your RDS instance ready, you need to have the following values:, (*73)

  • endpoint
  • port
  • database
  • username
  • password

You can test the database connection from your server using the following command:, (*74)

mysql -h <endpoint> -P <port> -u <username> -p, (*75)

Enter the password, and then use standard MySQL commands to interact with the database. Once you manage to connect successfully, you can exit., (*76)

Installing Anahita on an EC2 instance is similar to installing Anahita on a development machine with variations. On EC2, you can clone Anahita under the var/www/ directory., (*77)

From the master branch of the Anahita repository:, (*78)

git clone git@github.com:anahitasocial/anahita.git <your-anahita-project-name>, (*79)

Or from your custom Anahita project repository:, (*80)

git clone git@github.com:<your-anahita-project-repo-on-github>/<your-anahita-project-name>.git, (*81)

Now change the permissions of your Anahita project directory:, (*82)

sudo chown ec2-user:ec2-user <your-anahita-project-name> -R, (*83)

Go in the directory and use composer to get all the required packages:, (*84)

cd <your-anahita-project-name>, (*85)

composer update, (*86)

Now initiate Anahita; the initiation process asks you for several parameters such as database info, etc. Enter all the values that the prompt message asks you:, (*87)

php anahita site:init, (*88)

Now signup for the first user account. The first user has Super Admin privileges which is the highest within an Anahita installation:, (*89)

php anahita site:signup, (*90)

Editing the Configuration file

You can use a CLI text editor to edit the configuration.php file in the root directory. There are several parameters that you need to set in this file:, (*91)

Parameter Value Example
$sitename Website/app name Anahita
$same_site_none Cookie same site none on/off 0
$client_domain base url to your client side webapp https://www.YourDomain.io
$sef_rewrite Set this to 1 1
$debug If true, Anahita will operate in debugging mode 0
$error_reporting Use -1 to turn it off or 30719 to show all warnings -1
$cors_enabled Use 1 and set the other cors value. This feature is best if you are using Anahita on your development machine and want to test it with a clientside app. For a production server, set the CORS in the nginx config file, instead. 0
$mailer We recommend smtp and using an SMTP provider such as Mailgun or AWS SES smtp
$mailfrom The email address used in the 'reply to' section of your email notifications noreply@YourDomain.io
$fromname A name that indicates where the origin of an email notification. Anahita Platform
$smtp_user Your SMTP service username postmaster@sandboxa2a4fc6fe.mailgun.org
$smtp_pass Your SMTP service password strongpassword
$smtp_host path to the SMTP service host smtp.mailgun.org
$smtp_secure Use ssl ssl
$smtp_port SMTP service port 587

Write and quit the editor. Now you can set up an AWS Load Balancer (ELB) for your installation and point it to, for example, https://api.YourDomain.io, (*92)

Anahita Settings

Before using your Anahita for development or production server, you need to make some configurations. At this point, you need to connect to Anahita using a client-side app such as Anahita React. Once you have set up your client-side application, then you can access the Settings as follows:, (*93)

  1. Log in to your Anahita installation as a Super Administrator
  2. On the main menu, click on the Settings

Here are the tabs under the Settings view:, (*94)

  1. About: has basic information about your Anahita installation, such as creators and software version.
  2. Apps: configure installed Anahita apps for the entire site.
  3. Assignments: configure which actors (People, Groups, etc.) can use what apps (Topics, Photos, etc.)
  4. Plugins: configure Anahita plugins for the entire site.

Notifications

Anahita emails out a lot of email notifications. For the email notifications to get sent out, you can set up a cron job on your server to the yourdomain.com/components/com_notifications/process.php file. Make sure to go to Site Settings > Apps > Notifications and set Use Cron to Yes., (*95)

There are many articles on the web to show you how to set up a cron job. Depending on your site's number of users and activity, anywhere from 15-minute to 1-hour intervals will work. You will find a suitable interval after monitoring your Anahita installation for a while., (*96)

Installing Social Apps

Now it is time to extend your Anahita installation with some apps and components. Anahita comes with a list of social apps you can use as they are or use as blueprints for developing your custom apps., (*97)

To get a list of available apps, simply type the following command:, (*98)

php anahita package:list, (*99)

Now to install an app, for example, the Photos app, type the following command:, (*100)

php anahita package:install photos, (*101)

You can even provide a list of apps and components in one line. For example, to install the Groups, Topics, and Connect apps, use the following command:, (*102)

php anahita package:install groups topics connect, (*103)

Go to Site Settings > Assignments to define whether an app should optionally or always be available on actor profiles (people, groups, etc.). If an app is optionally available, it can be enabled on each actor profile under the Edit Profile > Apps by the actor profile admin or someone with a higher admin privilege on the Anahita installation., (*104)

Congratulations! You have just installed some apps and extensions on your Anahita installation., (*105)

Amazon S3 Storage

In most cases, you wouldn't want to store the uploaded files on your own server. They add up very quickly, making it very difficult to maintain or migrate your Anahita installation. Anahita provides a plugin that stores all uploaded files in the AWS or Amazon S3 cloud., (*106)

Go to Site Settings > Plugins and then from the type list select Storage. Edit and disable the Storage - Local plugin by clicking on its name. Edit the Amazon S3 plugin using the following settings:, (*107)

  1. Enabled: set to yes
  2. The folder to store the data: use assets as the default setting
  3. Bucket: enter the name of your Amazon S3 bucket
  4. Access Key: enter your AWS access key
  5. Secret Key: enter your AWS secret key

Now click Update to store the settings. Try uploading your avatar in the front-end and see if it gets uploaded successfully. Check the image src to make sure it is an AWS URL., (*108)

Support

Anahita has an active and thriving tribe of hobbyists, developers, and entrepreneurs. They are helpful and friendly. So Join Us, (*109)

Please Note: we do not answer questions in an email. If you have any questions, please join the Anahita tribe and post your questions on the Tribe Support group, where others can benefit from the answers too., (*110)

Reporting Bugs & Issues

There are so many ways that you can report a bug:, (*111)

Contribute to Anahita

Anahita could never be possible without the help of people in our tribe. We need contributors who can help us with testing, finding and fixing bugs and coding. Here is a complete guideline of how you can contribute to Anahita., (*112)

Follow us, Like us

Follow us on Instagram anahita.io and like our facebook page Facebook.com/anahita.io, (*113)

Credits

Anahita is developed and maintained by rmdStudio Inc., a software development company in Vancouver, Canada. We build client-server architecture applications for scientific, healthcare, and industrial sectors., (*114)

The Versions

17/07 2018

dev-master

9999999-dev https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0 GPL-3.0-only

The Requires

 

framework social platform restful graph networking learning knowledge

08/07 2018

4.3.12

4.3.12.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0-only

The Requires

 

framework social platform restful graph networking learning knowledge

19/02 2018

4.3.11

4.3.11.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0-only

The Requires

 

framework social platform restful graph networking learning knowledge

19/02 2018

dev-issues/478-nooku-refactor

dev-issues/478-nooku-refactor https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0-only

The Requires

 

framework social platform restful graph networking learning knowledge

21/11 2017

dev-add-license-1

dev-add-license-1 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

21/11 2017

4.3.10

4.3.10.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

12/11 2017

4.3.9

4.3.9.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

04/11 2017

4.3.8

4.3.8.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

18/10 2017

4.3.7

4.3.7.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

27/08 2017

4.3.6

4.3.6.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

10/04 2017

4.3.5

4.3.5.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

10/04 2017

4.3.4

4.3.4.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

12/02 2017

4.3.3

4.3.3.0 https://www.GetAnahita.com

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework social platform restful graph networking learning knowledge

06/01 2017

4.3.2

4.3.2.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

05/01 2017

4.3.1

4.3.1.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

05/01 2017

4.3.0

4.3.0.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

12/10 2016

4.2.4

4.2.4.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

22/09 2016

4.2.3

4.2.3.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

06/09 2016

4.2.2

4.2.2.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

04/04 2016

4.2.1

4.2.1.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

21/03 2016

4.2.0

4.2.0.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

16/10 2015

4.1.8

4.1.8.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

03/10 2015

4.1.7

4.1.7.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

28/09 2015

4.1.6

4.1.6.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

26/09 2015

4.1.5

4.1.5.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

06/07 2015

4.1.4

4.1.4.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

29/06 2015

4.1.3

4.1.3.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

09/06 2015

4.1.2

4.1.2.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

30/05 2015

4.1.1

4.1.1.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

13/05 2015

4.1.0

4.1.0.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

framework platform restful graph knowledge nodes socialnetwork

28/04 2015

4.0.4

4.0.4.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

15/04 2015

4.0.3

4.0.3.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

15/04 2015

4.0.2

4.0.2.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

28/10 2014

4.0.1

4.0.1.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

20/10 2014

4.0.0

4.0.0.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

30/07 2014

3.0.4

3.0.4.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

06/07 2014

3.0.3

3.0.3.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

25/04 2014

v3.0.2

3.0.2.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

26/12 2013

v3.0.0

3.0.0.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

27/08 2013

v3.0.0-rc1

3.0.0.0-RC1

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform

23/07 2013

2.2.4

2.2.4.0

Anahita Social Networking Platform

  Sources   Download

GPL-3.0

The Requires

 

social platform