Skip to content

compassionprojects/socialchange

Repository files navigation

Run tests Ruby Code Style

Social Change Stories

An effort to collect all social change stories where Nonviolent-Communication is a part of. Along side, it offers a community to run and support many of these projects.

Requirements

  • ruby 3.3.0 (use rbenv to manage ruby versions)
  • postgres >= 14.5
  • nodejs >= 20.x

Development

Clone the repo

bundle install
rake db:create
rake db:migrate
cp .env.development.local.template .env.development.local # replace necessary values
# also create a copy for .env.test.local
bin/dev

To seed the database

rake db:seed

We use standardrb for code linting and formatting.

Install the editor extension so that code is formatted as you type

Tests

bin/rspec

or if you want to watch tests while developing

bin/guard

Search

We are using jsonb fields to store translated content. We use mobility to make this happen. Along side this we use mobility-ransack plugin to perform text search. We use gin expression indexes on jsonb fields to perform text search. If we add more languages, we must make sure to add a new index for the introduced language. See this migration to check how it was done for currently supporting languages.

Ideally we'd like to use to_tsvector FTS but there needs to be some work done on upstream. See #23 for more info.

RBAC

We use a simple role based authorization system with permissions. Inspired by this article. This gives us fine grained control on which user can do what.

File uploads

We are using tigris (S3 compatible object storage) with rails active_storage to store attachments in the cloud. They offer free allowance together with fly.io.

Deployment

We use fly.io as our deployment platform.

To deploy:

fly deploy

and the production branch is automatically deployed to fly using github actions.

Analytics

We are using umami.is service for measuring traffic and usage of the website. You can view the usage here