This application allows users to create and manage work orders.
To create the databases for your local environment: bundle exec rails db:setup
Use Yarn to install the required Node modules: bundle exec rails yarn:install
To create the exchanges, queues and usernames etc. use the GitLab repo: aker-environments
There is a Procfile which should allow you to run the project with foreman start.
I had to jump through the following hoops:
-
Using correct node version
brew install nvm nvm ls-remote --lts # list versions with long-term support nvm install 8.15.0 # or whatever versionThe
.nvmrcspecifies what version the application will run with. -
Getting dependencies
yarn install yarn upgradeI got warnings about missing dependencies related to
webpack-dev-server. I ended up downgrading it to version 2 (specified inpackage.json). -
webpack port
I changed
config/webpackerto specify port 3036 instead of 3035, so it wouldn't try to use the same port as the set shaper.
To run the rspec tests: bundle exec rspec
To run JavaScript tests: yarn test
The following messages are useful during testing:
Run bundle update followed by bundle exec rspec to have the latest gems included in the project
and make sure that they behave as expected.
Run yarn upgrade follow by yarn test to have the latest node packages included in the project
and make sure that they behave as expected.
Assets are now compiled on the environments and do not need to be committed with the project anymore.
Work Orders are dispatched through the use of a job queue provided by the Que gem. Jobs are not removed from the queue after they have been processed. Instead, they are marked as finished and kept in the database. If dispatch fails, jobs are added back to the queue for processing at a later time (config options to customise in application.rb).
You can get some basic stats on the queue using Que.job_stats.
There is also a QueJob model with a number of scopes available to look at jobs more closely:
QueJob.erroredQueJob.not_erroredQueJob.expiredQueJob.not_expiredQueJob.finishedQueJob.not_finishedQueJob.scheduledQueJob.not_scheduledQueJob.readyQueJob.not_ready