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)!
First, please review this document and the Code of Conduct.
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.
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.
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.
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 theRAILS_CREDENTIALS_PATH
environment variable.
- 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 toproduction
(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
).
The setup steps expect the following tools to be installed on the system:
1. Ruby - 2.7.1
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
2. MySQL - 5.7
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.
git clone git@github.com:CovidShield/portal.git
There are several environment variables you can set to configure the application.
To configure these:
cp config/local_env.yml.sample config/local_env.yml
- 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 tolocalhost
)DATABASE_USER
- The user MySQL is configured with for access (defaults toroot
)DATABASE_PASSWORD
- The password for the MySQL user (defaults to blank)KEY_CLAIM_HOST
- The host the COVID Shield server is running onKEY_CLAIM_TOKEN
- The token the COVID Shield server is configured to use
bundle install
yarn install
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
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
.
bundle exec rails test
bundle exec rails test:system