Skip to content

rezoleo/lea5

Repository files navigation

README

codecov Lint & test

Requirements

It is recommended to use rbenv to install a specific Ruby version.

Development

  1. Install Ruby with the correct version (run rbenv version to check)
  2. Install PostgreSQL
  3. Clone the project
  4. Install dependencies with bundle install
  5. Initialize the database (users, databases) by running init_db.sql: sudo --user postgres psql < ./.github/workflows/init_db.sql
  6. (Optional) Edit config/database.yml if you chose a different password
  7. Install Overcommit: bin/overcommit --install
  8. Add a master.key file in the config folder and add the key from vault

Tests

The basic command to run tests is rails test.

By default, "system" tests (end-to-end tests with a real browser) are not run with rails test. You need to run rails test:system to run them specifically, or rails test:all. System tests execute in a headless Chrome/Chromium browser (meaning the browser window will not appear), but you can select your browser of choice (Chrome, Firefox or Firefox Nightly) and configure the headless behavior with the following commands:

  • rails test:system:chrome
  • rails 'test:system:chrome[headless]'
  • rails test:system:firefox
  • rails 'test:system:firefox[headless]'
  • rails 'test:system:firefox[nightly]'
  • rails 'test:system:firefox[nightly,headless]'

Note that if you pass arguments to the rails tasks (using square brackets), you need to quote the entire task name or else your shell will probably try to expand the brackets (see the examples above).

We use a bit of tooling around tests to help us and increase our confidence in our code:

  • Minitest and minitest-reporters are used to polish test outputs
  • Guard is set up to run tests automatically on changes. You can start it with bin/guard
  • Test coverage is done with Simplecov. After running your tests, open coverage/index.html in the browser of your choice. For the tests to pass, there must be a minimum global coverage of 90% and 80% per branch and file.

Secrets

We are using the secrets management provided by rails. The secrets are encrypted by a master key, and are stored in config/credentials.yml.enc. To edit the secrets, use the command EDITOR="nano" rails credentials:edit (if you don't have nano, use another editor).

Documentation

See the docs folder for the documentation.

Some interesting documents:

Tips

Use local login instead of SSO

When developing Lea5, you might want to test the app with different user rights, or work offline/while the SSO is down. You can use the local development login strategy.

Fix PostgreSQL collation version mismatch

If you get the following errors from PostgreSQL after upgrading glibc or icu, you can run bin/reindex-db-after-collation-upgrade

WARNING:  database "postgres" has a collation version mismatch
DETAIL:  The database was created using collation version X.YY, but the operating system provides version X.ZZ.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION,
or build PostgreSQL with the right library version.

Inspirations

  • Our original project Lea4. We had to move to Re2o when we became independent and needed to manage subscriptions.
  • Re2o, which we used for 4 years. Unfortunately, it does too much, and is too complex to configure, use and maintain.

License

MIT


This README would normally document whatever steps are necessary to get the application up and running.

Things you may want to cover:

  • Ruby version

  • System dependencies

  • Configuration

  • Database creation

  • Database initialization

  • How to run the test suite

  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions

  • ...

About

Lea5 is the management software used by the Rézoléo association, to handle members, computers and invoices

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 8