Skip to content

Commit

Permalink
Cloud quickstart instructions and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jalessio committed Sep 6, 2016
1 parent 4d03e9b commit 635b65d
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 20 deletions.
57 changes: 57 additions & 0 deletions README-cloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# UrbanFootprint Cloud Installation

These are the recommended steps for getting up and running with a demo UrbanFootprint production instance on a cloud server.

## Prerequisites

You'll need:

* A dedicated server running [Ubuntu 14.04](https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes) that you have ssh access to. On AWS, we recommend *"Ubuntu Server 14.04 LTS (HVM), SSD Volume Type"*
* A user account with root privileges (usually via sudo).

We recommend at least 2 CPUs and 8GB of RAM. On AWS, select t2.large or larger [instance type](https://aws.amazon.com/ec2/instance-types/).

## Installation

We provide a "quickstart" script that handles installing all dependencies and pre-loads a sample data set.

wget https://raw.githubusercontent.com/CalthorpeAnalytics/urbanfootprint/master/quickstart.sh
chmod +x quickstart.sh
sudo ./quickstart.sh

Expect this script to take 15-20 minutes to complete. You'll know it's done when you see something like this:

********************************************************************
********************************************************************

UrbanFootprint quickstart is complete. Open your web browser to:
http://<YOUR-IP-HERE>/
using the following default credentials:
user: [email protected]
pass: admin@uf

********************************************************************
********************************************************************


# Using UF

## Login with the default login

The quickstart script will attempt to detect the public IP address of the server and print out a URL to use. If that doesn't work, determine the server's IP address using your cloud provider's tools and put the IP address in your web browser's location bar.

When you first access your UF instance, you will be directed to the login page.
Login credentials are the following:

>username: `[email protected]`
>password: `admin@uf`
For information on how to create new users, please reference the
[User Manager](http://urbanfootprint-v1.readthedocs.io/en/latest/user_manager/) section of the documentation.

## User Guide

[http://urbanfootprint-v1.readthedocs.io/en/latest/](http://urbanfootprint-v1.readthedocs.io/en/latest/)

Copyright (C) 2016 [Calthorpe Analytics](http://calthorpeanalytics.com/)
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ UrbanFootprint is developed by [Calthorpe Analytics](http://calthorpeanalytics.c

Interested in installing UrbanFootprint on your own computer?

The fastest way to get up and running with a local UrbanFootprint installation is by using a pre-built
virtual machine.

---

# UF Quickstart - Use a Pre-built VM
# UF Quickstart Cloud

To run a version of UrbanFootprint on your own server (such as an AWS EC2 instance), follow the instructions in **[README-cloud.md](README-cloud.md)**.

# UF Quickstart Local - Use a Pre-built VM

The fastest way to get up and running with a local UrbanFootprint installation is by using a pre-built
virtual machine.

### Quickstart Prerequisites for Mac OS X and MS Windows:

Expand All @@ -44,7 +48,7 @@ A local UrbanFootprint instance is now accessible via [http://localhost:3333/fo

If you're looking to do active code development on the UrbanFootprint code base, then you'll need to
install a development environment. Detailed installation instructions are available for Mac OS X
and MS Windows in [README-developers.md](README-developers.md)
and MS Windows in **[README-developers.md](README-developers.md)**

# UrbanFootprint Client Configuration

Expand Down
4 changes: 2 additions & 2 deletions conf/etc/supervisor/conf.d/calthorpe.supervisor.prod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[program:calthorpe_www]
command=/srv/calthorpe_env/bin/newrelic-admin run-program /srv/calthorpe_env/bin/python /srv/calthorpe/urbanfootprint/manage.py run_gunicorn -w 12 -b 127.0.0.1:9001 -t 180 --max-requests 250
command=/srv/calthorpe_env/bin/newrelic-admin run-program /srv/calthorpe_env/bin/python /srv/calthorpe/urbanfootprint/manage.py run_gunicorn -w 6 -b 127.0.0.1:9001 -t 180 --max-requests 250
directory=/srv/calthorpe/urbanfootprint
user=www-data
autostart=true
Expand All @@ -25,7 +25,7 @@ killasgroup=true

[program:tilestache]
environment=NEW_RELIC_CONFIG_FILE="/etc/newrelic/newrelic_tilestache.ini",PATH="/srv/calthorpe_env/bin:/usr/bin"
command=/srv/calthorpe_env/bin/newrelic-admin run-program /srv/calthorpe_env/bin/gunicorn "TileStache.Goodies.PGConfigServer:WSGIServer('/srv/calthorpe/urbanfootprint/.env')" -b 127.0.0.1:8484 -w 12 --log-level=INFO --timeout 180
command=/srv/calthorpe_env/bin/newrelic-admin run-program /srv/calthorpe_env/bin/gunicorn "TileStache.Goodies.PGConfigServer:WSGIServer('/srv/calthorpe/urbanfootprint/.env')" -b 127.0.0.1:8484 -w 6 --log-level=INFO --timeout 180
directory=/srv/calthorpe_env/lib/python2.7/site-packages/
user=www-data
stdout_logfile=/var/log/supervisor/tilestache.log
Expand Down
54 changes: 41 additions & 13 deletions quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,67 @@ echo "********************************************************************"
echo "********************************************************************"
echo ""

# working directory for all UF command
cd /srv/calthorpe/urbanfootprint
apt-get update
apt-get install -y software-properties-common
apt-add-repository -y ppa:ansible/ansible-1.9
apt-get update
apt-get install -y ansible git
mkdir -p /srv/calthorpe/

# clone urbanfootprint repos
cd /srv/calthorpe/
git clone https://github.com/CalthorpeAnalytics/urbanfootprint.git urbanfootprint
git clone https://github.com/CalthorpeAnalytics/urbanfootprint-configuration.git urbanfootprint-configuration
cd /srv/calthorpe/urbanfootprint/
git submodule init
git submodule update

# run ansible provisioning
cd /srv/calthorpe/urbanfootprint/provisioning
ansible-galaxy install -f -r galaxy-roles.yml
ansible-playbook -v -i 'localhost', -c local site.yml

# let calthorpe user ssh in for fabric
su - calthorpe -c "ssh-keygen -f ~/.ssh/id_rsa -N ''"
su - calthorpe -c "ssh-keyscan -H localhost > ~/.ssh/known_hosts"
su - calthorpe -c "cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys"

# set file permissions
chown -R calthorpe:calthorpe /srv/calthorpe/urbanfootprint*

# stop all services
sudo supervisorctl stop all
sudo service supervisor stop
sudo service postgresql restart
supervisorctl stop all
service supervisor stop
service postgresql restart

# install python dependencies
pip install -r requirements.txt
# install python dependencies (though really all we need is fabric as this point)
/srv/calthorpe_env/bin/pip install -r /srv/calthorpe/urbanfootprint/requirements.txt
chown -R calthorpe:calthorpe /srv/calthorpe_env

# copy sample environment settings for default configuration
cp .env.sample .env
cp /srv/calthorpe/urbanfootprint/.env.sample /srv/calthorpe/urbanfootprint/.env
chown calthorpe:calthorpe /srv/calthorpe/urbanfootprint/.env

# retrieve sample web database
wget -O urbanfootprint-sacog-web-db.sql.gz https://s3-us-west-2.amazonaws.com/uf-provisioning/urbanfootprint-sacog-web-db.sql.gz
gunzip -f urbanfootprint-sacog-web-db.sql.gz
wget -O /srv/datadump/urbanfootprint-sacog-web-db.sql.gz https://s3-us-west-2.amazonaws.com/uf-provisioning/urbanfootprint-sacog-web-db.sql.gz
gunzip -f /srv/datadump/urbanfootprint-sacog-web-db.sql.gz

# import sample web database
psql -U postgres -c "DROP DATABASE IF EXISTS urbanfootprint;"
psql -U postgres -c "CREATE DATABASE urbanfootprint;"
psql -U postgres -c "GRANT ALL ON DATABASE urbanfootprint TO calthorpe;"
psql -U postgres urbanfootprint < urbanfootprint-sacog-web-db.sql
psql -U postgres urbanfootprint < /srv/datadump/urbanfootprint-sacog-web-db.sql

# finish installation and deployment process
fab -f footprint/installer localhost quickstart
su - calthorpe -c "/srv/calthorpe_env/bin/fab -f /srv/calthorpe/urbanfootprint/footprint/installer localhost quickstart"

external_ip=$(curl -s 'https://api.ipify.org')
echo ""
echo "********************************************************************"
echo "********************************************************************"
echo ""
echo " UrbanFootprint quickstart is complete. Open your web browser to:"
echo " http://localhost:3333/footprint/"
echo " http://${external_ip}/"
echo " using the following default credentials:"
echo " user: [email protected]"
echo " pass: admin@uf"
Expand Down

0 comments on commit 635b65d

Please sign in to comment.