- Ruby (see the version to install in .ruby-version)
- PostgreSQL
It is recommended to use rbenv to install a specific Ruby version.
- Install Ruby with the correct version (run
rbenv version
to check) - Install PostgreSQL
- Clone the project
- Install dependencies with
bundle install
- Initialize the database (users, databases) by running
init_db.sql
:sudo --user postgres psql < ./.github/workflows/init_db.sql
- (Optional) Edit
config/database.yml
if you chose a different password - Install Overcommit:
bin/overcommit --install
- Add a
master.key
file in theconfig
folder and add the key from vault
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.
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).
See the docs folder for the documentation.
Some interesting documents:
- the results of a brainstorming session about our requirements
- how some of the features work (high-level overview)
- our guide on how to upgrade Rails
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.
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.
- 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.
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
-
...