installation - GetmeUK/hangar51 GitHub Wiki
The following provides a short guide to installing Hanger51, the guide is based on a local install but production environments are discussed at the end.
All commands are at the terminal unless explicitly described as different.
- A Linux or OSX operating system (for Windows users please use a virtual machine running Ubuntu 14.04).
- Mongo 3.0+
- Python 3.4+ (used for the application) and Python 2.7 (used to run Fabric and Supervisor)
- RabbitMQ 3.6.1+
- Nginx 1.4.6+ (optional)
To download the current repo:
-
cd install-directory
(the repo will be downloaded into a folder called event-hive) git clone [email protected]:getme/hanger51.git
cd hanger51
In the settings directory within the repo create a local.py file and add the following:
from . import DefaultConfig
class Config(DefaultConfig):
# Database
MONGO_PASSWORD = '...'
# Debugging
DEBUG = True
# Networking
PREFERRED_URL_SCHEME = 'http'
SERVER_NAME = 'hanger51.local'
- In the repo directory
run pyvenv-3.x .
(There is a bug in some versions of Ubuntu such that pyvenv-3.x may not be available in which case you should first:sudo apt-get install python3.x-venv
- Activate the virtual environment using
source bin/activate
- Download all the project's Python requirements using
pip install -r requirements.txt
- MongoFrames is not available from PyPI currently so you will need to manually install it using
pip install git+ssh://[email protected]/getme/mongoframes.git
- MongoFrames is not available from PyPI currently so you will need to manually install it using
- Run the
init
task for the applicationfab m:init
- Check the application has installed correctly by running
fab up
. You should see the following output at the terminal:
* Running on http://127.0.0.1:5151/ (Press CTRL+C to quit)
* Restarting with stat
Whether you use Nginx to proxy to the Hanger51 app or not is entirely optional (but recommended), I use Nginx on my local install to allow me to run the app under the domain hanger51.local
.
- Copy the default local Nginx config file to your Nginx conf.d directory:
sudo cp root/nginx/local.conf /etc/nginx/conf.d/hanger51.local.conf
- The default config is set up to run the application under the host name
hanger51.local
and port5151
, however you can modify these in the Nginx config. - Restart Nginx
sudo service nginx restart
- Edit your hosts file
sudo nano /etc/hosts
and add an entry for127.0.0.1 hanger51.local
- Check that the Nginx installation is correct by opening a browser and visiting http://hanger51.local. While the app is running, you should get:
{
"payload": {
"reason": "`api_key` not specified."
},
"status": "fail"
}
Hanger51 uses celery to execute tasks in the background such as generating variations and removing expired assets. In a new terminal window start the celery tasks with: fab tasks_up
PyTest is used for testing the Hanger51 code base, to run the tests simply type py.test
at the terminal whilst in the repo directory with the virtual environment activated.
The repo does not (for obvious reasons) include a configuration file for s3 which is required to run the complete set of tests. To add one create a file named s3.cfg
within tests/data
and populate from this template:
{
"backend": "s3",
"access_key": "...",
"secret_key": "...",
"bucket": "..."
}
TODO: As we deploy a production environment the architecture will be detailed here.
Initial setup in a single CentOS 7.2 container on o4.getme.co.uk at OVH.
- container name: hanger51 (located at /srv/hanger51)
- container address (for e.g. ssh) hanger51.o4.getme.co.uk (ip address 51.254.63.38) Note. that that currently containers are not isolated at the network level so any service must be configured to listen on allocated ip address(es) only or use custom ports.