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.
-
Clone the repository.
$ git clone [email protected]:betagouv/reso.git $ cd reso
-
Install Ruby using rbenv. See
.ruby-version
file to know which Ruby version is needed.$ brew install rvm $ rbenv install
-
Install PostgreSQL and create a user if you don’t have any.
$ brew install postgres
Create a PostgreSQL user (replace
my_username
andmy_password
).$ psql -c "CREATE USER my_username WITH PASSWORD 'my_password';"
Or:
$ postgres createuser my_username
-
Create
config/database.yml
file fromconfig/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
-
Install project dependencies (gems) with bundler.
$ gem install bundler $ bundle
-
Execute database configurations for development and test environments.
$ rake db:create db:migrate $ rake db:create db:migrate RAILS_ENV=test
-
Create
.env
file from.env.example
, and ask the team to fill it in.$ cp .env.example .env
-
You can now start a server.
$ gem install foreman $ foreman start --procfile=Procfile.dev
And yay! Reso is now running locally!
bin/rspec
: Rspec testsrake lint
:rake lint:rubocop
: ruby files code stylerake lint:haml
: haml files code stylerake lint:i18n
: i18n missing/unused keys and formattingrake lint:brakeman
: static analysis security vulnerability
You can import data in your local development database from remote staging database. See the official documentation, Make sure Scalingo CLI is installed.
- 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
- 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
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.
Reso is deployed on Scalingo, with two distinct environment, reso-staging
and `reso-production.
reso-staging
is served at https://reso-staging.scalingo.io.reso-production
is the actual https://reso.beta.gouv.fr
GitHub->Scalingo hooks are setup for auto-deployment:
- The
master
branch is automatically deployed to thereso-staging
env. - The
production
branch is automatically deployed to thereso-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
Please read CONTRIBUTING.md for details on our git and coding conventions, and the process for submitting pull requests to us.