Skip to content

leihs/leihs-inventory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

248 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leihs Inventory

Development

Start server

# to build latest FE and run BE
npm inst
npm run build

bin/dev-run-backend

Start client

Install and start:

bin/dev-run-frontend

For a quicker start when already installed before:

npm run dev

Sync Locales

npx i18next-locales-sync -p de -s en -l resources/public/inventory/assets/locales/ --spaces 2 --useEmptyString true

Then discard changes in zod.json files

Formatting Code

Clojure(Script) formatting

Use ./bin/cljfmt check and ./bin/cljfmt fix.

From vim you can use :! ./bin/cljfmt fix % to format the current file.

Ruby formatting

Use standardrb and standardrb --fix.

Production build

See ./bin/build

Development-Setups

Frontend Development

  1. /inventory
    http://localhost:8080/

    # leihs/inventory
    ./bin/dev-run-backend

Standalone

  1. /inventory
    http://localhost:3260/
    See SESSION_HANDLING_ACTIVATED?
    # leihs/inventory
    ./bin/dev-run-backend

Setup with proxy/my/inventory

  1. Proxy
    http://localhost:3200/
    # leihs/integration-tests
    ./bin/start-reverse-proxy
  2. /inventory
    http://localhost:3260/
    # leihs/inventory
    ./bin/dev-run-backend
  3. /my (provides simple login)
    http://localhost:3240/
    # leihs/my
    ./bin/dev-run-backend
  4. Legacy (not required)
    # leihs/legacy
    ./bin/rails server -p 3210

Backend Coding Guidelines

  1. always a dedicated handler per route (no reuse of handlers between multiple routes)
  2. mapping of routes to file structure and namespaces (example: /inventory/:pool-id/models/:model-id/entitlements -> /inventory/inventory-pool/models/model/entitlements.clj )
  3. maintain parity between frontend and backend routes as far as possible (in frontend as well as in legacy all views/resources are scoped under :pool-id-> do the same for backend routes -> no global resources like e.g. /inventory/models but /inventory/:pool-id/models)
  4. no configs in yml files. following system is setup in other leihs apps which has to be followed like this:
  • default in namespace
  • ENV overrides default in namespace
  • CLI parameter overrides ENV and namespace default
  1. no temporary personal debug stuff under main namespace /inventory/inventory-pool/... (if desired than place it under another namespace and don't include it in production build)
  2. no versioning of routes until prod release (afterwards ok). keep always the actual version depending on the specification and test.
  3. no grouping of routes in swagger. all routes are listed flat and alphabetically sorted.
  4. don't use native clojure print facilities (like println) for debug log statements. they are active always irrespective of log level! use debug, warn etc. instead always making an adequate judgement what and what not to have in prod log. we don't want to clutter prod log (performance and readability). debug statements are safe in general even if one forgets them in a particular file: they don't clutter prod log and even development log unless the respective namespaces is activated for debug logging.
  5. eliminate dead code (unused vars, etc.). also keep number of unused :requires low (you can use clojure-lsp "clean ns" command)
  6. keep field definitions in context of entities; don't create a centralized field registry:
  • utils/coercion/spec_alpha_definition*.clj
  • utils/helper.clj -> convert-map-if-exist
  1. use canonical routes
  2. middlewares location - always place middlewares in src/leihs/inventory/server/middlewares
  3. utils location - always place utilities/helpers in src/leihs/inventory/server/utils

Create artifact & deploy manually

./bin/build

scp leihs-inventory.jar <user>@<server>:/leihs/inventory/leihs-inventory.jar

systemctl restart leihs-inventory.service

Clojure tests

# additional clojure-tests can be triggered by:
clojure -X:test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 6