# How to set up the Internews Humanitarian Information Dashboard on a Ubuntu 14.04 environment
This document provides instructions on deploying the [Internews Humanitation Information Dashboard](https://github.com/aptivate/internewshid) on a [Ubuntu 14.04 LTS](http://releases.ubuntu.com/14.04/) environment.
This document provides instructions on deploying the [Internews Humanitation
Information Dashboard](https://github.com/aptivate/internewshid) on a [Ubuntu
These instructions allow you to setup the HID on a local development machine, based on the desktop edition of Ubuntu 14.04. This setup does not require a web server, as it is for development only and instead uses Django's build in server.
These instructions allow you to setup the HID on a local development machine,
based on the desktop edition of Ubuntu 14.04. This setup does not require a web
server, as it is for development only and instead uses Django's build in
server.
All instructions are to be run in a [terminal](https://help.ubuntu.com/community/UsingTheTerminal), and require a user who can [run sudo](https://help.ubuntu.com/community/RootSudo)
All instructions are to be run in a
[terminal](https://help.ubuntu.com/community/UsingTheTerminal), and require a
user who can [run sudo](https://help.ubuntu.com/community/RootSudo)
### Pre-requisites
You need to install a MySql server, git, a Python development environment and other system tools:
You need to install a MySql server, git, a Python development environment and
You will need to know your MySql root password. If you set it up for the first time you will be prompted for the password. If you have set it up previously and forgotten the password you will need to [reset your MySql root password](https://help.ubuntu.com/community/MysqlPasswordReset).
You will need to know your MySql root password. If you set it up for the first
time you will be prompted for the password. If you have set it up previously
and forgotten the password you will need to [reset your MySql root
This will prompt you for your Github user account. Next you will want to download the application's dependencies and deploy the project locally:
This will prompt you for your Github user account. Next you will want to
download the application's dependencies and deploy the project locally:
```sh
cd ~/projects/internewshid/deploy
...
...
@@ -41,7 +54,8 @@ This will prompt you for your Github user account. Next you will want to downloa
./tasks.py deploy:dev
```
This will prompt you for your MySql root password. The final preparation step is to setup a super user who will have access to the administration interface:
This will prompt you for your MySql root password. The final preparation step
is to setup a super user who will have access to the administration interface:
```sh
cd ~/projects/internewshid/django/website
...
...
@@ -50,7 +64,9 @@ This will prompt you for your MySql root password. The final preparation step is
### Run the tests
To ensure long term maintainability the application contains a number of automated tests. If you want to run the tests you will need to install additional dependencies:
To ensure long term maintainability the application contains a number of
automated tests. If you want to run the tests you will need to install
additional dependencies:
```sh
sudo apt-get install-y phantomjs
...
...
@@ -72,34 +88,46 @@ You can start Django's internal web server by running the following command:
./manage.py runserver
```
Once this is started, you can point your web browser to `http://localhost:8000` to see the Internews HID.
Once this is started, you can point your web browser to `http://localhost:8000`
to see the Internews HID.
### Notes on the development version
In the development version, the javascript and CSS assets are not compressed, and not combined into a single file. This makes development easier - however it means the page size will be considerably larger than it would be in production.
In the development version, the javascript and CSS assets are not compressed,
and not combined into a single file. This makes development easier - however it
means the page size will be considerably larger than it would be in production.
## Server environment setup
These instructions allow you to setup the HID on a server machine, based on the server edition of Ubuntu 14.04.
These instructions allow you to setup the HID on a server machine, based on the
server edition of Ubuntu 14.04.
All instructions are to be run in a [terminal](https://help.ubuntu.com/community/UsingTheTerminal), and require a user who can [run sudo](https://help.ubuntu.com/community/RootSudo)
All instructions are to be run in a
[terminal](https://help.ubuntu.com/community/UsingTheTerminal), and require a
user who can [run sudo](https://help.ubuntu.com/community/RootSudo)
### Pre-requisites
You need to install an Apache server, a MySql server, git, a Python development environment and other system tools:
You need to install an Apache server, a MySql server, git, a Python development
You will need to know your MySql root password. If you set it up for the first time you will be prompted for the password. If you have set it up previously and forgotten the password you will need to [reset your MySql root password](https://help.ubuntu.com/community/MysqlPasswordReset).
You will need to know your MySql root password. If you set it up for the first
time you will be prompted for the password. If you have set it up previously
and forgotten the password you will need to [reset your MySql root
You will also need to know the server hostname - the name that will be used to access the website, eg. `www.example.com`.
You will also need to know the server hostname - the name that will be used to
access the website, eg. `www.example.com`.
### Fetch and prepare Internews HID application
The configuration files expect the application to be under `/var/django/internewshid/current`.
The configuration files expect the application to be under
`/var/django/internewshid/current`.
First, get a copy of internews hid:
...
...
@@ -109,7 +137,8 @@ First, get a copy of internews hid:
sudo git clone https://github.com/aptivate/internewshid.git current
```
This will prompt you for your Github user account. Next you will want to download the application's dependencies and deploy the project locally:
This will prompt you for your Github user account. Next you will want to
download the application's dependencies and deploy the project locally:
```sh
cd /var/django/internewshid/current/deploy
...
...
@@ -117,14 +146,19 @@ This will prompt you for your Github user account. Next you will want to downloa
sudo ./tasks.py deploy:production
```
This will prompt you for your MySql root password. Next you need to setup a super user who will have access to the administration interface:
This will prompt you for your MySql root password. Next you need to setup a
super user who will have access to the administration interface:
```sh
cd /var/django/internewshid/current/django/website
./manage.py createsuperuser
```
The production version is stricter in terms of security, and you must explicitly allow the host on which you are installing hid by editing `/var/django/internewshid/current/django/website/settings.py` and adding the server host name to the `ALLOWED_HOSTS` configuration. For example you would replace:
The production version is stricter in terms of security, and you must
explicitly allow the host on which you are installing hid by editing
`/var/django/internewshid/current/django/website/settings.py` and adding the
server host name to the `ALLOWED_HOSTS` configuration. For example you would
replace:
```python
ALLOWED_HOSTS=[
...
...
@@ -145,7 +179,7 @@ You need to ensure that the web server has write access to the `static` and `upl
Finally you will need to set the Apache configuration file. First copy it in place:
```sh
...
...
@@ -164,7 +198,8 @@ With
ServerName www.example.com
```
And if you want to enable all subdomains to direct to this location, you add the following linebelow:
And if you want to enable all subdomains to direct to this location, you add
the following linebelow:
```
ServerAlias *.example.com
...
...
@@ -173,7 +208,7 @@ And if you want to enable all subdomains to direct to this location, you add the
Finally, enable the site and restart apache:
```
```
sudo a2ensite internewshid
sudo service apache2 restart
```
...
...
@@ -182,7 +217,9 @@ The site will now be available in your browser at `http://www.example.com`
### Run the tests
To ensure long term maintainability the application contains a number of automated tests. If you want to run the tests you will need to install additional dependencies:
To ensure long term maintainability the application contains a number of
automated tests. If you want to run the tests you will need to install