Find our roadmap, documentation, and on-boarding information for contributors at cityasacampus.org
To edit documentation or the roadmap, switch to the gh-pages branch.
If you are interesting in setting up City as a Campus for your city, please review Getting Started.
install https://www.zenhub.io/
Here are our dependencies:
- Ruby 2.1.4 (for Rails)
- Node.js 4.1.1 (for our Gulp-based asset pipeline)
- PostgreSQL 9.0+ with
pg_trgm
(for data management)
We maintain a build system for Ubuntu 14.04 that only depends on git
(sudo apt-get -y update && sudo apt-get -y install git-core
). You can invoke it like so:
git clone https://github.com/saxifrage/cityasacampus.git && cd cityasacampus/dev/src && ./install.sh
For other operating systems, you may find these install logs helpful:
./node_modules/.bin/gulp &
bundle exec rails server
Our production instance is deployed on Heroku. To deploy your own, create a Heroku account, install the Heroku Toolbelt, and then issue the following commands in the project root.
heroku login
heroku create
heroku buildpacks:add heroku/nodejs # for compiling assets during deployment
heroku buildpacks:add heroku/ruby # for Rails
# a nice way to get random tokens - http://stackoverflow.com/a/2793856 - pick one!
alias random_token="cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 64" # Max OS
alias random_token="cat /dev/urandom | tr -cd 'a-f0-9' | head -c 64" # Linux
heroku config:set APP_SECRET=`random_token`
heroku config:set APP_TOKEN=`random_token`
git push heroku
After you push the app for the first time, Heroku should provision a PostgreSQL database for you and set some environment variables. Double-check them.
$ heroku config
=== foo-bar-1234 Config Vars
APP_SECRET: deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef
APP_TOKEN: fa1afe1fa1afe1fa1afe1fa1afe1fa1afe1fa1afe1fa1afe1fa1afe1fa1afe1f
DATABASE_URL: postgres://beef:feed@ec2-1-2-3-4.compute-1.amazonaws.com:5432/deaf
LANG: en_US.UTF-8
RACK_ENV: production
RAILS_ENV: production
RAILS_SERVE_STATIC_FILES: enabled
SECRET_KEY_BASE: facefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeedfacefeed
$
If everything looks right, then you're ready to populate the database. Use the db:schema:load
task to load our schema into the database that Heroku has already created for you, and optionally the db:seed
task to insert some seed data once the schema is loaded. Check the Rails source for a full list of available db-related tasks, or use heroku run rake -T db
.
heroku run rake db:schema:load
heroku run rake db:seed
If that works, then you should be all set! Visit the app in your browser at https://foo-bar-1234.herokuapp.com/. If you loaded seed data, click on "Explore" to see the app in action.
MIT