Skip to content

Rapprocher les Entreprises des Solutions publiques Optimales

Notifications You must be signed in to change notification settings

Ssimo7/reso

 
 

Repository files navigation

RéSo

Apporter l’ensemble des aides publiques aux entreprises qui en ont besoin. reso.beta.gouv.fr

Créé dans le contexte de l’incubateur des startups d’état.

Getting started

  1. Clone the repository.

     $ git clone [email protected]:betagouv/reso.git
     $ cd reso
    
  2. Install Ruby using rbenv. See .ruby-version file to know which Ruby version is needed.

     $ brew install rvm
     $ rbenv install
    
  3. Install PostgreSQL and create a user if you don’t have any.

     $ brew install postgres
    

    Create a PostgreSQL user (replace my_username and my_password).

     $ psql -c "CREATE USER my_username WITH PASSWORD 'my_password';"
    

    Or:

     $ postgres createuser my_username
    
  4. Create config/database.yml file from config/database.yml.example. Fill development and test sections in the latter with your PostgreSQL username and password.

     $ cp config/database.example.yml config/database.yml
    
  5. Install project dependencies (gems) with bundler.

     $ gem install bundler
     $ bundle
    
  6. Execute database configurations for development and test environments.

     $ rake db:create db:migrate
     $ rake db:create db:migrate RAILS_ENV=test
    
  7. Create .env file from .env.example, and ask the team to fill it in.

     $ cp .env.example .env
    
  8. You can now start a server.

     $ gem install foreman
     $ foreman start --procfile=Procfile.dev
    

    And yay! Reso is now running locally!

Tests

  • bin/rspec : Rspec tests
  • rake lint:
    • rake lint:rubocop : ruby files code style
    • rake lint:haml : haml files code style
    • rake lint:i18n : i18n missing/unused keys and formatting
    • rake lint:brakeman : static analysis security vulnerability

Development data

You can import data in your local development database from remote staging database. See the official documentation, Make sure Scalingo CLI is installed.

  1. Dump data from staging or production environments:
scalingo -a reso-staging db-tunnel SCALINGO_POSTGRESQL_URL
# In another terminal
scalingo -a reso-staging env | grep POSTGRESQL # gives you the database password
pg_dump --no-owner --no-acl reso_stagin_5827 > tmp/export.pgsql  -h localhost -p 10000 -U reso_stagin_5827 -o
scalingo -a reso-production db-tunnel SCALINGO_POSTGRESQL_URL
# In another terminal
scalingo -a reso-production env | grep POSTGRESQL # gives you the database password
pg_dump --no-owner --no-acl e_conseils_2947 > tmp/export.pgsql  -h localhost -p 10000 -U e_conseils_2947 -o
  1. Import the dump in the local database:
rake db:drop db:create
psql reso-development -f tmp/export.pgsql -U postgres
rake db:migrate # If your local app has pending migrations
rake db:environment:set RAILS_ENV=development # If you imported data from the production environment

Emails

Development and staging emails are sent on Mailtrap in order to test email notifications without sending them to the real users. Ask the team for credentials.

Deployment

Reso is deployed on Scalingo, with two distinct environment, reso-staging and `reso-production.

GitHub->Scalingo hooks are setup for auto-deployment:

  • The master branch is automatically deployed to the reso-staging env.
  • The production branch is automatically deployed to the reso-staging env.

Additionally, a postdeploy hook is setup in the Procfile so that Rails migrations are run automatically.

In case of emergency, you can always run rails migrations manually using the scalingo command line tool.

$ scalingo -a reso-staging run rails db:migrate
$ scalingo -a reso-production run rails db:migrate 

Contributing

Please read CONTRIBUTING.md for details on our git and coding conventions, and the process for submitting pull requests to us.

About

Rapprocher les Entreprises des Solutions publiques Optimales

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 83.3%
  • HTML 13.7%
  • CSS 2.4%
  • Other 0.6%