fny / greenlight

Symptom monitoring for schools for COVID-19
Other
1 stars 0 forks source link

Greenlight 🚦

Open source symptom monitoring software for COVID-19.

Primary Authors

Special thanks to all of our contributors 🍻

Requirements

Backend Set Up

Dependencies

For Ruby and Node, we recommend using a manager like rvm, rbenv, nvm. I prefer to use asdf since it covers both and will respond to version changes in .tool-versions=. If

For Postgres and Redis, we recommend you install them using Homebrew on macOS or a Linux package manager of your choice.

After you've installed the above and, run the following to install all the Ruby dependencies and load the database with seed data.

Getting Rails Up and Running

Run bundle install to install all of the packages listed in the Gemfile.

To set up the database, you should only need to run the following:

bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:seed

If you ever need to restart everything in the db from scratch, run bundle exec rake db:nuke.

Running the project

To access emails, install mailcatcher and visit http://localhost:1080. If you're on a Mac, you may have installation issues. Use the following line to install it:

gem install mailcatcher -- --with-cflags="-Wno-error=implicit-function-declaration"

Development URLs

TODO: We should consider migrating everything to HTTPS to keep production and development more similar.

This is extremely important. Due to a number of CORS issues, you'll need to access the app through a subdomain rather than through localhost.

The configurations are set up so that you can:

I highly recommend that you use these addresses. You can alternatively modify your /etc/hosts file to pick your own URL and set the appropriate environment variable your .env.local file.

If you don't want to have to type in ports, you can use the NGINX configurations avaiable at nginx-development.conf to proxy requests to those addresses.

Speaking of .env files...

Environment Variables and Configuration

We use .env files across both the backend and frontend for configuration during development and test. The production environments use Heroku's built in environment configuration.

TODO: We should consider migrating to Rails secrets management so that we can share configurations for testing production-like endpoints that use all our third-party services.

If you look through the .env.development file, you'll find comments on what these variables mean. These variables are validated in config/initializers/001_environment_variables.rb. The app should blow up if things aren't set up properly.

Running Cordova

There are a few other useful commands in the root package.json too.

Coding Conventions

Editor Setup

We don't really care what editor you use for as long as you follow the coding conventions imposed by Rubocop and eslint. If something really annoys you, talk to Faraz. He's probably fine with disabling it.

You should try to have the following plugins in whatever editor you choose to use:

Visual Studio Code is recommended with the following plugins:

If you're coming from Sublime, this extension might come in handy.

If you're using VSCode, you should use the workspace specific configurations provided in this repo.

Comment Annotations

Prefix your comments with the following when an action item needs to be taken.

Commit Messages

Prefix your commits with the following so we know what's happening. We aim to follow Conventional Commits

For commits associated with releases (e.g. the CHANGELOG update) use the following format:

Feel free to change the emoji.

Short URLs

We have a short URL that is used to help access the app using text messages. It's available across all of the environments:

This variable is set using the SHORT_URL environment variable.

License

Greenlight is published under the GNU General Public License v3.0. Alternative licensing is available for charge. Please contact faraz at greenlightready.com for details.