[]
(https://travis-ci.org/cybergreen-net/stats-new)
CyberGreen stats site prototype.
To build and view the app:
-
Clone the repo
git clone --recursive https://github.com/cybergreen-net/stats-new.git
-
Install dependencies
[sudo] npm install
-
Create a database and set configuration [see below]
-
Run the app. From the base directory:
heroku local
-
Visit the running app in your browser at http://localhost:5000/
There are two options:
- A local database - this is needed if you are doing local development and testing. See next section.
- The online development database - this is for demo-ing and testing against the full dataset. You can connect direct to the live development using your .env. You will need to get the connection details from the tech lead.
We use postgresql 9.5 for local development. Plese follow instalation instructions here
Create the user and database
$ psql -U postgres -c "create user test_user password 'secret' createdb;"
$ psql -U postgres -c "create database testdb owner=test_user;"
Run aggregation script
$ pip install -r tests/requirements.txt
$ python tests/aggregate.py
Note that you will need to install the Heroku toolbelt to carry out the heroku
commands below.
Skip this step if the application is already deployed
This is heavily based on this tutorial.
# replace {app-name} with the name of your app
heroku create {app-name}
git push {remote-name} master
# now point at our config
heroku ps:scale web=1
Note: If not set, remote-name
by default, is “heroku”.
Push to heroku git repo:
git push {remote-name} master
Note: if didn't do the create you will need to add the remote:
git remote add {remote-name} [email protected]:{app-name}.git
heroku sharing:add [email protected]
Do the following:
heroku domains:add {your-domain-name}
Construct URI with following format:
DATABASE_URI=dialect+driver://username:password@host:port/database
# example
DATABASE_URI=postgres://cg_user:SecetPassword@cg-example.jdutoe634ksdk.cg-region-1.rds.amazonaws.com:1234/cg_database
Now CNAME your domain to {myapp}.herokuapp.com