We all know what Aji is, what we may not know is how it's structured, what it makes use of, and what conventions it establishes in order to be totally awesome and generally successful.
- Run local console:
bin/aji consoleorbin/aji c - Run remote console:
heroku run console - Run spec tests:
bin/aji specorbin/aji sp - Run local web server:
bin/foreman start web - Run local full stack:
bin/foreman start -c worker=3 - Get Heroku process status:
heroku ps - Change Heroku worker count:
heroku scale web=x worker=y ytworker=z - Create database migration template:
bin/aji migration [migration_file_name] - Generate fresh documentation
bin/aji docs - Update config/resque_schedule.yml:
heroku config:add RESQUE_SCHEDULE="`cat config/resque_schedule.yml`" - Flush/reset memcache:
heroku run rake flush_memcache --app $APPNAME - Kill all dead workers: ``
More info: https://github.com/defunkt/resque/issues/319#issuecomment-3422648
For now, we can use manually delete all dead workers thru console by:
Resque.workers.each do |w| w.unregister_worker end
Remember to restart all workers!!! https://github.com/defunkt/resque/issues/319#issuecomment-1890216
For an exhaustive list it is probably easiest to inspect the Gemfile. Here's
an overview though.
- Git for source code management.
- GitHub for repository hosting.
- LightHouse for project and ticket management.
- Bundler for gem dependency mangement and resolution.
- Thor for command line interaction with the application and environment.
- Rake for simple task running.
- Pry for interactive development and debugging.
- Rspec for unit and integration testing.
- Factory Girl for object mocking.
- Rocco for API and internal documentation generation.
- Foreman for process management during development.
- Ruby, naturally
- Grape for the JSON API.
- Sinatra for the web share view and static site portions.
- OmniAuth for external service authentication.
- OAuth planned use for user authentication.
- PostgreSQL 9 for relational data persistence.
- Redis for set data persistence, message passing, and caching.
- Resque for background job queueing and management.
- ActiveRecord for Object-Relational Mapping.
- Thin for better-than-WEBrick http performance.
- Heroku for easy application management, hosting, and deployment.
- Heroku also provides our Postgres database.
- RedisToGo provides our Redis database Tools.
- NewRelic will provide realtime monitoring and notification.
- Membase provides a Memcached instance to cache expensive or frequently hit pages.
Aji is a Rack application consisting of two major portions, the API, and the
web viewer. Both are lightweight Rack applications powered by the Grape and
Sinatra microframeworks respectively. The main application is the API and the
viewer is kept under lib/viewer but may be separated at a later date.
We use MVC pattern for both applications though the API renders and serves JSON directly from the controller so the view layer only applies to the web share app. Logic should all be contained in the models and the controllers should serve only as the API defintion and accessor to that logic. (Fat models, skinny controllers).
-
The first thing to do is ensure you have RVM with Ruby 1.9.2 or later, PostgreSQL 9.x, and Redis 2.2 or later installed on your development system. The manner in which you install these things is left to you. Create postgres databases for both development and testing environments making a note of the database names for each.
aji_devandaji_testare recommended. -
Next install the heroku command line tool and Bundler. I recommend using rvm's global gemset for these as they will be useful across any number of projects.
gem install heroku bundler -
Follow this article to get Heroku set up. Make a note of where you clone the application and change to that directory.
-
Run
bundle install --binstubs, this will pull all necessary rubygems and install them cleanly. -
Open
config/settings.template.ymlin your preferred editor and customize to suit your setup. Save the result asconfig/settings.yml. DO NOT overwrite the template file. -
Run
bin/aji specto run tests and make sure everything is hunky dory. -
Run
bin/aji consoleto access the development console for the Aji enviornment.include Ajito get direct access to inner classes such as models. -
Run
foreman startto run the entire application including background workers and scheduler. -
Hack. Commit. Push. Conquer.