-
Notifications
You must be signed in to change notification settings - Fork 2
Running the development system
ACA Engine is a Rails Engine meaning it is not standalone and requires a Rails application to run. This allows you the maximum flexibility to extend the functionality provided by Engine with your own APIs.
This is a basic guide to how to setup your Rails application. You can either clone our existing Application Template or follow the guide below.
NOTE:: Rails 5 includes Spring, which is meant to improve load times however I find it loads old versions of code during development, leading to very weird bugs. I recommend disabling it: export DISABLE_SPRING=1
git clone https://github.com/acaprojects/ruby-engine.git
git clone https://github.com/acaprojects/aca-device-modules.git
git clone https://github.com/acaprojects/ruby-engine-app.git
cd ruby-engine-app
-
bundle update
(to install dependencies) -
rails migrate:nodes
(ensures basic DB configuration is in place)- Edit
config/couchbase.yml
if you did not use the default bucket in couchbase
- Edit
-
bundle exec sg
(to run the application)
Once the the application is running, ctrl-c
to quit, and you'll need to setup a domain
- See the rake task definitions (worth looking at this)
- Create and authority (this is the domain settings)
rake "domain:add_authority[Engine,http://localhost]"
- Add a base app - backoffice uses this
rake "domain:add_app[Backoffice,http://localhost:3000]"
- NOTE:: if you should run this a few times with the different ports you might use.
- Create and authority (this is the domain settings)
rails new ./ruby-engine --skip-spring --skip-active-record --skip-puma --skip-sprockets --skip-action-cable --skip-javascript --skip-turbolinks --api
This will build an cut down, API only, rails application called EngineApp (we primarily use Angular for user interfaces)
You’ll then need to add the following projects to the Gemfile:
gem 'spider-gazelle', '~> 3.0'
# TODO:: we should package these up as GEMS? Probably only ruby-engine
gem 'orchestrator', path: '../ruby-engine'
gem 'aca-device-modules', path: '../aca-device-modules'
# Our Database Adapter
gem 'couchbase-orm'
# Authentication
gem 'doorkeeper-couchbase'
gem 'coauth', github: 'QuayPay/coauth', branch: 'couchbase-orm'
Then you’ll have to configure where you would like to mount orchestrator.
Edit: ./config/routes.rb
mount Orchestrator::Engine => "/control", as: "control"
You’ll need some couchbase configuration data too:
rails generate couchbase:config
Add STDOUT logging to the development environment: ./config/environments/development.rb
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
Omniauth needs to be configured: ./config/initializers/omniauth.rb
(with a session store configured)
Rails.application.config.session_store :cookie_store, key: '_engine_app_session'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :developer unless Rails.env.production?
end
You are now ready to perform steps 2 and 3 of the control template instructions