Skip to content

demarches-simplifiees/demarches-simplifiees.fr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

demarches-simplifiees.fr

Context

demarches-simplifiees.fr is a web platform designed to address the French government's urgent need to comply with the directive for 100% digitization of administrative procedures.

How to contribute?

demarches-simplifiees.fr is open source software under the AGPL license.

Would you like to make changes or improvements? Read our contribution guide.

Development setup

Technical dependencies

All environments

  • postgresql (version >= 15)
  • imagemagick and gsfonts to generate watermarks on identity documents or generate image thumbnails.

Warning

Remember to restrict ImageMagick's policy to block exploitation of malicious images. The default configuration is usually insufficient for images from the web. For example, on Debian/Ubuntu in /etc/ImageMagick-6/policy.xml:

<!-- in addition to the default policy, add at the end of the file -->
<policymap>
    <policy domain="coder" rights="none" pattern="*"/>
    <policy domain="coder" rights="read | write" pattern="{JPG,JPEG,PNG,JSON}"/>
    <policy domain="module" rights="none" pattern="{MSL,MVG,PS,SVG,URL,XPS}"/>
</policymap>

We are currently migrating from delayed_job to sidekiq for asynchronous job processing. To run sidekiq, you will need:

  • redis

  • lightgallery: a license has been purchased to support the project, but it is not required if the library is used as part of an open source application.

Development

Tests

If Chrome's installation location is non-standard, or if you're using Brave or Chromium instead, you may need to override the path to the Chrome binary for your machine, for example:

# create file spec/support/spec_config.local.rb

Selenium::WebDriver::Chrome.path = "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"

# Must exactly match the browser version
Webdrivers::Chromedriver.required_version = "103.0.5060.53"

It's also possible to automatically install and update when running bin/update by defining the UPDATE_WEBDRIVER environment variable. The binaries will be installed in the ~/.local/bin/ directory, which must be manually added to your path.

Creating database roles

The information needed to initialize the database must be pre-configured manually using the following procedure:

su - postgres
psql
> create user tps_development with password 'tps_development' superuser;
> create user tps_test with password 'tps_test' superuser;
> \q

Initializing the development environment

On Ubuntu, some packages must be installed first:

sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev libcurl4-gnutls-dev zlib1g-dev

To initialize the development environment, run the following command:

bin/setup

Launching the application

Start the application server like this:

bin/dev

The application will then run at http://localhost:3000 with a worker for jobs and the vitejs bundler running in parallel.

Test users

Locally, a test user is automatically created with the credentials test@exemple.fr/this is a very complicated password !. (see db/seeds.rb)

Scheduling recurring tasks

rails jobs:schedule

Viewing emails sent locally

Open the page http://localhost:3000/letter_opener.

Updating the application

To update your development environment, install new dependencies, and run migrations:

bin/update

Running tests (RSpec)

Tests need their own database, and some of them use Selenium to run in a browser. Don't forget to create the test database and install Chrome and chromedriver to run all tests.

To run the application tests, several options are available:

  • Run all tests

      bin/rake spec
      bin/rspec
    
  • Run a specific test

      bin/rake spec SPEC=file_path/file_name_spec.rb:line_number
      bin/rspec file_path/file_name_spec.rb:line_number
    
  • Run all tests in a file

      bin/rake spec SPEC=file_path/file_name_spec.rb
      bin/rspec file_path/file_name_spec.rb
    
  • Only rerun tests that previously failed

      bin/rspec --only-failures
    
  • Run one or more system tests with a visible browser

      NO_HEADLESS=1 bin/rspec spec/system
    
  • Display JavaScript error logs from the browser console (console.error('hello'))

      JS_LOG=debug,log,error bin/rspec spec/system
    
  • Increase latency during end-to-end tests to detect stubborn bugs

      MAKE_IT_SLOW=1 bin/rspec spec/system
    

Adding tasks to run during deployment

    rails generate after_party:task task_name

Linting

The project uses several linters to check code readability and quality.

  • Run all linters: bin/rake lint
  • Check the status of translations: bundle exec i18n-tasks health
  • AccessLint runs automatically on PRs

Regenerating binstubs

bundle binstub railties --force
bin/rake rails:update:bin

Deployment

See deployment notes in DEPLOYMENT.md

Common tasks

Super-admin account management tasks

Super-admin account management tasks are available in the superadmin namespace. To list them: bin/rake -D superadmin:.

Support tasks

Support tasks are available in the support namespace. To list them: bin/rake -D support:.

Performance

View performance data on Skylight

We use Skylight to monitor our application's performance.

Additionally, we use Yabeda to export Prometheus-format metrics for Sidekiq. This is activated via the PROMETHEUS_EXPORTER_ENABLED environment variable (see config/env.example.optional).

About

Dématérialiser et simplifier les démarches administratives

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 78