Skip to content

Latest commit

 

History

History
189 lines (122 loc) · 5.99 KB

CONTRIBUTING.md

File metadata and controls

189 lines (122 loc) · 5.99 KB

Contributing Guidelines

Welcome, and thank you for considering contributing to COVID Shield!

We’d love to get your issues (if you find any bugs) and PRs (if you have any fixes)!

Code of Conduct

First, please review this document and the Code of Conduct.

Reporting Security Issues

COVID Shield takes security very seriously. In the interest of coordinated disclosure, we request that any potential vulnerabilities be reported privately in accordance with our security policy.

Contributing

Contributing Documentation

If you'd like to contribute a documentation or static file change, please feel free to fork the project in Github and open a PR from that fork against this repository.

Contributing Code

If you'd like to contribute code changes, the following steps will help you setup a local development environment. If you're a Shopify employee, dev up will install the above dependencies and dev {console,test,etc.} will work as you'd expect.

If you're not at Shopify, please see below.

Once you're happy with your changes, please fork the repository and push your code to your fork, then open a PR against this repository.

Running the COVID Shield portal

Deployment

Docker Container

The covidshield/portal container on dockerhub cannot be used as is. In order to deploy it successfully you either have to:

  • Create your own container (the container on dockerhub can be used as a base layer) and replace the config/credentials.yml.enc file with your own.
  • Use the dockerhub container, and use a volume mount when deploying to provide your own credentials.yml.enc file. In this case, be sure to set the RAILS_CREDENTIALS_PATH environment variable.

Environment Variables

  • Required
    • RAILS_MASTER_KEY - The encryption key used to decrypt your encrypted credentials file (e.g. config/credentials.yml.enc).
    • DATABASE_URL - The string used to connect to the MySQL database (e.g. mysql2://myuser:mypass@localhost/somedatabase).
    • RAILS_ENV - The Rails environment to use. Should always be set to production (even in docker-compose).
  • Optional
    • RAILS_CREDENTIALS_PATH - Overrides the default encrypted credentials path. Set this if you're providing your own file at the non-standard location (i.e. config/credentials.yml.enc).

Prerequisites

The setup steps expect the following tools to be installed on the system:

You can use rbenv or rvm to install the specific version you need.

Example using rvm:

rvm install 2.7.1
rvm use 2.7.1

You can use the official MySQL installer or you can use homebrew.

Example using homebrew:

brew install mysql
brew services start mysql

You can use the official Node.js installer or nvm.

Example using nvm:

nvm install 12.17.0
nvm use 12.17.0

You can use the official installation script or homebrew.

Example using homebrew:

brew install yarn
gem install rails -v 6.0.3.1

You will need to follow the instructions for setting up the Diagnosis Server.

Running

1. Clone the repository

git clone git@github.com:CovidShield/portal.git

2. Setup local environment

There are several environment variables you can set to configure the application.

To configure these:

  1. cp config/local_env.yml.sample config/local_env.yml
  2. Open config/local_env.yml and edit the values as needed

The available variables you can configure are:

  • DATABASE_HOST - The host the MySQL server is running on (defaults to localhost)
  • DATABASE_USER - The user MySQL is configured with for access (defaults to root)
  • DATABASE_PASSWORD - The password for the MySQL user (defaults to blank)
  • KEY_CLAIM_HOST - The host the COVID Shield server is running on
  • KEY_CLAIM_TOKEN - The token the COVID Shield server is configured to use

3. Install dependencies

bundle install
yarn install

4. Create and set up the database

Run the following commands to create and set up the development database.

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

5. Start the Rails server

You can start the rails server using the command given below replacing the KEY_CLAIM_HOST to match the URL of your running diagnosis server config and the KEY_CLAIM_TOKEN to match the token it is running with.

bundle exec rails server

And now you can visit the portal with the URL http://localhost:3000

The default username and password is admin@covidshield.app and password.

Testing

Running the controller tests

bundle exec rails test

Running the system tests

bundle exec rails test:system