The Rails API server for Canadian Pump & Packing Distribution. Serves up JSONAPI payloads for an EmberJs SPA over at https://github.com/cybertooth-io/ccpdist-com-emberjs.
You need the following:
config/master.key
filePerform the following from the command line:
bundle install
- will install any of the missing gems declared in the Gemfile
docker-compose up -d
- start up a Redis and PostgreSQL server in a containerrake db:create
- only required the first time, make sure your database is createdrake db:migrate
- run as required, your application will produce a stacktrace of errors if you're not up to daterake db:seed_fu
- run as required, to seed the database with datarake test
- run as required, test to make sure your API is behavingrails s
- to serve the API on http://localhost:3000
For development, feel free to edit the db/fixtures/development/002_users.rb
file to add yourself.
Seed the database with:
$ rake db:seed_fu
Redis is used by JWTSessions to store Tokens and is also used by Sidekiq to queue up jobs.
JWTSessions is configured in config/initializers/jwt_session.rb
to use database 0
.
Sidekiq is configured in config/initializers/sidekiq.rb
to use database 1
.
If you're creating Sidekiq jobs please use the generator: rails g sidekiq:worker record_session_activity
rails g model role key:string name:string notes:text
default
and null
values are definedaudited
declaration to the model classtest/fixtures/*.yml
(keep it general and un-crazy)config/locales/*.yml
file(s)rails g pundit:policy role
ApplicationPolicy
(it should by default)create?
, destroy?
, index?
, show?
, and update?
accordinglyconfig/locales/*.yml
if so desiredrails g jsonapi:resource api/v1/protected/role
BaseResource
rails g controller api/v1/protected/roles
BaseResourceController
config/routes.rb
file; use jsonapi_resources
helper :-)rubocop -a
prior to commits to make sure your code conforms to the formatting and linting.The config/application.rb
sets the record_session_activity
boolean which is used to determine whether
we should be logging session activity.
As of Rails-5.2 secrets are hashed and locked down with the config/master.key
file. Run rails credentials:help
for
more information.
Do you need to create a key? Use rake secret
Do you need to edit some secrets? Do it from the command line:
$ rails credentials:edit
config/credentials.yml.enc
secret_key_base
- used by Rails in many ways (e.g. BCrypt)
secret_jwt_encryption_key
- used by JWT & JWT_Sessions to create access & refresh tokens
config/application.rb
's version property.git tag v#.#.#
config/application.rb
's version property.Coming soon
Team members, create a branch and pull request.
General Public: Fork and create pull request.