Skip to content

1. Website Installation

Liwei edited this page Jun 24, 2017 · 21 revisions

Page Outline


Install Backend Package

  1. Install PHP 5.6, Composer, Apache2, Mysql 5.5
  2. Go to /var/www

cd /var/www

  1. Copy backend package from Ushahidi's Github

sudo git clone https://github.com/ushahidi/platform.git

  1. Build a database on Mysql

mysql -u root -p
create database ushahidi_db;
grant all on ushahidi_db.* to ushahidi@localhost identified by ‘password’;
quit;

  1. create a file ".env"

cd platform
sudo vim .env

DB_HOST=localhost  
DB_NAME=ushahidi_db  
DB_TYPE=MySQLi  
DB_USER=ushahidi  
DB_PASS=password  
  1. Set up URL rewrites

cd httpdocs
sudo cp template.htaccess .htaccess

  1. Enable writing to the logs, cache, and upload directories

chmod 0777 application/logs application/cache application/media/uploads

or

chmod 0777 application/logs application/cache application/media/uploads
chown www-data application/logs application/cache application/media/uploads

  1. Installing dependencies

sudo bin/update


Install Frontend Package

  1. Install NodeJS
  2. Go to /var/www

cd /var/www

  1. Copy frontend package from Ushahidi's Github

sudo git clone https://github.com/ushahidi/platform-client.git

  1. Install Build Requirements

cd platform-client
sudo npm install -g gulp

  1. Install Packages

sudo npm install

  1. Create file ".env"

sudo vim .env

BACKEND_URL=http://backendurl.com  
  1. Run gulp

sudo gulp build


Apache2 Setting

  • Steps:
  1. Go to Apache2 folder

cd /etc/apache2/sites-available

  1. Create a configuration file

sudo vim ushahidi.conf

<VirtualHost *:8080>
    ServerName servername.com
    DocumentRoot "/var/www/platform/httpdocs"
    <Directory "/var/www/platform/httpdocs">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
    ServerName servername.com
    DocumentRoot "/var/www/platform-client/server/www"
    <Directory "/var/www/platform-client/server/www">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>  
  1. Enable sites

sudo a2ensite ushahidi.conf

  1. Restart Apache2

sudo service apache2 restart


Https Certificate

  • Reference:
  1. Create SSL Certificate on Apache2
    https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
  2. Create a Certificate Robot
    https://certbot.eff.org/#ubuntutrusty-apache
  • Steps:
  1. Go to Apache2 folder

cd /etc/apache2

  1. Edit file "port.conf"

sudo nano port.conf

<IfModule ssl_module>
    Listen 443
    Listen 8443
</IfModule>
  1. Create a configuration file

cd /etc/apache2/sites-available
sudo vim ushahidi-ssl.conf

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerAdmin serveradmin@gmail.com
        ServerName servername.com
        DocumentRoot /var/www/platform-client/server/www
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/ies-tser.iis.sinica.ed$
        SSLCertificateKeyFile /etc/letsencrypt/live/ies-tser.iis.sinica$
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateChainFile /etc/letsencrypt/live/ies-tser.iis.sini$
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory "/var/www/platform-client/server/www">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>
        BrowserMatch "MSIE [2-6]" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
    </VirtualHost>
    <VirtualHost _default_:8443>
        ServerAdmin serveradmin@gmail.com
        ServerName servername.com
        DocumentRoot /var/www/platform/httpdocs
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/ies-tser.iis.sinica.ed$
        SSLCertificateKeyFile /etc/letsencrypt/live/ies-tser.iis.sinica$
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateChainFile /etc/letsencrypt/live/ies-tser.iis.sini$
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory "/var/www/platform/httpdocs">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>
        BrowserMatch "MSIE [2-6]" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
    </VirtualHost>
</IfModule>
  1. Enable sites

sudo a2ensite ushahidi-ssl.conf

  1. Restart Apache2

sudo service apache2 restart

  1. Follow reference 1 to apply a Https certification
  2. Follow reference 2 to build a certification robot

./certbot-auto


Localization

  1. Create a .transifexrc file in "home/user". Make sure that the account you are using has joined the Ushahidi v3 group on Transifex.

cd /home/user
sudo nano .transifexrc

[https://www.transifex.com]
username = transifex_account
token = 
password = transifex_password
hostname = https://www.transifex.com  
  1. Run gulp build. You might have to try multiple times if there is a socket hang up error.

sudo gulp build

  1. The option for Language should show up on the client site.

Clone this wiki locally