2.6.3
bundle install
yarn install
bundle exec rails db:create db:migrate rails db:seed
bundle exec rails s
- Obtain a copy of the 'commitments' CSV if not already present in
lib/data/seeds
- Run
rake import:commitments
- On the Commitments page, you should see a list of commitments.
We are dependant on several fields on Commitment to filter the results we want to return over the API.
scope :api_records, -> { where(state: 'live', cfn_approved: true, shareable: true) }
We need to add these to any csv file for importing:
state, cfn_approved, shareable
live, true, true
live, true, true
We have an external API, that currently only includes a commitments index. The API only returns commitments created in Nature Commitments via the form or csv import, and which are published.
The API does not use authentication, but is rate limited to 25 requests per minute followed by a 10 minute ban. This is implemented on the server using Cloudflare, and not handled in the Rails app.
Run docker compose -f docker-compose-deploy.yml up -d
in your local machine.
Then in the container:
bash
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
bundle exec cap staging deploy