The application is built as a combination of traditional Ruby on Rails for the backend and frontend administration interfaces along with a React app for the kiosk displays.
- Ruby 2.5.1
- NVM
See example files located in config/**/\*
for the type of configurations needed on the server
shared/config
: Contains server configuration files not appropriate for the repository, symlinked by the deploy process.shared/config/application_config.yml.erb
: Application specific configuration, such as Google Analytics ID.shared/config/local_env.yml
: Local ENV variables used in files such as database.yml.shared/config/config.yml
: Application deployment configurations for server, path, and user detail.shared/config/puma/*.rb
: Environment specific configurations for the Puma web server.shared/config/secrets.yml
: Secrets.
Run yarn install
in the application root directory to install dependencies.
Copy config/application_config.example.yml.erb
to config/application_config.yml.erb
.
Copy config/local_env.example.yml
to config/local_env.yml
In config/local_env.yml
set values for CAS_BASE_URL and CAS_VALIDATE_URL (see production server)
First log in, then in Rails Console:
irb(main):001:0> me = User.last
irb(main):002:0> me.admin = true
irb(main):003:0> me.save
Run bundle exec rake test_drupal_database:setup
to load the development database with some seed data for the "Hours" API.
docker-compose build
docker-compose up web
docker-compose exec web bundle exec rails c
App code is found in app/javascript/react
.
Tests are run using Jest and are found in spec/javascripts/react
with a directory
structure to match the app code.
actions/*
: Redux actions.components/presentational/**/*
: Simple presentational components.components/Root.js
: The React application root container that ties the Redux store to the component tree.components/*
: Components which use Reduxconnect
to connect the dispatch and state to props.reducers/*
: Redux reducers.store/configureStore.js
: Redux store creation with middleware.
- The API has versioning with the ability to
warn
andexpire
versions based on a configuration change inapp/config/application_config.yml.erb
. app/controllers/api/v#
: Controllers and concerns.app/models/api/v#
: Models.config/initializers/api.rb
: Require all of the code inlib/api/**/*
.config/initializers/db_config.rb
: Load and parse theconfig/database.yml
.config/locales/en.yml
: Localized strings for api related messages.config/routes.rb
: Contains namespaced routes and configuration for the api routes.lib/api/v#
: API related code by version.lib/tasks/api/v#
: Rake task(s), such astest_drupal_database:setup
.- Specs are located in similarly named paths related to the API and version directories.
The API routes are protected by constraints described in lib/api/v#/constraints.rb
which enforce the existence and setting
of the ACCEPT
header on each request. An example of a valid HTTP ACCEPT header for version 1:
ACCEPT=application/vnd.kiosks.v1